Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp695561pxb; Mon, 8 Nov 2021 21:35:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmm1b6xRtdWuYGoV6W19OWF7dF50NAIFUz5yHCfSUWcjmR7yALElMULh5CySPfOvdxSAQe X-Received: by 2002:a6b:f816:: with SMTP id o22mr3354977ioh.106.1636436112711; Mon, 08 Nov 2021 21:35:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636436112; cv=none; d=google.com; s=arc-20160816; b=LjvBFH8iVoV0bCP68GLxuE9qKsT6ZqB2IAxIztZY27NQUUs2C9LnvO8fIyBrVo220m i6N80d67G5+wXQWqNOkpQ77/FgafFHrE2Q5lgXGu0NKXLCd4dNgQN3qfovTTH5cr5he7 Wd4GE36pbI8h34TUgDrCzaHWvmy3twqrcZJNvZoqzp7y/whYDNmFdhsDRTJPb5R8iPD6 PzI2C7Y2N9Dq9Ie8/Ou6bMTGA7r/7VQ2CVao0Pz2x/jTAti5N+TkWH9TGS2huGgF95Eb OtceFrbDKY/ssUXNFvgkLySvOXr8QHFNykQqQreofIT9UTEXKVj/V6zqj3/cZXByuI2n D1qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=IyGf++HsWcdR0ymSOyyo/gWpZRHRvO1oI0zO4vspMsM=; b=bUUSn95rLPx2yZJn+OezdCMqHsJCtXnvrr/h0YqKlES9xm7xRlWYBs4wDBzDsNRL0c 5GEJdmem5bMCKJiIH6FWiKSRJeiA0oEUNCLZfe2YFp8u+1a7sfcz3+nJCk4uBQ5jDNsg duSB7zlPWWAm+IPx78VM+tLZjxSHAJ/nUHfXnxt0nDG7TAgpmF3+8e9fn5Xdo40zeZEW 42koQaZrQSfFRQt0P7QgJebGf89uPBoomfLJvlcOxN4bl0RZXbp7pphWOdU/gdV0T4YG JxDqpQUwE9yAhh7r/N/v6Zvxj4G2zbU6ZmB2SnQPq4cl3nSE1y+eSk5CJJxYAOCxhzvF z3Zw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sartura-hr.20210112.gappssmtp.com header.s=20210112 header.b=vxq3lixp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m2si38502916ilh.104.2021.11.08.21.34.52; Mon, 08 Nov 2021 21:35:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@sartura-hr.20210112.gappssmtp.com header.s=20210112 header.b=vxq3lixp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235823AbhKHV7s (ORCPT + 99 others); Mon, 8 Nov 2021 16:59:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231330AbhKHV7r (ORCPT ); Mon, 8 Nov 2021 16:59:47 -0500 Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CAC0C061570 for ; Mon, 8 Nov 2021 13:57:02 -0800 (PST) Received: by mail-io1-xd31.google.com with SMTP id k22so7001585iol.13 for ; Mon, 08 Nov 2021 13:57:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sartura-hr.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IyGf++HsWcdR0ymSOyyo/gWpZRHRvO1oI0zO4vspMsM=; b=vxq3lixp9fobI0QzIjgaBfyTNzcjBFCqjPFMT9q8ZIzecvofrDZrKxAizDBFdDfv+F g70nVh91i1SsL3SMGp3c67MSsc8JePmGGQswMAlq5y3wdFmGGtP+O5/jb4NOLQ8pubhb mNrTtlAt73JwpyetbertCAmiPUNaxjm08rAqhg95CCKkVv48j1+k6C68Y8a9u6a4Vodd VcR54w/nl7yE1zyi02caL2e7lKQl+N0+fKlvfniLYhtjGjSF5Ha7ZEmFfJGrICGGrKgl dwj+1tOJZ6fU+1ncBBwJzq368AZ0yEPI+pJhgmtyehm2pZ0CpMqCfamZgBLhc50txefc GzTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IyGf++HsWcdR0ymSOyyo/gWpZRHRvO1oI0zO4vspMsM=; b=ojAzkkU9UZHKiDB238wvnwdn/l7vR2suGdBqpLmmekbeK1f/AdGsCXbQJD72OwQznA mroPHGOAk5sgw9nptrapYMrB+r+uIr96mG2giFzKytNaagWTtspHzGL8RyDr1uNzeNmd UAfa3wssJv15DusUzxejCqifIEaWPI5V0hdJiHi+GRqkIWrmlVgKwwhAopjEBgNun+ZE ps4M3xzXibSQ4V8xM3bwSg3/MbpY8ejDhcoJvrpfAFaMU0v7JJwbYDsFbBUQENBdUeDt 9YJHn5cLjFPAXC1M5jkoTC3oiceQhL3rwdtoi1tLoUeIMYF32sP/VD0z7MdUVA9KE8Oq A2GA== X-Gm-Message-State: AOAM5313mSj5TpAGiQoWVDe0w5bq1dvALxk/uXZLEqbGIE1eY9xD6liV KK7VIKjx7yMLYCJiD7SaSNhhnAc6rQKiZvHtjaGrrg== X-Received: by 2002:a02:c901:: with SMTP id t1mr1832807jao.132.1636408621835; Mon, 08 Nov 2021 13:57:01 -0800 (PST) MIME-Version: 1.0 References: <20211104124927.364683-1-robert.marko@sartura.hr> <20211108202058.th7vjq4sjca3encz@skbuf> <20211108211811.qukts37eufgfj4sc@skbuf> <20211108214613.5fdhm4zg43xn5edm@skbuf> In-Reply-To: <20211108214613.5fdhm4zg43xn5edm@skbuf> From: Robert Marko Date: Mon, 8 Nov 2021 22:56:51 +0100 Message-ID: Subject: Re: [net-next] net: dsa: qca8k: only change the MIB_EN bit in MODULE_EN register To: Vladimir Oltean Cc: Andrew Lunn , vivien.didelot@gmail.com, Florian Fainelli , David Miller , kuba@kernel.org, netdev@vger.kernel.org, Linux Kernel Mailing List , Gabor Juhos , John Crispin Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 8, 2021 at 10:46 PM Vladimir Oltean wrote: > > On Mon, Nov 08, 2021 at 10:39:27PM +0100, Robert Marko wrote: > > On Mon, Nov 8, 2021 at 10:18 PM Vladimir Oltean wrote: > > > > > > On Mon, Nov 08, 2021 at 10:10:19PM +0100, Robert Marko wrote: > > > > On Mon, Nov 8, 2021 at 9:21 PM Vladimir Oltean wrote: > > > > > > > > > > Timed out waiting for ACK/NACK from John. > > > > > > > > > > On Thu, Nov 04, 2021 at 01:49:27PM +0100, Robert Marko wrote: > > > > > > From: Gabor Juhos > > > > > > > > > > > > The MIB module needs to be enabled in the MODULE_EN register in > > > > > > order to make it to counting. This is done in the qca8k_mib_init() > > > > > > function. However instead of only changing the MIB module enable > > > > > > bit, the function writes the whole register. As a side effect other > > > > > > internal modules gets disabled. > > > > > > > > > > Please be more specific. > > > > > The MODULE_EN register contains these other bits: > > > > > BIT(0): MIB_EN > > > > > BIT(1): ACL_EN (ACL module enable) > > > > > BIT(2): L3_EN (Layer 3 offload enable) > > > > > BIT(10): SPECIAL_DIP_EN (Enable special DIP (224.0.0.x or ff02::1) broadcast > > > > > 0 = Use multicast DP > > > > > 1 = Use broadcast DP) > > > > > > > > > > > > > > > > > Fix up the code to only change the MIB module specific bit. > > > > > > > > > > Clearing which one of the above bits bothers you? The driver for the > > > > > qca8k switch supports neither layer 3 offloading nor ACLs, and I don't > > > > > really know what this special DIP packet/header is). > > > > > > > > > > Generally the assumption for OF-based drivers is that one should not > > > > > rely on any configuration done by prior boot stages, so please explain > > > > > what should have worked but doesn't. > > > > > > > > Hi, > > > > I think that the commit message wasn't clear enough and that's my fault for not > > > > fixing it up before sending. > > > > > > Yes, it is not. If things turn out to need changing, you should resend > > > with an updated commit message. > > > > > > > MODULE_EN register has 3 more bits that aren't documented in the QCA8337 > > > > datasheet but only in the IPQ4019 one but they are there. > > > > Those are: > > > > BIT(31) S17C_INT (This one is IPQ4019 specific) > > > > BIT(9) LOOKUP_ERR_RST_EN > > > > BIT(10) QM_ERR_RST_EN > > > > > > Are you sure that BIT(10) is QM_ERR_RST_EN on IPQ4019? Because in the > > > QCA8334 document I'm looking at, it is SPECIAL_DIP_EN. > > > > Sorry, QM_ERR_RST_EN is BIT(8) and it as well as LOOKUP_ERR_RST_EN should > > be exactly the same on QCA833x switches as well as IPQ4019 uses a > > variant of QCA8337N. > > > > > > > Lookup and QM bits as well as the DIP default to 1 while the INT bit is 0. > > > > > > > > Clearing the QM and Lookup bits is what is bothering me, why should we clear HW > > > > default bits without mentioning that they are being cleared and for what reason? > > > > > > To be fair, BIT(9) is marked as RESERVED and documented as being set to 1, > > > so writing a zero is probably not very smart. > > > > > > > We aren't depending on the bootloader or whatever configuring the switch, we are > > > > even invoking the HW reset before doing anything to make sure that the > > > > whole networking > > > > subsystem in IPQ4019 is back to HW defaults to get rid of various > > > > bootloader hackery. > > > > > > > > Gabor found this while working on IPQ4019 support and to him and to me it looks > > > > like a bug. > > > > > > A bug with what impact? I don't have a description of those bits that > > > get unset. What do they do, what doesn't work? > > > > LOOKUP_ERR_RST_EN: > > 1b1:Enableautomatic software reset by hardware due to > > lookup error. > > > > QM_ERR_RST_EN: > > 1b1:enableautomatic software reset by hardware due to qm > > error. > > > > So clearing these 2 disables the built-in error recovery essentially. > > > > To me clearing the bits even if they are not breaking something now > > should at least have a comment in the code that indicates that it's intentional > > for some reason. > > I wish John would explain the logic behind this. > > That sounds... aggressive. Have you or Gabor exercised this error path? > What is supposed to happen? Is software prepared for the hardware to > automatically reset? I am not trying to be aggressive, but to me, this is either a bug or they are intentionally cleaned but it's not documented. Have tried triggering the QM error, but couldn't hit it even when doing crazy stuff. It should be nearly impossible to hit it, but it's there to prevent the switch from just locking up under extreme conditions (At least that is how I understand it). I don't think the driver currently even monitors the QM registers at all. I can understand clearing these bits intentionally, but it's gotta be documented otherwise somebody else is gonna think is a bug/mistake/whatever in the code. Regards, Robert -- Robert Marko Staff Embedded Linux Engineer Sartura Ltd. Lendavska ulica 16a 10000 Zagreb, Croatia Email: robert.marko@sartura.hr Web: www.sartura.hr