Message ID | 20231029110442.347448-5-mirsad.todorovac@alu.unizg.hr |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp1631560vqb; Sun, 29 Oct 2023 04:14:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF2e5/SaokvL3MXhB15IJAezj6w6z6EZnkATH1SjR9NBRqIAg6JazmGrY+a+ukEkfWOnWB4 X-Received: by 2002:a05:6a20:6a0d:b0:160:a752:59e with SMTP id p13-20020a056a206a0d00b00160a752059emr9036117pzk.40.1698578079224; Sun, 29 Oct 2023 04:14:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698578079; cv=none; d=google.com; s=arc-20160816; b=h5FOor1d01xbAHR3q6Vu9i/GP6Q8uwzM0S+jcIiKiuUAViSA8xFRbNMqjIPNfzMshs 5N1CIC2T6OdnhjveBoVwRPKCCzDZGeRGSqdsJ2sUkGnVAAkMh3kyfXOVi2cfwzgYoC2j BjizJaLG8naTJ9ELyQqDnOmFNAo4/ZiC/NqYCKZNjQo9ZsTEL5kdZwi+ZoIgmkCPgNLV aMJ9Il4AdoMpfWNGJmur7xPBo/+O/TBiddi7Z0Ah2qy4fgPimkENoLYZoblic3YhngMj M8g0GMjUsRNiXzXUWmNELrxkEYF5AWnJOfo79uivaZmX2U04x6clHv/N45EWhZ63JQLY hLzw== 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:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=K6ZWdoNmwzeouGDrVVRD/RQmSEExKykrRSbeIVMOTyU=; fh=SsNJs69sMYlYTeWQYB3Y6uFVnk1BYEiSEalBcmc5mfg=; b=wq3EG/HPzGaZUT3WDdOIJ1BSmrZIyczvjA+rBJje4795BAE+fNcuz+S7CD0KwTl4pE ZOKzhciGEV4Cke8XXha9jVjamdJYeJPEXCC8LffY3et+2hLNoKcWseDy6vOcNu3wTEIP 4HaCLjJPJuV3qqo7V+2g3BBTRB/ATQTIwMRM3afVNdMNvljvxF8fADknyfXFtwNU1O0k p+8MSnZBBHAre7qFVHTFrAksLWZ2kNMa6RI5/wvTXu3yjc5Ck2GF0T7bW0mgPdKeN3kE y0LUox2J8IKFYyC4uTXUshpLXXQFBoxyZBMPrPoIgBgvayDShrMx5yvkT2V4p+q+66sS fCEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=uKov8Epv; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=c0S7U11d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id q20-20020a656854000000b005b7e3ee1820si3516590pgt.157.2023.10.29.04.14.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 04:14:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=uKov8Epv; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=c0S7U11d; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alu.unizg.hr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 9ED33809D336; Sun, 29 Oct 2023 04:14:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbjJ2LOU (ORCPT <rfc822;fengqi706@gmail.com> + 30 others); Sun, 29 Oct 2023 07:14:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229529AbjJ2LOS (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sun, 29 Oct 2023 07:14:18 -0400 Received: from domac.alu.hr (domac.alu.unizg.hr [IPv6:2001:b68:2:2800::3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6BAA6AB; Sun, 29 Oct 2023 04:14:16 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 26A3C60182; Sun, 29 Oct 2023 12:14:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1698578055; bh=dD433RcfZMXumHsqDGuyG1IGuMidDi/U8xCKI0ffmTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uKov8Epvhl8Kxt60aShiUCdlHhiA5MYBeGSrMpoJ9kxoqqIaarwaU75cVWLKy6+Xd gtMdWqi2t3B54q2vyFRY4x35tS7/zbKe5cb6xFtA/Hl55bFUEzDVJdURlTeCK0mqm1 kM4f9ZbqdNajfyQnMDDUCfw4YnVqTtFa7FCrWZ/RcWNa4VxBoBPCVkURU3tn8leJzD Unz26dDpwbah/nCDge7ECepBXj0dPIGnLOANkcBrzY6HRqyfpHuQNlmPbvkmV9o54I PGoIdAU5xbHDMn2uKYgWWxUlrvKPgiVmVeb9XIAEavPOSU/ibRTyRmacHsappwD1UI S0xAOOWHV490A== X-Virus-Scanned: Debian amavisd-new at domac.alu.hr Received: from domac.alu.hr ([127.0.0.1]) by localhost (domac.alu.hr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sKHw8ZPIZR9j; Sun, 29 Oct 2023 12:14:12 +0100 (CET) Received: from defiant.home (78-3-40-247.adsl.net.t-com.hr [78.3.40.247]) by domac.alu.hr (Postfix) with ESMTPSA id 68D7F60173; Sun, 29 Oct 2023 12:14:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1698578052; bh=dD433RcfZMXumHsqDGuyG1IGuMidDi/U8xCKI0ffmTE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c0S7U11d+DXzFtzA+nyfBY+QzUPznh86Pv2iE543t7CyG3iR+Mm2pdQMzwmSqbNF1 93gHpqhYQrQjK2CuiXXCDDFBVrgHyw7EqvJzALlkI3VgzI3QxNH86f2hcjtLOhOOhk bIF99GeZN2QxKYa8RPG/UfJJNBvbZT16viauVYrOjWDwDs6RLmsMeHzm4TObjSip05 KK4VZR7QOTumOq/HanP+ZUUy48mvyov/Xa7bLADww4eFF3kNyRfDQ0uYh4L5EgaGBM 06oaJC2KEiQQMOA/m/BNY1z25mxkwLmgJr0aDdCmpWJIw9MNSJXFMAV65yY4OwHQx/ XqKhLhbVxNtcw== From: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> To: Jason Gunthorpe <jgg@ziepe.ca>, Joerg Roedel <jroedel@suse.de>, Lu Baolu <baolu.lu@linux.intel.com>, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, netdev@vger.kernel.org Cc: Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, Robin Murphy <robin.murphy@arm.com>, Heiner Kallweit <hkallweit1@gmail.com>, nic_swsd@realtek.com, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>, Marco Elver <elver@google.com> Subject: [PATCH v4 5/5] r8169: Coalesce mac ocp commands for rtl_hw_init_8125 to reduce spinlocks Date: Sun, 29 Oct 2023 12:04:47 +0100 Message-Id: <20231029110442.347448-5-mirsad.todorovac@alu.unizg.hr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231029110442.347448-1-mirsad.todorovac@alu.unizg.hr> References: <20231029110442.347448-1-mirsad.todorovac@alu.unizg.hr> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Sun, 29 Oct 2023 04:14:36 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781088207683823204 X-GMAIL-MSGID: 1781088207683823204 |
Series |
[v4,1/5] r8169: Coalesce r8169_mac_ocp_write/modify calls to reduce spinlock stalls
|
|
Commit Message
Mirsad Todorovac
Oct. 29, 2023, 11:04 a.m. UTC
Repeated calls to r8168_mac_ocp_write() and r8168_mac_ocp_modify() in
the init sequence of the 8125 involve implicit spin_lock_irqsave() and
spin_unlock_irqrestore() on each invocation.
Coalesced with the corresponding helpers r8168_mac_ocp_write_seq() and
r8168_mac_ocp_modify_seq() into sequential write or modidy with a sinqle lock/unlock,
these calls reduce overall lock contention.
Fixes: f1bce4ad2f1ce ("r8169: add support for RTL8125")
Cc: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Marco Elver <elver@google.com>
Cc: nic_swsd@realtek.com
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/lkml/20231028005153.2180411-1-mirsad.todorovac@alu.unizg.hr/
Link: https://lore.kernel.org/lkml/20231028110459.2644926-1-mirsad.todorovac@alu.unizg.hr/
Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
---
v4:
fixed complaints as advised by Heiner and checkpatch.pl.
split the patch into five sections to be more easily manipulated and reviewed
introduced r8168_mac_ocp_write_seq()
applied coalescing of mac ocp writes/modifies for 8168H, 8125 and 8125B
v3:
removed register/mask pair array sentinels, so using ARRAY_SIZE().
avoided duplication of RTL_W32() call code as advised by Heiner.
drivers/net/ethernet/realtek/r8169_main.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
Comments
On 10/29/2023 4:04 AM, Mirsad Goran Todorovac wrote: > Repeated calls to r8168_mac_ocp_write() and r8168_mac_ocp_modify() in > the init sequence of the 8125 involve implicit spin_lock_irqsave() and > spin_unlock_irqrestore() on each invocation. > > Coalesced with the corresponding helpers r8168_mac_ocp_write_seq() and > r8168_mac_ocp_modify_seq() into sequential write or modidy with a sinqle lock/unlock, > these calls reduce overall lock contention. > > Fixes: f1bce4ad2f1ce ("r8169: add support for RTL8125") > Cc: Heiner Kallweit <hkallweit1@gmail.com> > Cc: Marco Elver <elver@google.com> > Cc: nic_swsd@realtek.com > Cc: "David S. Miller" <davem@davemloft.net> > Cc: Eric Dumazet <edumazet@google.com> > Cc: Jakub Kicinski <kuba@kernel.org> > Cc: Paolo Abeni <pabeni@redhat.com> > Cc: netdev@vger.kernel.org > Cc: linux-kernel@vger.kernel.org > Link: https://lore.kernel.org/lkml/20231028005153.2180411-1-mirsad.todorovac@alu.unizg.hr/ > Link: https://lore.kernel.org/lkml/20231028110459.2644926-1-mirsad.todorovac@alu.unizg.hr/ > Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr> > --- Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index dd65e0384ab3..8dce08d90367 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -5070,6 +5070,12 @@ static void rtl_hw_init_8168g(struct rtl8169_private *tp) static void rtl_hw_init_8125(struct rtl8169_private *tp) { + static const struct e_info_regdata hw_init_8125_1[] = { + { 0xc0aa, 0x07d0 }, + { 0xc0a6, 0x0150 }, + { 0xc01e, 0x5555 }, + }; + rtl_enable_rxdvgate(tp); RTL_W8(tp, ChipCmd, RTL_R8(tp, ChipCmd) & ~(CmdTxEnb | CmdRxEnb)); @@ -5079,9 +5085,7 @@ static void rtl_hw_init_8125(struct rtl8169_private *tp) r8168_mac_ocp_modify(tp, 0xe8de, BIT(14), 0); r8168g_wait_ll_share_fifo_ready(tp); - r8168_mac_ocp_write(tp, 0xc0aa, 0x07d0); - r8168_mac_ocp_write(tp, 0xc0a6, 0x0150); - r8168_mac_ocp_write(tp, 0xc01e, 0x5555); + r8168_mac_ocp_write_seq(tp, hw_init_8125_1); r8168g_wait_ll_share_fifo_ready(tp); }