From patchwork Wed May 6 11:16:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Gottschall X-Patchwork-Id: 6348891 Return-Path: X-Original-To: patchwork-ath10k@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E47829F32B for ; Wed, 6 May 2015 11:17:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EAD09202EC for ; Wed, 6 May 2015 11:17:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0376C202DD for ; Wed, 6 May 2015 11:17:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YpxK1-0002HL-Vb; Wed, 06 May 2015 11:17:01 +0000 Received: from nm.newmedia-net.de ([217.113.179.122] helo=webmail.newmedia-net.de) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YpxJy-0002Bm-Ay for ath10k@lists.infradead.org; Wed, 06 May 2015 11:16:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dd-wrt.com; s=mikd; h=Subject:Content-Transfer-Encoding:Content-Type:In-Reply-To:References:CC:To:MIME-Version:From:Date:Message-ID; bh=XT2eLxatwIrK+/zOcrjM+lMMKSt29uV2i1boHHxE7j4=; b=ZUBtdHpvPLVvDBpigVfiqe3Reth5ONB1AYZIXlixvq+eHT6H0Bt68pi6UGi839U8SZqTFW0YqmTkPY2eLmxlvsiFx0uollx0A7osIR8qFlrIW982YCkVaSnNQaZVmDdVU6u9EwaXTQ3cJygcuR6f3xD9GoZ64fyX5z//kD89Bbw=; Message-ID: <5549F827.1010809@dd-wrt.com> Date: Wed, 06 May 2015 13:16:55 +0200 From: Sebastian Gottschall User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Michal Kazior References: <55494598.2060603@candelatech.com> <5549EF46.10104@dd-wrt.com> In-Reply-To: X-SA-Exim-Connect-IP: 87.155.241.99 X-SA-Exim-Mail-From: s.gottschall@dd-wrt.com X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Subject: Re: changing hw address of ath10k card X-SA-Exim-Version: 4.2.1 (built Thu, 26 May 2011 15:22:33 +0200) X-SA-Exim-Scanned: Yes (on webmail.newmedia-net.de) X-NMN-MailScanner-Information: Please contact the ISP for more information X-NMN-MailScanner-ID: 1YpxJZ-0002nK-S7 X-NMN-MailScanner: Found to be clean X-NMN-MailScanner-From: s.gottschall@dd-wrt.com X-Received: from [87.155.241.99] (helo=[10.88.193.128]) by webmail.newmedia-net.de with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.72) (envelope-from ) id 1YpxJZ-0002nK-S7; Wed, 06 May 2015 13:16:34 +0200 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150506_041658_752860_541D1FA5 X-CRM114-Status: GOOD ( 21.00 ) X-Spam-Score: -2.4 (--) Cc: "ath10k@lists.infradead.org" X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Am 06.05.2015 um 13:06 schrieb Michal Kazior: > On 6 May 2015 at 12:39, Sebastian Gottschall wrote: >> Hello > Hi, > > >> I recently stumbled across a problem in ath10k. while developing on embedded >> wireless routers >> i found a device which uses a ar988x card using a card embedded board >> eeprom. the problem is there is no way to override >> the cards hardware/mac address, which is required on that device since it >> uses just a fake mac on that board data. > If device contains valid EEPROM data then both calibration and mac > address is read using OTP. In that case a mere fake board template > binary is used by the driver (the default board.bin). the problem is that the board.bin is never used. i modified the board.bin to change the mac address, but it shows no effect > > If device contains no valid EEPROM, which is the case for many routers > out in the wild e.g. TP-Link Archer C5/C7, you must provide a complete > board data. On routers this data is often stored on NAND/Flash > partitions. OpenWRT does handle this and extracts calibration data > file. If you fail to provide that and attempt to use the default > board.bin you'll get hardcoded mac and Tx/Rx performance will be very > poor most likely. i'm aware of that. i handle that correct for such devices. but the dlink DIR862 and DIR866 using full equiped ar988x cards with valid eeprom > > If ath10k assigns 00:03:07:12:34:56 mac address to the interface then > you've most likely provided a fake board template and the device > doesn't have a valid EEPROM data. Are you using skip_otp module > parameter by any chance or other hacks/custom patches on ath10k? i just use the openwrt patch which allows to override invalid otp data using the board.bin. this works for device likes the archer c7. but board.bin is not used for valid otp data. this is this one here > > >> is there any way/trick available to deal with that problem? > You can always change the mac address via `ip` or `ifconfig` commands > after interface is created but that's probably not what you really > want. if i can trust that bssid (which i dont believe) etc. internal handling will change as well, this might work as workaround. but its a nasty way to handle it Sebastian > > > Micha? > --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -387,9 +387,14 @@ static int ath10k_download_and_run_otp(s ath10k_dbg(ar, ATH10K_DBG_BOOT, "boot otp execute result %d\n", result); - if (!skip_otp && result != 0) { - ath10k_err(ar, "otp calibration failed: %d", result); - return -EINVAL; + if (!skip_otp) { + if (result == 2) { + ath10k_warn(ar, "otp stream is empty, using board.bin contents"); + return 0; + } else if (result != 0) { + ath10k_err(ar, "otp calibration failed: %d", result); + return -EINVAL; + }