From patchwork Mon Nov 21 14:23:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 23787 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp1621051wrr; Mon, 21 Nov 2022 06:29:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf6+bF5m9fix71zij7EvdfiKC+9pcHfi/TUNcBsDB31oDBufyTaHhufPSTEJHY5RF8cvm3Pw X-Received: by 2002:a17:906:ccd0:b0:7ad:db82:d073 with SMTP id ot16-20020a170906ccd000b007addb82d073mr4099777ejb.480.1669040942739; Mon, 21 Nov 2022 06:29:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669040942; cv=none; d=google.com; s=arc-20160816; b=xxfubZg7gAzGDVk2ho0FBfxH3PpX9zkzCEtB1UJojLfWEPrJkxGpsT4I0zsR3EiFU7 biYCXyiTdsCNR2UUhFUHH3Y6r0Izs6Bh3fvu5lQhDYL3t6XZI1GiTR1twVoRFNv7T7Yw 1Me915NlqBmZlriDMyp0Avp9PLN9fQS2R6i40o2opofF5Z80azXIvY8htxVDNqIVBGyt i2Gf+4NtF7XbqtF3MLF/nly/vOMI6k66U7CUEZp99Bnl+4m813Y9kCqtqVXYjaFm68Wg VLReUa/6P+75rbgeu+9ZxDmtzcgS/FhXJFlgq44x9ZuaGU1dcVe++O79GYxk8lw+hpCT ur3A== 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=sYKnsEqCONjhQOODDo5Kk0+z7WiIryKnIGB+cuJWnR50awXY3vz1sN3R98LEPXNnkK nJpG6MpRxKbiCyQxaJR6k4z91aWZW6TaWBQURsAphPWNVMpiI0YGnP8BB5Q9ylwhMaCu Y650ar8HHvYl1zaH+EPYDdb7QaU4uLTOZb0C6OPugxTvwCumnTVMyxNz4cEDquqXl6OU WERmlnT0qQ6SfQ+4dPHn2vRV/H20AudJXhnooVwn0pMTsyB5EOigUqcQfUKgPGbxvmpK aNX8q/UW7ImlfdBR4kocYLmdC63DXeG48zHS/3CBknofqS02a+O2E3F7QzblQ4AtfPqP Dhjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=a7UWROhc; 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 o7-20020a056402038700b004674c93ecb8si8971037edv.326.2022.11.21.06.28.36; Mon, 21 Nov 2022 06:29:02 -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=a7UWROhc; 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 S229898AbiKUOXx (ORCPT + 99 others); Mon, 21 Nov 2022 09:23:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230474AbiKUOXV (ORCPT ); Mon, 21 Nov 2022 09:23:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A56167D0; Mon, 21 Nov 2022 06:23:20 -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 ams.source.kernel.org (Postfix) with ESMTPS id CE8ADB80E12; Mon, 21 Nov 2022 14:23:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5750EC433C1; Mon, 21 Nov 2022 14:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669040597; bh=qvQKpvLNHVXrB7+8IiQETTMMyyG0jxiPHRO3yv3NGeI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a7UWROhceHP9xabPLhTBuDbSy8sUG/ibOmVRvZKFMCwQr4EIKflcbP7Wsrg8ghDz3 NhVQMcJk4AVUn0RoJ/iKw8tTwBCgftudlKFYsplifDRYlJi8SBREwcRqQsIugHYs0k biZo9MsYe2rT2FhHTtfElOFpW/YjoJRiXLXuqRkW1Un8HVxiDCStZhDDZkY/vHihUG sDlwQSgA5OsULWVE8oGxO/dgPufQ0YEVQDxXsX4ghuEfeFBRLlMuWbN/rHq4PSyd7t m4JnS4l4xYS1iUM6sO3ggOSW40Lcky0pKpEfdh9LCS2hj2dsIt+E7VFIlG8MMQVEnH ehSJrEOHXGedA== 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 v2 4/4] net: ethernet: ti: cpsw_ale: optimize cpsw_ale_restore() Date: Mon, 21 Nov 2022 16:23:00 +0200 Message-Id: <20221121142300.9320-5-rogerq@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221121142300.9320-1-rogerq@kernel.org> References: <20221121142300.9320-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?1750116275636740482?= X-GMAIL-MSGID: =?utf-8?q?1750116275636740482?= 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; } }