[OpenWrt-Devel] [PATCH] wireguard: bump to 0.0.20190227

2019-02-27 Thread Jason A. Donenfeld
* wg-quick: freebsd: allow loopback to work

FreeBSD adds a route for point-to-point destination addresses. We don't
really want to specify any destination address, but unfortunately we
have to. Before we tried to cheat by giving our own address as the
destination, but this had the unfortunate effect of preventing
loopback from working on our local ip address. We work around this with
yet another kludge: we set the destination address to 127.0.0.1. Since
127.0.0.1 is already assigned to an interface, this has the same effect
of not specifying a destination address, and therefore we accomplish the
intended behavior. Note that the bad behavior is still present in Darwin,
where such workaround does not exist.

* tools: remove unused check phony declaration
* highlighter: when subtracting char, cast to unsigned
* chacha20: name enums
* tools: fight compiler slightly harder
* tools: c_acc doesn't need to be initialized
* queueing: more reasonable allocator function convention

Usual nits.

* systemd: wg-quick should depend on nss-lookup.target

Since wg-quick(8) calls wg(8) which does hostname lookups, we should
probably only run this after we're allowed to look up hostnames.

* compat: backport ALIGN_DOWN
* noise: whiten the nanoseconds portion of the timestamp

This mitigates unrelated sidechannel attacks that think they can turn
WireGuard into a useful time oracle.

* hashtables: decouple hashtable allocations from the main device allocation

The hashtable allocations are quite large, and cause the device allocation in
the net framework to stall sometimes while it tries to find a contiguous
region that can fit the device struct. To fix the allocation stalls, decouple
the hashtable allocations from the device allocation and allocate the
hashtables with kvmalloc's implicit __GFP_NORETRY so that the allocations fall
back to vmalloc with little resistance.

* chacha20poly1305: permit unaligned strides on certain platforms

The map allocations required to fix this are mostly slower than unaligned
paths.

* noise: store clamped key instead of raw key

This causes `wg show` to now show the right thing. Useful for doing
comparisons.

* compat: ipv6_stub is sometimes null

On ancient kernels, ipv6_stub is sometimes null in cases where IPv6 has
been disabled with a command line flag or other failures.

* Makefile: don't duplicate code in install and modules-install
* Makefile: make the depmod path configurable

* queueing: net-next has changed signature of skb_probe_transport_header

A 5.1 change. This could change again, but for now it allows us to keep this
snapshot aligned with our upstream submissions.

* netlink: don't remove allowed ips for new peers
* peer: only synchronize_rcu_bh and traverse trie once when removing all peers
* allowedips: maintain per-peer list of allowedips

This is a rather big and important change that makes it much much faster to do
operations involving thousands of peers. Batch peer/allowedip addition and
clearing is several orders of magnitude faster now.

Signed-off-by: Jason A. Donenfeld 
---
 package/network/services/wireguard/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/package/network/services/wireguard/Makefile 
b/package/network/services/wireguard/Makefile
index 2e9f17e..aab3e59 100644
--- a/package/network/services/wireguard/Makefile
+++ b/package/network/services/wireguard/Makefile
@@ -11,12 +11,12 @@ include $(INCLUDE_DIR)/kernel.mk
 
 PKG_NAME:=wireguard
 
-PKG_VERSION:=0.0.20190123
+PKG_VERSION:=0.0.20190227
 PKG_RELEASE:=1
 
 PKG_SOURCE:=WireGuard-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://git.zx2c4.com/WireGuard/snapshot/
-PKG_HASH:=edd13c7631af169e3838621b1a1bff3ef73cf7bc778eec2bd55f7c1089ffdf9b
+PKG_HASH:=fcdb26fd2692d9e1dee54d14418603c38fbb973a06ce89d08fbe45292ff37f79
 
 PKG_LICENSE:=GPL-2.0 Apache-2.0
 PKG_LICENSE_FILES:=COPYING
-- 
2.20.1


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


Re: [OpenWrt-Devel] [LEDE-DEV][PATCH 1/1] at91: bump kernel 4.9 to 4.14.67

2019-02-27 Thread Sandeep.Sheriker
Hi,


yes, I am working on it and I will be sending the new patch series soon.



Regards,

Sandeep Sheriker M



From: Hauke Mehrtens 
Sent: Wednesday, February 27, 2019 3:53 PM
To: Sandeep Sheriker Mallikarjun - C17018; openwrt-devel@lists.openwrt.org
Subject: Re: [OpenWrt-Devel] [LEDE-DEV][PATCH 1/1] at91: bump kernel 4.9 to 
4.14.67

On 9/6/18 5:48 PM, Sandeep Sheriker Mallikarjun wrote:
> Refreshed at91 patches and its configs files.
>
> Signed-off-by: Sandeep Sheriker Mallikarjun 
> 
> ---
>  target/linux/at91/Makefile |   5 +-
>  target/linux/at91/{config-4.9 => config-4.14}  | 284 ++-
>  target/linux/at91/legacy/config-default|   1 +
>  .../100-ARM-at91-build-dtb-for-LMU5000.patch   |  12 +-
>  .../101-ARM-at91-build-dtb-for-q5xr5.patch |  10 +
>  .../102-ARM-at91-build-dtb-for-wb45n.patch |  10 +-
>  .../103-ARM-at91-build-dtb-for-wb50n.patch |   8 +-
>  ...04-ARM-at91-build-dtb-for-sama5d2-ptc-Ek.patch} |  13 +-
>  .../101-ARM-at91-build-dtb-for-q5xr5.patch |  10 -
>  ...4-ARM-at91-build-dtb-for-sama5d27-SOM1-Ek.patch | 893 
> -
>  target/linux/at91/sama5d2/config-default   |  22 +-
>  target/linux/at91/sama5d3/config-default   |  29 +-
>  target/linux/at91/sama5d4/config-default   |  18 +
>  13 files changed, 355 insertions(+), 960 deletions(-)
>  rename target/linux/at91/{config-4.9 => config-4.14} (66%)
>  rename target/linux/at91/{patches-4.9 => 
> patches-4.14}/100-ARM-at91-build-dtb-for-LMU5000.patch (51%)
>  create mode 100644 
> target/linux/at91/patches-4.14/101-ARM-at91-build-dtb-for-q5xr5.patch
>  rename target/linux/at91/{patches-4.9 => 
> patches-4.14}/102-ARM-at91-build-dtb-for-wb45n.patch (63%)
>  rename target/linux/at91/{patches-4.9 => 
> patches-4.14}/103-ARM-at91-build-dtb-for-wb50n.patch (69%)
>  rename 
> target/linux/at91/{patches-4.9/105-ARM-at91-build-dtb-for-sama5d2-ptc-Ek.patch
>  => patches-4.14/104-ARM-at91-build-dtb-for-sama5d2-ptc-Ek.patch} (97%)
>  delete mode 100644 
> target/linux/at91/patches-4.9/101-ARM-at91-build-dtb-for-q5xr5.patch
>  delete mode 100644 
> target/linux/at91/patches-4.9/104-ARM-at91-build-dtb-for-sama5d27-SOM1-Ek.patch
>

Hi,

Are you planning to send an updated version of this patch?

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


Re: [OpenWrt-Devel] [LEDE-DEV][PATCH 1/1] at91: bump kernel 4.9 to 4.14.67

2019-02-27 Thread Hauke Mehrtens
On 9/6/18 5:48 PM, Sandeep Sheriker Mallikarjun wrote:
> Refreshed at91 patches and its configs files.
> 
> Signed-off-by: Sandeep Sheriker Mallikarjun 
> 
> ---
>  target/linux/at91/Makefile |   5 +-
>  target/linux/at91/{config-4.9 => config-4.14}  | 284 ++-
>  target/linux/at91/legacy/config-default|   1 +
>  .../100-ARM-at91-build-dtb-for-LMU5000.patch   |  12 +-
>  .../101-ARM-at91-build-dtb-for-q5xr5.patch |  10 +
>  .../102-ARM-at91-build-dtb-for-wb45n.patch |  10 +-
>  .../103-ARM-at91-build-dtb-for-wb50n.patch |   8 +-
>  ...04-ARM-at91-build-dtb-for-sama5d2-ptc-Ek.patch} |  13 +-
>  .../101-ARM-at91-build-dtb-for-q5xr5.patch |  10 -
>  ...4-ARM-at91-build-dtb-for-sama5d27-SOM1-Ek.patch | 893 
> -
>  target/linux/at91/sama5d2/config-default   |  22 +-
>  target/linux/at91/sama5d3/config-default   |  29 +-
>  target/linux/at91/sama5d4/config-default   |  18 +
>  13 files changed, 355 insertions(+), 960 deletions(-)
>  rename target/linux/at91/{config-4.9 => config-4.14} (66%)
>  rename target/linux/at91/{patches-4.9 => 
> patches-4.14}/100-ARM-at91-build-dtb-for-LMU5000.patch (51%)
>  create mode 100644 
> target/linux/at91/patches-4.14/101-ARM-at91-build-dtb-for-q5xr5.patch
>  rename target/linux/at91/{patches-4.9 => 
> patches-4.14}/102-ARM-at91-build-dtb-for-wb45n.patch (63%)
>  rename target/linux/at91/{patches-4.9 => 
> patches-4.14}/103-ARM-at91-build-dtb-for-wb50n.patch (69%)
>  rename 
> target/linux/at91/{patches-4.9/105-ARM-at91-build-dtb-for-sama5d2-ptc-Ek.patch
>  => patches-4.14/104-ARM-at91-build-dtb-for-sama5d2-ptc-Ek.patch} (97%)
>  delete mode 100644 
> target/linux/at91/patches-4.9/101-ARM-at91-build-dtb-for-q5xr5.patch
>  delete mode 100644 
> target/linux/at91/patches-4.9/104-ARM-at91-build-dtb-for-sama5d27-SOM1-Ek.patch
> 

Hi,

Are you planning to send an updated version of this patch?

Hauke

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


Re: [OpenWrt-Devel] [PATCH v2 3/3] ipq40xx: add support for FritzBox 7530

2019-02-27 Thread David Bauer

Hello Christian,

On 27.02.19 13:03, David Bauer wrote:

Hello Christian,

On 26.02.19 23:17, Christian Lamparter wrote:

Hello David,

On Tuesday, February 26, 2019 12:15:41 AM CET David Bauer wrote:

On 25.02.19 23:10, Christian Lamparter wrote:

On Wednesday, February 20, 2019 6:02:21 PM CET Christian Lamparter wrote:

On Monday, February 18, 2019 11:58:34 PM CET David Bauer wrote:

diff --git 
a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
 
b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
new file mode 100644
index 00..b2a33468bb
--- /dev/null
+++ 
b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
@@ -0,0 +1,305 @@
+&pcie0 {
+   status = "okay";
+
+   ranges = <0x8100 0 0x4020 0x4020
+   0 0x0010   /* downstream I/O */
+   0x8200 0 0x4800 0x4800
+   0 0x1000>; /* non-prefetchable memory */


Let me dig out my MR33 (will have to wait until the Weekend) and see if this
should be put into the qcom-ipq4019.dtsi as well.


And it didn't work. While the pcie enumeration worked fine.
The QCA9887 was no longer attaching. As soon as the driver was
loaded it failed due to:

[8.888466] ath10k_pci :01:00.0: enabling device (0140 -> 0142)
[8.934145] ath10k_pci :01:00.0: failed to wake up device : -110
[8.935258] ath10k: failed to probe PCI : -110, retry-count: 0
[8.949596] ath10k 4.19 driver, optimized for CT firmware, probing pci 
device: 0x50.
[8.989503] ath10k_pci :01:00.0: failed to wake up device : -110
[8.989899] ath10k: failed to probe PCI : -110, retry-count: 1
[9.005086] ath10k 4.19 driver, optimized for CT firmware, probing pci 
device: 0x50.
[9.046821] ath10k_pci :01:00.0: failed to wake up device : -110
[9.049851] ath10k: failed to probe PCI : -110, retry-count: 2
[9.062448] ath10k 4.19 driver, optimized for CT firmware, probing pci 
device: 0x50.
[9.099055] ath10k_pci :01:00.0: failed to wake up device : -110
[9.099442] ath10k: failed to probe PCI : -110, retry-count: 3
[...]
[9.489869] ath10k: failed to probe PCI : -110, retry-count: 10
[9.503780] ath10k_pci: probe of :01:00.0 failed with error -110
[...]

But I think we can fix the problem. Because according to the old
qcom-ipq40xx.dtsi I dug up:



The non-prefetchable memory area window size should be 0x00d0.

ranges =<0x8100 0 0x4020 0x4020 0 0x0010>, /* 
downstream I/O */
<0x8200 0 0x4030 0x4030 0 
0x00d0>; /* non-prefetchable memory */

(yes, I'll be preparing a patch for linux-msm-arm. Can you please let
me know if does indeed finally let you enumerate the device?)


It seems to work with your proposed change:

[0.042117] OF: PCI: host bridge /soc/pci@4000 ranges:
[0.042152] OF: PCI:IO 0x4020..0x402f -> 0x4020
[0.042171] OF: PCI:   MEM 0x4030..0x40ff -> 0x4030
[0.259505] qcom-pcie 4000.pci: link up
[0.259649] qcom-pcie 4000.pci: PCI host bridge to bus :00
[0.259671] pci_bus :00: root bus resource [bus 00-ff]
[0.259687] pci_bus :00: root bus resource [io  0x-0xf]
(bus address [0x4020-0x402f])
[0.259700] pci_bus :00: root bus resource [mem
0x4030-0x40ff]
[0.259742] pci :00:00.0: [17cb:1001] type 01 class 0x060400
[0.259776] pci :00:00.0: reg 0x10: [mem 0x-0x0fff 64bit]
[0.259829] pci :00:00.0: PME# supported from D0 D3hot
[0.260015] PCI: bus0: Fast back to back transfers disabled
[0.260195] pci :01:00.0: [8086:09a9] type 00 class 0x028000
[0.260312] pci :01:00.0: reg 0x10: [mem 0x-0x007f]
[0.260790] pci :01:00.0: supports D1 D2
[0.260797] pci :01:00.0: PME# supported from D0 D1 D3hot D3cold
[0.261043] PCI: bus1: Fast back to back transfers disabled
[0.261095] pci :00:00.0: BAR 8: assigned [mem 0x4080-0x40ff]
[0.261112] pci :00:00.0: BAR 0: assigned [mem
0x4030-0x40300fff 64bit]
[0.261136] pci :01:00.0: BAR 0: assigned [mem 0x4080-0x40ff]
[0.261164] pci :00:00.0: PCI bridge to [bus 01-ff]
[0.261180] pci :00:00.0:   bridge window [mem 0x4080-0x40ff]
[0.261891] pcieport :00:00.0: AER enabled with IRQ 93

See
https://github.com/blocktrron/openwrt/commit/cc1a94b2e1616d33698852df38ae23f72f193b74

How should we proceed on this device? Should i resend a v3 or will you
remove the ranges property and backport the patch you prepare for upstream?


Sorry for the late reply, I added a rebased version
on top of the latest changes) into

[OpenWrt-Devel] [PATCH v3 2/6] ar71xx: Speed up caldata/eeprom handling

2019-02-27 Thread Adrian Schmutzler
Reading and writing to and from flash storage is slowed down
enormously by some functions which use a block size of 1.

This patch reworks the extraction scripts to be much faster and
efficient by reading and writing in possibly one big block.

This is based on the initial commit a69e101 for ipq40xx by
Christian Lamparter .

Speed comparison @ TP-Link TL-WDR4300 (just manually) results
in a time reduction by three orders of magnitude (99.9 %).

> time dd if=/dev/mtd3 of=/lib/firmware/test-slow bs=1 count=4096 skip=4096
4096+0 records in
4096+0 records out
real0m 15.85s
user0m 0.06s
sys 0m 13.28s

> time dd if=/dev/mtd3 of=/lib/firmware/test-fast bs=4096 count=1 skip=4096 
> iflag=skip_bytes
1+0 records in
1+0 records out
real0m 0.02s
user0m 0.00s
sys 0m 0.02s

Signed-off-by: Adrian Schmutzler 

---

Changed in v3:
- Changed position of iflag/oflag to be consistent with ath79
---
 .../linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom  | 6 +++---
 .../ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 94bce7d335..208d5f6bff 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -20,7 +20,7 @@ ath9k_eeprom_extract() {
[ -n "$mtd" ] || \
ath9k_eeprom_die "no mtd device found for partition $part"
 
-   dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2>/dev/null || \
+   dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
ath9k_eeprom_die "failed to extract from $mtd"
 }
 
@@ -35,7 +35,7 @@ ath9k_ubi_eeprom_extract() {
[ -n "$ubi" ] || \
ath9k_eeprom_die "no UBI volume found for $part"
 
-   dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE bs=1 skip=$offset 
count=$count 2>/dev/null || \
+   dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
ath9k_eeprom_die "failed to extract from $ubi"
 }
 
@@ -62,7 +62,7 @@ ath9k_patch_firmware_mac() {
 
[ -z "$mac" ] && return
 
-   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 
seek=2 count=6
+   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc 
oflag=seek_bytes bs=6 seek=2 count=1
 }
 
 board=$(board_name)
diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 3450819630..cd5c1c2bcb 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -10,7 +10,7 @@ ath10kcal_from_file() {
local offset=$2
local count=$3
 
-   dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2>/dev/null || \
+   dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
ath10kcal_die "failed to extract calibration data from $source"
 }
 
@@ -30,7 +30,7 @@ ath10kcal_extract() {
[ "$count" = "$cal_size" ] || \
ath10kcal_die "no calibration data found in $part"
 
-   dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2>/dev/null || \
+   dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
ath10kcal_die "failed to extract calibration data from $mtd"
 }
 
@@ -39,7 +39,7 @@ ath10kcal_patch_mac() {
 
[ -z "$mac" ] && return
 
-   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 
seek=6 count=6
+   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc 
oflag=seek_bytes bs=6 seek=6 count=1
 }
 
 [ -e /lib/firmware/$FIRMWARE ] && exit 0
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH v3 4/6] ar71xx/ath79: Merge eeprom/caldata extraction into eeprom.sh

2019-02-27 Thread Adrian Schmutzler
eeprom/caldata extraction is the same across different targets
and also uses similar functions compared to each other.

This patch is based on the proposed unification by Petr Štetiar.

While this only covers ath79/ar71xx, others target supposedly
will be merged easily.

Signed-off-by: Adrian Schmutzler 

---

New in v3:
Merged from the migration patches in my alternate patchset,
which is obsoleted now.
---
 package/base-files/files/lib/functions/eeprom.sh   | 88 
 .../etc/hotplug.d/firmware/10-ath9k-eeprom | 97 +-
 .../etc/hotplug.d/firmware/11-ath10k-caldata   | 78 +
 .../etc/hotplug.d/firmware/10-ath9k-eeprom | 84 +--
 .../etc/hotplug.d/firmware/11-ath10k-caldata   | 60 -
 5 files changed, 171 insertions(+), 236 deletions(-)
 create mode 100644 package/base-files/files/lib/functions/eeprom.sh

diff --git a/package/base-files/files/lib/functions/eeprom.sh 
b/package/base-files/files/lib/functions/eeprom.sh
new file mode 100644
index 00..80df3bb359
--- /dev/null
+++ b/package/base-files/files/lib/functions/eeprom.sh
@@ -0,0 +1,88 @@
+. /lib/functions.sh
+. /lib/functions/system.sh
+
+eeprom_die() {
+   echo "eeprom: " "$*"
+   exit 1
+}
+
+ath10kcal_die() {
+   echo "ath10cal: " "$*"
+   exit 1
+}
+
+mtd_eeprom_extract() {
+   local part=$1
+   local offset=$2
+   local count=$3
+   local mtd
+
+   mtd=$(find_mtd_chardev $part)
+   [ -n "$mtd" ] || \
+   eeprom_die "no mtd device found for partition $part"
+
+   dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
+   eeprom_die "failed to extract from $mtd"
+}
+
+mtd_eeprom_extract_check() {
+   local part=$1
+   local offset=$2
+   local count=$3
+   local mtd cal_size
+
+   mtd=$(find_mtd_chardev $part)
+   [ -n "$mtd" ] || \
+   eeprom_die "no mtd device found for partition $part"
+
+   # Check that the calibration data size in header equals the desired size
+   cal_size=$(dd if=$mtd bs=2 count=1 skip=$(( $offset / 2 )) conv=swab 
2>/dev/null | hexdump -ve '1/2 "%d"')
+
+   [ "$count" = "$cal_size" ] || \
+   eeprom_die "no calibration data found in $part"
+
+   dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
+   eeprom_die "failed to extract from $mtd"
+}
+
+mtd_eeprom_extract_reverse() {
+   local part=$1
+   local offset=$2
+   local count=$3
+   local mtd
+   local reversed
+   local caldata
+
+   mtd=$(find_mtd_chardev "$part")
+   reversed=$(hexdump -v -s $offset -n $count -e '/1 "%02x "' $mtd)
+
+   for byte in $reversed; do
+   caldata="\x${byte}${caldata}"
+   done
+
+   printf "%b" "$caldata" > /lib/firmware/$FIRMWARE
+}
+
+ubi_eeprom_extract() {
+   local part=$1
+   local offset=$2
+   local count=$3
+   local ubidev=$(nand_find_ubi $CI_UBIPART)
+   local ubi
+
+   ubi=$(nand_find_volume $ubidev $part)
+   [ -n "$ubi" ] || \
+   eeprom_die "no UBI volume found for $part"
+
+   dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
+   eeprom_die "failed to extract from $ubi"
+}
+
+ath10kcal_from_file() {
+   local source=$1
+   local offset=$2
+   local count=$3
+
+   dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
+   ath10kcal_die "failed to extract calibration data from $source"
+}
diff --git 
a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom 
b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 208d5f6bff..6b94b19ee7 100644
--- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -2,60 +2,7 @@
 
 [ -e /lib/firmware/$FIRMWARE ] && exit 0
 
-. /lib/functions.sh
-. /lib/functions/system.sh
-
-ath9k_eeprom_die() {
-   echo "ath9k eeprom: " "$*"
-   exit 1
-}
-
-ath9k_eeprom_extract() {
-   local part=$1
-   local offset=$2
-   local count=$3
-   local mtd
-
-   mtd=$(find_mtd_chardev $part)
-   [ -n "$mtd" ] || \
-   ath9k_eeprom_die "no mtd device found for partition $part"
-
-   dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
-   ath9k_eeprom_die "failed to extract from $mtd"
-}
-
-ath9k_ubi_eeprom_extract() {
-   local part=$1
-   local offset=$2
-   local count=$3
-   local ubidev=$(nand_find_ubi $CI_UBIPART)
-   local ubi
-
-   ubi=$(nand_find_volume $ubidev $part)
-   [ -n "$ubi" ] || \
-   ath9k_eeprom_die "no UBI volume found fo

[OpenWrt-Devel] [PATCH v3 6/6] ramips: Merge ath9k-eeprom extraction to common eeprom.sh

2019-02-27 Thread Adrian Schmutzler
This uses the common eeprom extraction functions in eeprom.sh.
As a by-product, this will bring the speed enhancement through
blockwise reading to the ramips target.

This patch is based on the proposed unification by Petr Štetiar.

Signed-off-by: Adrian Schmutzler 

---

New in v3:
This is cut out from Petr's initial unification proposal, as I
do not own a ramips device to test.
---
 .../etc/hotplug.d/firmware/10-rt2x00-eeprom| 32 +-
 1 file changed, 7 insertions(+), 25 deletions(-)

diff --git 
a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom 
b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
index 13a4687251..60b0e68bff 100644
--- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
+++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -1,24 +1,5 @@
 #!/bin/sh
 
-rt2x00_eeprom_die() {
-   echo "rt2x00 eeprom: " "$*"
-   exit 1
-}
-
-rt2x00_eeprom_extract() {
-   local part=$1
-   local offset=$2
-   local count=$3
-   local mtd
-
-   mtd=$(find_mtd_part $part)
-   [ -n "$mtd" ] || \
-   rt2x00_eeprom_die "no mtd device found for partition $part"
-
-   dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2>/dev/null || \
-   rt2x00_eeprom_die "failed to extract from $mtd"
-}
-
 jboot_eeprom_extract() {
local part=$1
local offset=$2
@@ -26,21 +7,21 @@ jboot_eeprom_extract() {
 
mtd=$(find_mtd_part $part)
[ -n "$mtd" ] || \
-   rt2x00_eeprom_die "no mtd device found for partition $part"
+   eeprom_die "no mtd device found for partition $part"
 
jboot_config_read -i $mtd -o $offset -e /lib/firmware/$FIRMWARE  
2>/dev/null || \
-   rt2x00_eeprom_die "failed to extract from $mtd"
+   eeprom_die "failed to extract from $mtd"
 }
 
 rt2x00_eeprom_set_macaddr() {
local macaddr=$1
 
[ -n "$macaddr" ] || \
-   rt2x00_eeprom_die "invalid wlan mac address"
+   eeprom_die "invalid wlan mac address"
 
macaddr_2bin $macaddr | dd of=/lib/firmware/$FIRMWARE \
conv=notrunc bs=1 seek=4 count=6 2>/dev/null || 
\
-   rt2x00_eeprom_die "failed to write mac address to eeprom file"
+   eeprom_die "failed to write mac address to eeprom file"
 }
 
 FW="/lib/firmware/$FIRMWARE"
@@ -48,6 +29,7 @@ FW="/lib/firmware/$FIRMWARE"
 
 . /lib/functions.sh
 . /lib/functions/system.sh
+. /lib/functions/eeprom.sh
 
 board=$(board_name)
 
@@ -67,11 +49,11 @@ case "$FIRMWARE" in
;;
tiny-ac)
wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR)
-   rt2x00_eeprom_extract "factory" 0 512
+   mtd_eeprom_extract "factory" 0 512
rt2x00_eeprom_set_macaddr $wifi_mac
;;
*)
-   rt2x00_eeprom_die "Please define mtd-eeprom in $board DTS file!"
+   eeprom_die "Please define mtd-eeprom in $board DTS file!"
;;
esac
;;
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH v3 1/6] ath79: Speed up caldata/eeprom handling

2019-02-27 Thread Adrian Schmutzler
Reading and writing to and from flash storage is slowed down
enormously by some functions which use a block size of 1.

This patch reworks the extraction scripts to be much faster and
efficient by reading and writing in possibly one big block.

This is based on the initial commit a69e101 for ipq40xx by
Christian Lamparter .

Speed comparison @ UBNT AC-Mesh (just manually) results
in a time reduction by three orders of magnitude (99.9 %).

> time dd if=/dev/mtd6 of=/lib/firmware/test-slow bs=1 count=4096 skip=4096
4096+0 records in
4096+0 records out
real0m 16.84s
user0m 0.07s
sys 0m 13.54s

> time dd if=/dev/mtd6 of=/lib/firmware/test-fast bs=4096 count=1 skip=4096 
> iflag=skip_bytes
1+0 records in
1+0 records out
real0m 0.02s
user0m 0.00s
sys 0m 0.02s

Signed-off-by: Adrian Schmutzler 

---

Changed in v3:
- Rebased on the patch from Dmitry Tunin
- Changed position of iflag/oflag to be consistent with Dmitry

This depends on the patch "ath79: speed up ath9k-eeprom extraction"
from Dmitry Tunin.
---
 .../linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom   | 2 +-
 .../linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git 
a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom 
b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 84e4d07b35..d8b292f4da 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -81,7 +81,7 @@ ath9k_patch_fw_mac() {
dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 
seek=$chksum_offset count=2
}
 
-   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 
seek=$mac_offset count=6
+   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc 
oflag=seek_bytes bs=6 seek=$mac_offset count=1
 }
 
 ath9k_patch_fw_mac_crc() {
diff --git 
a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index f4741fa3eb..a19c0c2478 100644
--- a/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -28,7 +28,7 @@ ath10kcal_from_file() {
local offset=$2
local count=$3
 
-   dd if=$source of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2>/dev/null || \
+   dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
ath10kcal_die "failed to extract calibration data from $source"
 }
 
@@ -42,7 +42,7 @@ ath10kcal_extract() {
[ -n "$mtd" ] || \
ath10kcal_die "no mtd device found for partition $part"
 
-   dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count 
2>/dev/null || \
+   dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
ath10kcal_die "failed to extract calibration data from $mtd"
 }
 
@@ -51,7 +51,7 @@ ath10kcal_patch_mac() {
 
[ -z "$mac" ] && return
 
-   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 
seek=6 count=6
+   macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc 
oflag=seek_bytes bs=6 seek=6 count=1
 }
 
 ath10kcal_patch_mac_crc() {
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH v3 5/6] ipq40xx: Make use of common eeprom.sh library for caldata

2019-02-27 Thread Adrian Schmutzler
This merges the ath10k-caldata extraction into the common
eeprom.sh.

Signed-off-by: Adrian Schmutzler 

---

New in v3:
Moved over from alternate patchset
---
 package/base-files/files/lib/functions/eeprom.sh   |  5 +-
 .../etc/hotplug.d/firmware/11-ath10k-caldata   | 82 ++
 2 files changed, 26 insertions(+), 61 deletions(-)

diff --git a/package/base-files/files/lib/functions/eeprom.sh 
b/package/base-files/files/lib/functions/eeprom.sh
index 80df3bb359..48c7fd362d 100644
--- a/package/base-files/files/lib/functions/eeprom.sh
+++ b/package/base-files/files/lib/functions/eeprom.sh
@@ -67,9 +67,12 @@ ubi_eeprom_extract() {
local part=$1
local offset=$2
local count=$3
-   local ubidev=$(nand_find_ubi $CI_UBIPART)
+   local ubidev
local ubi
 
+   . /lib/upgrade/nand.sh
+
+   ubidev=$(nand_find_ubi $CI_UBIPART)
ubi=$(nand_find_volume $ubidev $part)
[ -n "$ubi" ] || \
eeprom_die "no UBI volume found for $part"
diff --git 
a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata 
b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
index 718224f1e0..c13b3e9ecd 100644
--- a/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
+++ b/target/linux/ipq40xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+. /lib/functions/eeprom.sh
+
 # xor multiple hex values of the same length
 xor() {
local val
@@ -16,43 +18,6 @@ xor() {
printf "%0${retlen}x" "$ret"
 }
 
-ath10kcal_die() {
-   echo "ath10cal: " "$*"
-   exit 1
-}
-
-ath10kcal_extract() {
-   local part=$1
-   local offset=$2
-   local count=$3
-   local mtd
-
-   mtd=$(find_mtd_chardev $part)
-   [ -n "$mtd" ] || \
-   ath10kcal_die "no mtd device found for partition $part"
-
-   dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
-   ath10kcal_die "failed to extract calibration data from $mtd"
-}
-
-ath10kcal_ubi_extract() {
-   local part=$1
-   local offset=$2
-   local count=$3
-   local ubidev
-   local ubi
-
-   . /lib/upgrade/nand.sh
-
-   ubidev=$(nand_find_ubi $CI_UBIPART)
-   ubi=$(nand_find_volume $ubidev $part)
-   [ -n "$ubi" ] || \
-   ath10kcal_die "no UBI volume found for $part"
-
-   dd if=/dev/$ubi of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count 
skip=$offset count=1 2>/dev/null || \
-   ath10kcal_die "failed to extract from $ubi"
-}
-
 ath10kcal_patch_mac_crc() {
local mac=$1
local mac_offset=6
@@ -88,9 +53,6 @@ ath10kcal_is_caldata_valid() {
 
 [ -e /lib/firmware/$FIRMWARE ] && exit 0
 
-. /lib/functions.sh
-. /lib/functions/system.sh
-
 board=$(board_name)
 
 
@@ -98,8 +60,8 @@ case "$FIRMWARE" in
 "ath10k/cal-pci-:01:00.0.bin")
case "$board" in
meraki,mr33)
-   ath10kcal_ubi_extract "ART" 36864 2116
-   ath10kcal_is_caldata_valid "4408" || ath10kcal_extract "ART" 
36864 2116
+   ubi_eeprom_extract "ART" 36864 2116
+   ath10kcal_is_caldata_valid "4408" || mtd_eeprom_extract "ART" 
36864 2116
ath10kcal_patch_mac_crc $(macaddr_add $(get_mac_binary 
"/sys/bus/i2c/devices/0-0050/eeprom" 102) +1)
;;
esac
@@ -107,12 +69,12 @@ case "$FIRMWARE" in
 "ath10k/pre-cal-pci-:01:00.0.bin")
case "$board" in
asus,map-ac2200)
-   ath10kcal_ubi_extract "Factory" 36864 12064
+   ubi_eeprom_extract "Factory" 36864 12064
ln -sf /lib/firmware/ath10k/pre-cal-pci-\:00\:00.0.bin \
/lib/firmware/ath10k/QCA9888/hw2.0/board.bin
;;
openmesh,a62)
-   ath10kcal_extract "0:ART" 36864 12064
+   mtd_eeprom_extract "0:ART" 36864 12064
;;
esac
;;
@@ -123,37 +85,37 @@ case "$FIRMWARE" in
glinet,gl-b1300 |\
linksys,ea6350v3 |\
qcom,ap-dk01.1-c1)
-   ath10kcal_extract "ART" 4096 12064
+   mtd_eeprom_extract "ART" 4096 12064
;;
asus,map-ac2200)
-   ath10kcal_ubi_extract "Factory" 4096 12064
+   ubi_eeprom_extract "Factory" 4096 12064
;;
asus,rt-ac58u)
CI_UBIPART=UBI_DEV
-   ath10kcal_ubi_extract "Factory" 4096 12064
+   ubi_eeprom_extract "Factory" 4096 12064
;;
avm,fritzbox-4040)
/usr/bin/fritz_cal_extract -i 1 -s 0x400 -e 0x207 -l 12064 -o 
/lib/firmware/$FIRMWARE $(find_mtd_chardev "urlader_config")
;;
meraki,mr33)
-   ath10kcal_ubi_extract "ART" 4096 12064
-   ath10kcal_is_caldata_valid "202f" || ath10kcal_extract "ART" 
4096 12064
+   ubi_eeprom_extr

[OpenWrt-Devel] [PATCH v3 0/6] Speed up and merge caldata/eeprom extraction

2019-02-27 Thread Adrian Schmutzler
This patchset goes on with the attempt to
- speed up caldata/eeprom handling by reading blockwise,
- merge the similar functions in one library.

It depends on the patch "ath79: speed up ath9k-eeprom extraction"
by Dmitry Tunin to be applied beforehand.

It replaces my earlier patchsets
- Speed up caldata/eeprom handling for ar71xx/ath79
- Speed up caldata/eeprom handling with common file

The patches 1 to 4 have been run-tested (all at once) on the following
devices:
TP-Link WDR4300 (ar71xx and ath79)
Ubnt AC Mesh (ath79)
TP-Link CPE210 v2 (ar71xx)

The patches 5 and 6 are optional. Since a have no ipq40xx or ramips
device at hand, I cannot test them. Thus, one can apply patches 1 to 4
and then easily do patches 5 and 6 if/after they are tested. (So they
do not hold up the earlier patches.)
However, it would be nice if someone did test ramips and ipq40xx.

Adrian Schmutzler (6):
  ath79: Speed up caldata/eeprom handling
  ar71xx: Speed up caldata/eeprom handling
  ar71xx: Speed up mtd extraction in ar71xx.sh
  ar71xx/ath79: Merge eeprom/caldata extraction into eeprom.sh
  ipq40xx: Make use of common eeprom.sh library for caldata
  ramips: Merge ath9k-eeprom extraction to common eeprom.sh

 package/base-files/files/lib/functions/eeprom.sh   | 91 
 .../etc/hotplug.d/firmware/10-ath9k-eeprom | 99 +-
 .../etc/hotplug.d/firmware/11-ath10k-caldata   | 80 ++---
 target/linux/ar71xx/base-files/lib/ar71xx.sh   |  4 +-
 .../etc/hotplug.d/firmware/10-ath9k-eeprom | 86 ++-
 .../etc/hotplug.d/firmware/11-ath10k-caldata   | 62 --
 .../etc/hotplug.d/firmware/11-ath10k-caldata   | 82 +-
 .../etc/hotplug.d/firmware/10-rt2x00-eeprom| 32 ++-
 8 files changed, 209 insertions(+), 327 deletions(-)
 create mode 100644 package/base-files/files/lib/functions/eeprom.sh

-- 
2.11.0


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


[OpenWrt-Devel] [PATCH v3 3/6] ar71xx: Speed up mtd extraction in ar71xx.sh

2019-02-27 Thread Adrian Schmutzler
Although the amount of data read here is smaller than for the
caldata, there still might be some speed gain compared to reading
bytewise. And there is no harm...

Signed-off-by: Adrian Schmutzler 

---

Changed in v3:
- Changed position of iflag to be consistent
---
 target/linux/ar71xx/base-files/lib/ar71xx.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/linux/ar71xx/base-files/lib/ar71xx.sh 
b/target/linux/ar71xx/base-files/lib/ar71xx.sh
index 95fa247f4b..f0f6f0398b 100755
--- a/target/linux/ar71xx/base-files/lib/ar71xx.sh
+++ b/target/linux/ar71xx/base-files/lib/ar71xx.sh
@@ -16,7 +16,7 @@ ar71xx_get_mtd_offset_size_format() {
dev=$(find_mtd_part $mtd)
[ -z "$dev" ] && return
 
-   dd if=$dev bs=1 skip=$offset count=$size 2>/dev/null | hexdump -v -e 
"1/1 \"$format\""
+   dd if=$dev iflag=skip_bytes bs=$size skip=$offset count=1 2>/dev/null | 
hexdump -v -e "1/1 \"$format\""
 }
 
 ar71xx_get_mtd_part_magic() {
@@ -390,7 +390,7 @@ tplink_pharos_v2_get_model_string() {
part=$(find_mtd_part 'product-info')
[ -z "$part" ] && return 1
 
-   dd if=$part bs=1 skip=4360 count=64 2>/dev/null | tr -d '\r\0' | head 
-n 1
+   dd if=$part iflag=skip_bytes bs=64 skip=4360 count=1 2>/dev/null | tr 
-d '\r\0' | head -n 1
 }
 
 ar71xx_board_detect() {
-- 
2.11.0


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


[OpenWrt-Devel] [PATCH v4] openssl: backport devcrypto changes from master

2019-02-27 Thread Eneas U de Queiroz 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 ---
The patches to the /dev/crypto engine were commited to openssl master,
and will be in the next major version (3.0).

Changes:
- Optimization in computing a digest in one operation, saving an ioctl
- Runtime configuration options for the choice of algorithms to use
- Command to dump useful information about the algorithms supported by
  the engine and the system.
- Build the devcrypto engine as a dynamic module, like other engines.

The devcrypto engine is built as a separate package by default, but
options were added to allow building the engines into the main library.

Signed-off-by: Eneas U de Queiroz 
---
This should be applied on top of 'openssl: bump to release 1.1.1b'.

Run-tested on Linksys WRT3200ACM, WRT610N (software-only), & ASUS
RT-N56U (software-only).

Changes:
v4: rebased on top of openssl-1.1.1b

v3: remove PKG_BUILD_DEPENDS:=cryptodev-linux, as it has been properly
added to DEPENDS now.

v2: accommodate changes from openssl: fix devcrypto engine md blocksize
increased PKG_RELEASE

diff --git a/package/libs/openssl/Config.in b/package/libs/openssl/Config.in
index 3ad8a66b9e..235f38e787 100644
--- a/package/libs/openssl/Config.in
+++ b/package/libs/openssl/Config.in
@@ -253,18 +253,41 @@ config OPENSSL_ENGINE
Note that you need to enable KERNEL_AIO to be able to build the
afalg engine package.
 
-config OPENSSL_ENGINE_CRYPTO
+config OPENSSL_ENGINE_BUILTIN
+   bool "Build chosen engines into libcrypto"
+   depends on OPENSSL_ENGINE
+   help
+   This builds all chosen engines into libcrypto.so, instead of 
building
+   them as dynamic engines in separate packages.
+   The benefit of building the engines into libcrypto is that they 
won't
+   require any configuration to be used by default.
+
+config OPENSSL_ENGINE_BUILTIN_AFALG
bool
-   select OPENSSL_ENGINE
-   select PACKAGE_kmod-cryptodev
+   prompt "Acceleration support through AF_ALG sockets engine"
+   depends on OPENSSL_ENGINE_BUILTIN && KERNEL_AIO && !LINUX_3_18
select PACKAGE_libopenssl-conf
+   help
+   This enables use of hardware acceleration through the
+   AF_ALG kenrel interface.
+
+config OPENSSL_ENGINE_BUILTIN_DEVCRYPTO
+   bool
prompt "Acceleration support through /dev/crypto"
+   depends on OPENSSL_ENGINE_BUILTIN
+   select PACKAGE_libopenssl-conf
help
This enables use of hardware acceleration through OpenBSD
Cryptodev API (/dev/crypto) interface.
-   You must install kmod-cryptodev (under Kernel modules, 
Cryptographic
-   API modules) for /dev/crypto to show up and use hardware
-   acceleration; otherwise it falls back to software.
+
+config OPENSSL_ENGINE_BUILTIN_PADLOCK
+   bool
+   prompt "VIA Padlock Acceleration support engine"
+   depends on OPENSSL_ENGINE_BUILTIN && TARGET_x86
+   select PACKAGE_libopenssl-conf
+   help
+   This enables use of hardware acceleration through the
+   VIA Padlock module.
 
 config OPENSSL_WITH_ASYNC
bool
diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index ab02f09f0e..a9dd16f3e7 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -11,12 +11,11 @@ PKG_NAME:=openssl
 PKG_BASE:=1.1.1
 PKG_BUGFIX:=b
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_USE_MIPS16:=0
 ENGINES_DIR=engines-1.1
 
 PKG_BUILD_PARALLEL:=0
-PKG_BUILD_DEPENDS:=cryptodev-linux
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:= \
@@ -32,7 +31,10 @@ PKG_LICENSE_FILES:=LICENSE
 PKG_CPE_ID:=cpe:/a:openssl:openssl
 PKG_CONFIG_DEPENDS:= \
CONFIG_OPENSSL_ENGINE \
-   CONFIG_OPENSSL_ENGINE_CRYPTO \
+   CONFIG_OPENSSL_ENGINE_BUILTIN \
+   CONFIG_OPENSSL_ENGINE_BUILTIN_AFALG \
+   CONFIG_OPENSSL_ENGINE_BUILTIN_DEVCRYPTO \
+   CONFIG_OPENSSL_ENGINE_BUILTIN_PADLOCK \
CONFIG_OPENSSL_NO_DEPRECATED \
CONFIG_OPENSSL_OPTIMIZE_SPEED \
CONFIG_OPENSSL_PREFER_CHACHA_OVER_GCM \
@@ -89,7 +91,10 @@ endef
 define Package/libopenssl
 $(call Package/openssl/Default)
   SUBMENU:=SSL
-  DEPENDS:=+OPENSSL_WITH_COMPRESSION:zlib
+  DEPENDS:=+OPENSSL_WITH_COMPRESSION:zlib \
+  +OPENSSL_ENGINE_BUILTIN_AFALG:kmod-crypto-user \
+  +OPENSSL_ENGINE_BUILTIN_DEVCRYPTO:kmod-cryptodev \
+  +OPENSSL_ENGINE_BUILTIN_PADLOCK:kmod-crypto-hw-padlock
   TITLE+= (libraries)
   ABI_VERSION:=1.1
   MENU:=1
@@ -134,7 +139,7 @@ define Package/libopenssl-afalg
   SUBMENU:=SSL
   TITLE:=AFALG hardware acceleration engine
   DEPENDS:=libopens

[OpenWrt-Devel] [PATCH] openssl: bump to release 1.1.1b

2019-02-27 Thread Eneas U de Queiroz 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 ---
This is bugfix release that incorporated all of the devcrypto engine
patches currently in the tree.

The cleaning procedure in Package/Configure was not removing the
dependency files, causing linking errors during a rebuild with
different options.  It was replaced by a simple make clean.

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

This was compiled-tested on mips_24kc with no relevant size increase;
run-tested on Linksys WRT3200ACM/mvebu/arm, Asus
RT-N56U/ramips/mipsel_74kc, & Linksys WRT610N/brcm47xx/mipsel_mips32.

This superseeds 'openssl: fix devcrypto engine md blocksize', merged
upstream before this release.

diff --git a/package/libs/openssl/Makefile b/package/libs/openssl/Makefile
index 732e3eb1cb..ab02f09f0e 100644
--- a/package/libs/openssl/Makefile
+++ b/package/libs/openssl/Makefile
@@ -9,9 +9,9 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openssl
 PKG_BASE:=1.1.1
-PKG_BUGFIX:=a
+PKG_BUGFIX:=b
 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
-PKG_RELEASE:=2
+PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 ENGINES_DIR=engines-1.1
 
@@ -25,7 +25,7 @@ PKG_SOURCE_URL:= \
ftp://ftp.pca.dfn.de/pub/tools/net/openssl/source/ \
http://www.openssl.org/source/ \
http://www.openssl.org/source/old/$(PKG_BASE)/
-PKG_HASH:=fc20130f8b7cbd2fb918b2f14e2f429e109c31ddd0fb38fc5d71d9ffed3f9f41
+PKG_HASH:=5c557b023230413dfb0756f3137a13e6d726838ccd1430888ad15bfb2b43ea4b
 
 PKG_LICENSE:=OpenSSL
 PKG_LICENSE_FILES:=LICENSE
@@ -295,10 +295,6 @@ OPENSSL_TARGET:=linux-$(call qstrip,$(CONFIG_ARCH))-openwrt
 STAMP_CONFIGURED := $(STAMP_CONFIGURED)_$(shell echo $(OPENSSL_OPTIONS) | 
mkhash md5)
 
 define Build/Configure
-   [ -f $(STAMP_CONFIGURED) ] || { \
-   rm -f $(PKG_BUILD_DIR)/*.so.* $(PKG_BUILD_DIR)/*.a; \
-   find $(PKG_BUILD_DIR) -name \*.o | xargs rm -f; \
-   }
(cd $(PKG_BUILD_DIR); \
./Configure $(OPENSSL_TARGET) \
--prefix=/usr \
@@ -306,7 +302,8 @@ define Build/Configure
--openssldir=/etc/ssl \
$(TARGET_CPPFLAGS) \
$(TARGET_LDFLAGS) \
-   $(OPENSSL_OPTIONS) \
+   $(OPENSSL_OPTIONS) && \
+   { [ -f $(STAMP_CONFIGURED) ] || make clean; } \
)
 endef
 
diff --git 
a/package/libs/openssl/patches/200-eng_devcrypto-don-t-leak-methods-tables.patch
 
b/package/libs/openssl/patches/200-eng_devcrypto-don-t-leak-methods-tables.patch
deleted file mode 100644
index 228654f03c..00
--- 
a/package/libs/openssl/patches/200-eng_devcrypto-don-t-leak-methods-tables.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From be5cf61caa425070ec4f3e925d4e9aa484c8315b Mon Sep 17 00:00:00 2001
-From: Eneas U de Queiroz 
-Date: Mon, 5 Nov 2018 17:59:42 -0200
-Subject: [PATCH 1/7] eng_devcrypto: don't leak methods tables
-
-Call functions to prepare methods after confirming that /dev/crytpo was
-sucessfully open and that the destroy function has been set.
-
-Signed-off-by: Eneas U de Queiroz 
-
-Reviewed-by: Matthias St. Pierre 
-Reviewed-by: Richard Levitte 
-(Merged from https://github.com/openssl/openssl/pull/7585)
-
-(cherry picked from commit d9d4dff5c640990d45af115353fc9f88a497a56c)
-
 a/crypto/engine/eng_devcrypto.c
-+++ b/crypto/engine/eng_devcrypto.c
-@@ -619,11 +619,6 @@ void engine_load_devcrypto_int()
- return;
- }
- 
--prepare_cipher_methods();
--#ifdef IMPLEMENT_DIGEST
--prepare_digest_methods();
--#endif
--
- if ((e = ENGINE_new()) == NULL
- || !ENGINE_set_destroy_function(e, devcrypto_unload)) {
- ENGINE_free(e);
-@@ -636,6 +631,11 @@ void engine_load_devcrypto_int()
- return;
- }
- 
-+prepare_cipher_methods();
-+#ifdef IMPLEMENT_DIGEST
-+prepare_digest_methods();
-+#endif
-+
- if (!ENGINE_set_id(e, "devcrypto")
- || !ENGINE_set_name(e, "/dev/crypto engine")
- 
diff --git 
a/package/libs/openssl/patches/210-eng_devcrypto-expand-digest-failure-cases.patch
 
b/package/libs/openssl/patches/210-eng_devcrypto-expand-digest-failure-cases.patch
deleted file mode 100644
index 9e59a16ac2..00
--- 
a/package/libs/openssl/patches/210-eng_devcrypto-expand-digest-failure-cases.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-From add2ab1f289c24a1563c5b895d5cd133fe874f12 Mon Sep 17 00:00:00 2001
-From: Eneas U de Queiroz 
-Date: Wed, 14 Nov 2018 11:22:14 -0200
-Subject: [PATCH 2/7] eng_devcrypto: expand digest failure cases
-
-Return failure when the digest_ctx is null in digest_update and
-digest_final, and when md is null in digest_final.
-
-Signed-off-by: Eneas U de Queiroz 
-
-Reviewed-by: Matthias St. Pierre 
-Reviewed-by: Richard Levitte 
-(Merged from https://github.com/openssl/openssl/pull/7585)
-
-(che

[OpenWrt-Devel] RFT: kernel bump for 4.19 + Flow Offload

2019-02-27 Thread Koen Vandeputte

Hi All,

Another week .. another kernel bump ..


This week, stable 4.19 received a fair amount of changes for netfilter 
and offloading stuff.


The bump required some altering of patches at critical locations to make 
everything apply squeaky clean.



To be absolutely sure, I would like to file a request here for 
additional testing on 4.19:



If you are running 4.19 already, and make use of flow offloading,

feel free to compile my staging tree (master branch) [1] and check if 
all is working normally.


Please leave a tested-by tag and specify the target you tested, so I can 
add it to the patch. :-)



Thanks,

Koen


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


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


Re: [OpenWrt-Devel] [PATCH] odhcpd: add network dependent start trigger

2019-02-27 Thread Hans Dedecker
Hi,
On Mon, Feb 25, 2019 at 8:46 AM Hans Dedecker  wrote:
>
> Hi,
> On Sun, Feb 24, 2019 at 7:06 AM Eric Luehrsen  wrote:
> >
> > Recent (20190207) changes to odhcpd makee it dependent on OpenWrt
> > logical interfaces. Boot time race conditions may make odhcpd binding
>
> Even before the most recent changes odhcpd was dependent on OpenWRT logical
> interfaces nothing has changed in that sense
> > a challenge. Intermittent or inconsistent problems can occur with DHCP
> > requests until odhcpd is restarted. Change start up scripts to use
>
> Can you elaborate a bit more on what issues you're observing and provide 
> odhcpd
> tracing  (loglevel 7) when you observe issues ?
The issue you probably have observed is fixed in
https://git.openwrt.org/?p=project/odhcpd.git;a=commit;h=16c5b6c9bcb71bb67a6ab15bb458bf9ab5a8fe7e

Hans
> > procd interface triggers such as dnsmasq and others have already.
>
> This does not really make sense to me as odhcpd is subscribed to ubus
> network event
> messages triggering config reload logic in case the network state of
> an interface changes
>
> Hans
> >
> > Signed-off-by: Eric Luehrsen 
> > ---
> >   .../network/services/odhcpd/files/odhcpd.init | 20 +--
> >   1 file changed, 18 insertions(+), 2 deletions(-)
> >
> > --- a/package/network/services/odhcpd/files/odhcpd.init
> > +++ b/package/network/services/odhcpd/files/odhcpd.init
> > @@ -1,10 +1,20 @@
> >   #!/bin/sh /etc/rc.common
> >
> > -START=35
> > +START=19
> >   STOP=85
> >   USE_PROCD=1
> >
> > +boot() {
> > +   ODHCPD_BOOT=1
> > +   start "$@"
> > +}
> > +
> >   start_service() {
> > +   if [ -n "$ODHCPD_BOOT" ] ; then
> > +   # odhcpd needs to wait for OpenWrt logical interfaces
> > +   return 0
> > +   fi
> > +
> > procd_open_instance
> > procd_set_param command /usr/sbin/odhcpd
> > procd_set_param respawn
> > @@ -17,6 +27,12 @@ reload_service() {
> >
> >   service_triggers()
> >   {
> > -   procd_add_reload_trigger "dhcp"
> > +   if [ -n "$ODHCPD_BOOT" ] ; then
> > +   # one time trigger at boot to wait for logical interface 
> > setup
> > +   procd_add_raw_trigger "interface.*.up" 3000 
> > /etc/init.d/odhcpd restart
> > +   else
> > +   # reload odhcpd also for network reconfiguration
> > +   procd_add_reload_trigger "dhcp" "network"
> > +   fi
> >   }
> >
> > --
> > 2.20.1
> >
> > ___
> > 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-Devel] [PATCH v2 3/3] ipq40xx: add support for FritzBox 7530

2019-02-27 Thread David Bauer
Hello Christian,

On 26.02.19 23:17, Christian Lamparter wrote:
> Hello David,
> 
> On Tuesday, February 26, 2019 12:15:41 AM CET David Bauer wrote:
>> On 25.02.19 23:10, Christian Lamparter wrote:
>>> On Wednesday, February 20, 2019 6:02:21 PM CET Christian Lamparter wrote:
 On Monday, February 18, 2019 11:58:34 PM CET David Bauer wrote:
> diff --git 
> a/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
>  
> b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
> new file mode 100644
> index 00..b2a33468bb
> --- /dev/null
> +++ 
> b/target/linux/ipq40xx/files-4.14/arch/arm/boot/dts/qcom-ipq4019-fritzbox-7530.dts
> @@ -0,0 +1,305 @@
> +&pcie0 {
> + status = "okay";
> +
> + ranges = <0x8100 0 0x4020 0x4020
> + 0 0x0010   /* downstream I/O */
> + 0x8200 0 0x4800 0x4800
> + 0 0x1000>; /* non-prefetchable memory */

 Let me dig out my MR33 (will have to wait until the Weekend) and see if 
 this
 should be put into the qcom-ipq4019.dtsi as well.
>>>
>>> And it didn't work. While the pcie enumeration worked fine. 
>>> The QCA9887 was no longer attaching. As soon as the driver was
>>> loaded it failed due to:
>>>
>>> [8.888466] ath10k_pci :01:00.0: enabling device (0140 -> 0142)
>>> [8.934145] ath10k_pci :01:00.0: failed to wake up device : -110
>>> [8.935258] ath10k: failed to probe PCI : -110, retry-count: 0
>>> [8.949596] ath10k 4.19 driver, optimized for CT firmware, probing pci 
>>> device: 0x50.
>>> [8.989503] ath10k_pci :01:00.0: failed to wake up device : -110
>>> [8.989899] ath10k: failed to probe PCI : -110, retry-count: 1
>>> [9.005086] ath10k 4.19 driver, optimized for CT firmware, probing pci 
>>> device: 0x50.
>>> [9.046821] ath10k_pci :01:00.0: failed to wake up device : -110
>>> [9.049851] ath10k: failed to probe PCI : -110, retry-count: 2
>>> [9.062448] ath10k 4.19 driver, optimized for CT firmware, probing pci 
>>> device: 0x50.
>>> [9.099055] ath10k_pci :01:00.0: failed to wake up device : -110
>>> [9.099442] ath10k: failed to probe PCI : -110, retry-count: 3
>>> [...]
>>> [9.489869] ath10k: failed to probe PCI : -110, retry-count: 10
>>> [9.503780] ath10k_pci: probe of :01:00.0 failed with error -110
>>> [...]
>>>
>>> But I think we can fix the problem. Because according to the old
>>> qcom-ipq40xx.dtsi I dug up:
>>>
>>> 
>>>
>>> The non-prefetchable memory area window size should be 0x00d0.
>>>
>>> ranges =<0x8100 0 0x4020 0x4020 0 0x0010>, /* 
>>> downstream I/O */
>>> <0x8200 0 0x4030 0x4030 0 
>>> 0x00d0>; /* non-prefetchable memory */
>>>
>>> (yes, I'll be preparing a patch for linux-msm-arm. Can you please let
>>> me know if does indeed finally let you enumerate the device?)
>>
>> It seems to work with your proposed change:
>>
>> [0.042117] OF: PCI: host bridge /soc/pci@4000 ranges:
>> [0.042152] OF: PCI:IO 0x4020..0x402f -> 0x4020
>> [0.042171] OF: PCI:   MEM 0x4030..0x40ff -> 0x4030
>> [0.259505] qcom-pcie 4000.pci: link up
>> [0.259649] qcom-pcie 4000.pci: PCI host bridge to bus :00
>> [0.259671] pci_bus :00: root bus resource [bus 00-ff]
>> [0.259687] pci_bus :00: root bus resource [io  0x-0xf]
>> (bus address [0x4020-0x402f])
>> [0.259700] pci_bus :00: root bus resource [mem
>> 0x4030-0x40ff]
>> [0.259742] pci :00:00.0: [17cb:1001] type 01 class 0x060400
>> [0.259776] pci :00:00.0: reg 0x10: [mem 0x-0x0fff 64bit]
>> [0.259829] pci :00:00.0: PME# supported from D0 D3hot
>> [0.260015] PCI: bus0: Fast back to back transfers disabled
>> [0.260195] pci :01:00.0: [8086:09a9] type 00 class 0x028000
>> [0.260312] pci :01:00.0: reg 0x10: [mem 0x-0x007f]
>> [0.260790] pci :01:00.0: supports D1 D2
>> [0.260797] pci :01:00.0: PME# supported from D0 D1 D3hot D3cold
>> [0.261043] PCI: bus1: Fast back to back transfers disabled
>> [0.261095] pci :00:00.0: BAR 8: assigned [mem 0x4080-0x40ff]
>> [0.261112] pci :00:00.0: BAR 0: assigned [mem
>> 0x4030-0x40300fff 64bit]
>> [0.261136] pci :01:00.0: BAR 0: assigned [mem 0x4080-0x40ff]
>> [0.261164] pci :00:00.0: PCI bridge to [bus 01-ff]
>> [0.261180] pci :00:00.0:   bridge window [mem 0x4080-0x40ff]
>> [0.261891] pcieport :00:00.0: AER enabled with IRQ 93
>>
>> See
>> https://github.com/blocktrron/openwrt/commi

Re: [OpenWrt-Devel] Feedback problem

2019-02-27 Thread Alberto Bursi


On 27/02/19 15:04, Buddy wrote:

Engineer:
          I am installed openwrt firmware 18.06.2 in Linksys WRT1900AC .
          Installed AdBlock,but could not to add more rule resource.
          For blocked more ADs , changed hosts to a big one that over 
150MB,so the changes is spend 60% Memory,hope have a good ways to deal 
with.
          Dnsmasq is instead of dnsmasq-full,need add dnsmasq 
fast-lookup that could search from github.com .

          Hope do it more better, thank you!
         Best wishes!
                                          Buddy

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



Internal memory is small.

Connect empty USB drive and do "extroot" procedure to expand memory for 
OpenWrt.


read this tutorial 
https://openwrt.org/docs/guide-user/additional-software/extroot_configuration



-Alberto

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