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

Rosen Penev rosenp at gmail.com
Mon Feb 25 14:17:04 EST 2019


On Fri, Feb 22, 2019 at 10:39 AM Adrian Schmutzler
<freifunk at adrianschmutzler.de> wrote:
>
> Reading and writing to and from flash storage is slow and currently,
> especially since some scripts use a block size of 1 to be able skip.
>
> 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 <chunkeey at gmail.com>.
>
> Speed comparison @ UBNT AC-Mesh (just manually) results in a time
> reduction of 99.9 %.
>
> 4096+0 records in
> 4096+0 records out
> real    0m 16.84s
> user    0m 0.07s
> sys     0m 13.54s
>
> 1+0 records in
> 1+0 records out
> real    0m 0.02s
> user    0m 0.00s
> sys     0m 0.02s
>
> Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
Tested-by: Rosen Penev <rosenp at gmail.com>
> ---
>  .../linux/ath79/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom   | 4 ++--
>  .../linux/ath79/base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 6 +++---
>  2 files changed, 5 insertions(+), 5 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 8b217d12c0..4bb2c28bac 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
> @@ -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 bs=$count skip=$offset count=1 iflag=skip_bytes 2>/dev/null || \
>                 ath9k_eeprom_die "failed to extract from $mtd"
>  }
>
> @@ -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 bs=6 seek=$mac_offset count=1 oflag=seek_bytes
>  }
>
>  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..e0d28dfabe 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 bs=$count skip=$offset count=1 iflag=skip_bytes 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 bs=$count skip=$offset count=1 iflag=skip_bytes 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 bs=6 seek=6 count=1 oflag=seek_bytes
>  }
>
>  ath10kcal_patch_mac_crc() {
> --
> 2.11.0
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list