From patchwork Fri Feb 22 18:39:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Schmutzler X-Patchwork-Id: 1047056 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adrianschmutzler.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="CUjCUQQE"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 445gB52D3Hz9sC1 for ; Sat, 23 Feb 2019 05:39:57 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=dcFhSxsQRoLsBD6teRUZJXwoYPTKrlfCDQjaaaaoHt8=; b=CUjCUQQE78p3/X9ioLYmivKCNI frHUwGUs720oWzBMSrjdLapZ5hA0us+grsOq4VeztQrJuwf3u+qwyyaTFwUiLtM2v6VdYukCtfSSd wUIGPXkj98l3fVq4vvIy40UCPzJibveUtLYN5H4Rfyu1BpMA4nJ2srbrE5ck169j6q2NUnLfC7FaI HSYtW8hkKh4mzAoGMQmvg9V0NXkJ5OgwY20nz5HRFKxkNXx/8YoUZH2/03pTkg6WbMV/xu7Aahq8h biSrsUcAbmRtrMQysV9HIrpxuTfqatwfd+tShFPR49MpZTHat2PZUWP4hiLJh2r0z+f4FVc+XezpO 3HzmTEWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxFji-0006mv-VS; Fri, 22 Feb 2019 18:39:50 +0000 Received: from mout.kundenserver.de ([212.227.17.13]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gxFjP-0006Oc-Pu for openwrt-devel@lists.openwrt.org; Fri, 22 Feb 2019 18:39:34 +0000 Received: from localhost.localdomain ([188.194.105.77]) by mrelayeu.kundenserver.de (mreue109 [212.227.15.183]) with ESMTPSA (Nemesis) id 1M89P3-1gthDo1ed9-005JVT for ; Fri, 22 Feb 2019 19:39:27 +0100 From: Adrian Schmutzler To: openwrt-devel@lists.openwrt.org Date: Fri, 22 Feb 2019 19:39:21 +0100 Message-Id: <20190222183923.393-2-freifunk@adrianschmutzler.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190222183923.393-1-freifunk@adrianschmutzler.de> References: <20190222183923.393-1-freifunk@adrianschmutzler.de> X-Provags-ID: V03:K1:AGi5iaKQEN1RcHIv7DQ8cz2BWK/GGbUuGq/IqxNqNL16dQDIFm0 Mj09ySjR+QVjTCjoNr60DCR6MK3aXGCkil8Owk+RH99Q+PWNg9AgXvqOhRm5jIAMn6tl+WL ziNEllU0IIqph2OPVjmqoHlFezJgOLWJ3+vPpdx4IKW1l5HxBLSOIAM9T22aGdGJKj3HCq9 2lAS3juGgIeewDtBh+E2Q== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:3QkviLjQ0sM=:LWoq4juoN6GX2RpAMPM19S W2gfDbWqJCKHktGU5y8m1fSenNQHWVsXEd5j8mNr6nvfk+gHREnRhe2Kx6NnZzT7oI/+Q5ekb tJoJ0ovsyw7aQSLcw2NBfh62zx/f9NBfD/bDq8bQpzYt7+v8yh2XQQtvtmbgUckVGM63y2rwK XzHxfRFOlfzAcNQP84ZRsBEmjS3ShHmKk+93HUSYDWyHO5ECLeJANdTJII40GYhPVdG/Zawk9 rUMEpqMMfU5+8AQxIWZv+6bKGYotLa/me/BoauRDS4KEbpuTkbMuvJjLf3e1uzsxatyQt4Img LgZ/f1wnUCNkB4Wu8UsvxSj/TKTuu3Pwf8PNWbubd0vfZFu3opGzhLUde0TLiHy8/SKuh5n59 H8BSEEtZ5UO+CWvC9mMFijNurdZDkQuw48kz30KYQz81yU/8S4jwEi1aBbEAPz59tC4C6d1wp u4q7gTFiHqA4J0lmo4MIyfkDDL/7UoR/sHVA4dXT2k8XCtNtkEW6pQI/pfBp8CGs35EkjsRRA du6Ysr8K6lzwUyI/X4yid25FKvlq9MOq7BIFU07UKNFqd9BcVPz2JQWzWci0Y8YuHxY/WTOAD TzfTEX786U9KwyqyYZ9KwSvvUxZmG9DGpzrRdzjDKL1bHW8X+1qNnajnNwY662IvvlEz1RuQN 8fwbJhYK/Z9Q5J2sLUZYPsRKejsdfAQgmBTEbFYiZpTRD2pQv5YzGjp5z7LrP1nGQkuHUoyPJ 4eJ0sxKsYiVANFPm+OEZxY9Am0lMvhqIt4GTGOHJ7XaR8YELZW5VCKLdNDU= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190222_103932_138702_00BDBA11 X-CRM114-Status: GOOD ( 13.17 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [212.227.17.13 listed in list.dnswl.org] Subject: [OpenWrt-Devel] [PATCH 1/3] ath79: Speed up caldata/eeprom handling X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 . 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 Tested-by: Rosen Penev --- .../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() {