Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp35876rwb; Wed, 9 Nov 2022 19:27:50 -0800 (PST) X-Google-Smtp-Source: AMsMyM4VIjEJIj/7lVrWqP/jXghgGpeGjKkCTqz49OsmihNTvdBIA33/bQcGSroiaosXENlrsjgj X-Received: by 2002:a05:6402:51ca:b0:462:273b:6ad6 with SMTP id r10-20020a05640251ca00b00462273b6ad6mr46724561edd.119.1668050870689; Wed, 09 Nov 2022 19:27:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668050870; cv=none; d=google.com; s=arc-20160816; b=PsaYuRtew1S+W5uH4cmluxwXBs/qAt2WqwK5mBJGEGQv4nLe8ozgaVpMDmQgpZHr2Y 7QgWQ09jFV0MUZhmqLYsMcDrBkJQc4oFoMlMkkODoyFgdhMjy62D3Wp/gsUeYTa3xK6S g6J0BLjgVzH1roWK3T4E/gSuh921iOH9QlErV5X0Ord2/xg/wGEM4ehqvRwwU115m7m3 A8eHBgIs4aSeYrRLRvT2efLr2h9z8uIwh1hHNePA4Dxu1wc1M11SEvQh24Txcv4GvmgK jkzpvTg0r4r5RyepcHDeanbq/j5cEnDFvjoyQrBkgumeiBwQn4yG7fkwUnJEgAYpnLkI vlzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=1W56Fn2QZr5RXbHkD3D78mesKdFjs6PJERUy+ROjMZY=; b=wU/6+Zq/1oNsSGRo8UJLiGzZbOEue08edp+qNS3elNqKUzgHpnSG9vSNSYwz5d6eId KM+kxiyF1Bt4gZpt8yk7KyrKPeQ7h2y7NX/UwbSOAxEZArHR5CpgV8ZYW1nSUfVzk6j3 mMArgbe/YpsciqJGSfuXx2esHbx3tcaCheknOWgL2FV7e7EpptPCbh0SzT8PSUb1INxY R90i9ht4kG0yqUq//PqHxRq4gRzXHAwm4pfxLIFby/yib99oPrZ0RUyJhioTLxAZnwxp 4Iw3Llh7lBFV/nAs7Nf/a+L9Ka7BTCJcC9r02L+8ecKkN0E6zugjUujKRNYGKRR5YO03 +AxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lrc9jPwf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg11-20020a170907a40b00b0078db5170767si18301654ejc.18.2022.11.09.19.27.00; Wed, 09 Nov 2022 19:27:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lrc9jPwf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232332AbiKJDTp (ORCPT + 93 others); Wed, 9 Nov 2022 22:19:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230120AbiKJDTo (ORCPT ); Wed, 9 Nov 2022 22:19:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86CA3286E4; Wed, 9 Nov 2022 19:19:43 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 22C2261D2E; Thu, 10 Nov 2022 03:19:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27236C433D6; Thu, 10 Nov 2022 03:19:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668050382; bh=lEvNPQT64JP784ZbtlJ2vRiQt5VXmBZWy37oJLq+9Yk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=lrc9jPwfm5wGLhnQjkl7vdG9A7eP3u7lsFf8egWyJF4miGX0qRqPnopIg0SHsKR37 ic+zwMLPgK6+Q61c7SnN28o7e4lx+TjvwPIuKqrmguV41f+ohZb6RcT5pfeAHsi7vl OSvzBT7PlyaYFxCW6LUTi2h9XIMN2Knd7v7F9nLDGmn33FFA2IG6kq3r4d/eThHxsc FKdkE6U38d3+2N2mlxwAMWe21fXR82N/yLpJ99xeL0kvxFPMh4X+bMMta3ISYXl7Dd u6PWtqcB0RwTDyMic9P1HqLboUWP+uu6DEokI0tznZF3fh1kDTWJhH/amCzRMNLvtm Na04cS58cmSPw== Date: Wed, 9 Nov 2022 19:19:41 -0800 From: Jakub Kicinski To: Roger Quadros Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com, vigneshr@ti.com, srk@ti.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: ethernet: ti: cpsw_ale: optimize cpsw_ale_restore() Message-ID: <20221109191941.6af4f71d@kernel.org> In-Reply-To: <20221108135643.15094-1-rogerq@kernel.org> References: <20221108135643.15094-1-rogerq@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Nov 2022 15:56:43 +0200 Roger Quadros wrote: > If an entry was FREE then we don't have to restore it. Motivation? Does it make the restore faster? > Signed-off-by: Roger Quadros > --- > > Patch depends on > https://lore.kernel.org/netdev/20221104132310.31577-3-rogerq@kernel.org/T/ > > drivers/net/ethernet/ti/cpsw_ale.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/ti/cpsw_ale.c b/drivers/net/ethernet/ti/cpsw_ale.c > index 0c5e783e574c..41bcf34a22f8 100644 > --- a/drivers/net/ethernet/ti/cpsw_ale.c > +++ b/drivers/net/ethernet/ti/cpsw_ale.c > @@ -1452,12 +1452,15 @@ void cpsw_ale_dump(struct cpsw_ale *ale, u32 *data) > } > } > > +/* ALE table should be cleared (ALE_CLEAR) before cpsw_ale_restore() */ Maybe my tree is old but I see we clear only if there is a netdev that needs to be opened but then always call ale_restore(). Is that okay? I'd also s/should/must/ > void cpsw_ale_restore(struct cpsw_ale *ale, u32 *data) > { > - int i; > + int i, type; > > for (i = 0; i < ale->params.ale_entries; i++) { > - cpsw_ale_write(ale, i, data); > + type = cpsw_ale_get_entry_type(data); > + if (type != ALE_TYPE_FREE) > + cpsw_ale_write(ale, i, data); > data += ALE_ENTRY_WORDS; > } > }