From patchwork Wed Feb 27 22:18:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Schmutzler X-Patchwork-Id: 1049166 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="on9aPkP9"; 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 448qpV3bDLz9sBF for ; Thu, 28 Feb 2019 09:18:58 +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=rzGQJCqbWGmPxpr5UmbQfss2WBoKdfeVi7EmCOxfMG0=; b=on9aPkP9TrrGTwLpLD5O6D8pO2 stDgYvr0TC4uP/SSrteJ14A82hlMvoJRBwu/x1nsR2d0rtJ17+kLD3SYyzEz0qPK9uQixjlRvcfmH 4nR1ZWTmEo0BzEhjOP1b4ALr9vlTrQcsdzvM8JMOPLvAatfJOfTpUPhgJxbbzaROeCm8ANCc+rIA5 d4g37VW+9DYs0KXLyh7sZgXtFMaePJNYnHJDKlMtiCVwxdjkRAMXAxOulOFd+sbfhJr7nCGMYQ3cY 8O1EdONcrWnANQpNR6LYMgj5BabqIqlxvr82mBFVdGvCY+W5kvaLFviP7VwzuhXSpkngAguD+q8DT dOc9+/FQ==; 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 1gz7XL-0004UH-UD; Wed, 27 Feb 2019 22:18:47 +0000 Received: from mout.kundenserver.de ([212.227.17.24]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gz7Wr-0003nz-8R for openwrt-devel@lists.openwrt.org; Wed, 27 Feb 2019 22:18:20 +0000 Received: from localhost.localdomain ([188.194.105.77]) by mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) id 1MqJZl-1hKUB40VHP-00nO35 for ; Wed, 27 Feb 2019 23:18:13 +0100 From: Adrian Schmutzler To: openwrt-devel@lists.openwrt.org Date: Wed, 27 Feb 2019 23:18:04 +0100 Message-Id: <20190227221809.1697-2-freifunk@adrianschmutzler.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190227221809.1697-1-freifunk@adrianschmutzler.de> References: <20190227221809.1697-1-freifunk@adrianschmutzler.de> X-Provags-ID: V03:K1:PprnZAKGWCcO61CbL4//6C4XFtmI1fRTBSCLcj02kY2MTY3vIUX 5YXpCh35ELEKLsbd6d/7ijqAoQI2MsPL4eRB6cM34WHU1nN+r6Tb1BkRYk2aglzJr6467b1 xhlBTFHvNh3XB9RjpIfbkmyrNQ1QvWhV9C9ffOWMFpWAicN4uuuP6nUScdMf9IOLI1T7mLh ec0vmBpoebF1+Hv5bgwIw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:ItxkBjQhX6s=:a56GpmuHWcH6urOfU4kfl6 gxi9v/X0k26XZfyCPOE4HzoxJmTx1Axjn4jJvYpRd7GJmE3k955YHQqJVaCbk6ZVpqMe8pPrw zwSsU4JG0nLZzkJrDl3YXW3JnbKMWDdgW8aTRjgilFQhmJ1wVmFPv/lk5nHV93FS/wj0S6d3v JGxSuFT5MgeCSAzzakGBMlDhC18UIRk1Q09YK+6iM+27fB4C2XSlEZhKnepEmbf91DBsNloBL EfYUuktMWaJkOfrWW7FtCRTgYaiXLKYCeSO+ImDBRNtsYVrIskQ24OkjSpFRi4Zw9Eb3LqwQk dHEA3PA6mH9uYIPLgYaNbeQGpP1zvssueFnCdJpMFrCjKqgvMGn2/BGnh7gJ4kdudrIH3iDbE /o445eXXcg508Pw4uRaDQi69rKaMtG7vdOJPaZWcppFTmAzeK0rAK7gxHkWeeJSVszO1HqEsS nHYg7VNtX+F0QESbt1nii60ZYNGoFt0rGAI53yP0b6XNmPA5EznRuOUsBF/N/M6RhDb442bu5 C8+oaDtyBLBbk8A5+4BeXDyB31r9JKg97MkQqTL8RtRRrf74FlMDMsXjyclM3eMCq3V/ElWkK iVA36RuDg+RzOcIrUgQfV58LbgKH6dPNJUZ7B31U7FnXSTgx4u7zjRLYlBCFHkJfz1K4VFtMO v0AAkWb5u1bxWS4nkPiHFyVOhmn4xH/zUOLpoMVx+Gg888ItspUDFLZ9PTeF14fHqbb9Fcqfn D8IVARtqE/ylZAg85BHacDe3ool2SgReBDq9APInTdTOrqfR1IwaPm5BteM= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190227_141817_595337_46A84A36 X-CRM114-Status: GOOD ( 15.12 ) 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.24 listed in list.dnswl.org] Subject: [OpenWrt-Devel] [PATCH v3 1/6] 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 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 real 0m 16.84s user 0m 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 real 0m 0.02s user 0m 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() {