From patchwork Wed Nov 16 16:49:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 21179 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp247578wru; Wed, 16 Nov 2022 08:58:18 -0800 (PST) X-Google-Smtp-Source: AA0mqf7mvDyjFC6677e2E25Agnfja/Y8/474t+be6PE24+Kmpd1K1dQ5SYM9VCUAi/DfhYu//a3M X-Received: by 2002:a17:903:32c7:b0:187:403c:7a15 with SMTP id i7-20020a17090332c700b00187403c7a15mr10014783plr.28.1668617898687; Wed, 16 Nov 2022 08:58:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668617898; cv=none; d=google.com; s=arc-20160816; b=NelVRjvyBreN1k4mve3dy8vMAw9LnuCdTxlPjaSSp3yGaWkYWYNB3JEQcbcmyp7n4W gA1ohC329AQbw7CI3sU6kYpWfuA3pk26osf7B9JA3yCvAXV9orw8CtKg4Bc3yJS6ezgU pS+fr+Vcrzzr0iJdiA70L0jKJKpHDCfUwZb60HKNfI8jW3uaP/ytK+NFwJmwJdzhVvTq x05wGLQMYUAVaDtl5COEtldyhcjWqZDVOgtSY9l+XXwTHZGuOBGdxfrcjOnBaNIwKq8k TWoi+jgbQ6Ro7wgUoFQ1ZQSO8o9sDvbsMH66MWfG9oCfMnhwj3O3rWlBrwBLeulMLVkI U0uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=NgJNf0hJAGvV104ZzCyAi2fWI9UoRFdPBJS6aRl1IS4=; b=eNY0547Xo18CptLF7nWMV2ifku64JKEy9HsK5FFP5I9HfWkfCJnXgyFZDYpzndFy60 DJzEvoIv6lvKsoEf5gQgcGVbDBVf8hZ5nWzMaOkp3f5WOS4R37OtaKdRVGBxU14bdPvn VncFlZ7mpA5i7nC7l5yHXnbfLz4hUf519htJKJFXv5CnzyAZaKX9ZCKGDttNkjldmlBT J77KkjJIEJYXPDBaYrqrgtw/oW84xRdOzYJ73jAokVsphj0BSLzyPK74Aizdb5s0AbsX eDjllZY7iZk1zzpGDgGJdrjTLpGFhUqZa4KNNRvMfN3j2fXWUquIKCmSMMmig9A8adw9 8fhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ANYxNHBC; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n4-20020a17090a9f0400b00213d28acc5esi2154261pjp.73.2022.11.16.08.58.06; Wed, 16 Nov 2022 08:58:18 -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=ANYxNHBC; 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 S239022AbiKPQvS (ORCPT + 99 others); Wed, 16 Nov 2022 11:51:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239097AbiKPQus (ORCPT ); Wed, 16 Nov 2022 11:50:48 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 504821112; Wed, 16 Nov 2022 08:49:33 -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 E13D861EEE; Wed, 16 Nov 2022 16:49:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27E8AC43470; Wed, 16 Nov 2022 16:49:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668617372; bh=qvQKpvLNHVXrB7+8IiQETTMMyyG0jxiPHRO3yv3NGeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ANYxNHBCK+3ptBc0Q7XznL1jDwyzPsSoTxs+evIacNUxebzuC/LZTteEaU9DEWbit GIYnMdJCpq6n6QPwuplWul7GiAKSkSQAGskQLG7mPqUfzMAOo9xRZl7Nr1oVE7g7SZ aWCGtwi36aK+2QfOmvWflT4ft81C0z732rEqRCbta9gUrFRIUU4Lvcl5xSRGiWOviS iMkUOSgrwwuC2ktvIsRTq1G0CIRNm7P4B2BQTb2hqNelq8bxqhxs6zWwkPpo7eD2FQ 7qyWD+oBngSS2a/93aQLLg5oca8BiEyhOEEbqzevf86/mteZgbyB1ogBT+7W6rCYlK 2NoCFlOBOzgYA== From: Roger Quadros To: davem@davemloft.net, kuba@kernel.org Cc: edumazet@google.com, pabeni@redhat.com, vigneshr@ti.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Roger Quadros Subject: [PATCH 4/4] net: ethernet: ti: cpsw_ale: optimize cpsw_ale_restore() Date: Wed, 16 Nov 2022 18:49:15 +0200 Message-Id: <20221116164915.13236-5-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221116164915.13236-1-rogerq@kernel.org> References: <20221116164915.13236-1-rogerq@kernel.org> 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749672681793112083?= X-GMAIL-MSGID: =?utf-8?q?1749672681793112083?= If an entry was FREE then we don't have to restore it. This will make the restore faster in most cases. Signed-off-by: Roger Quadros --- 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() */ 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; } }