Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1308456rdf; Sat, 4 Nov 2023 15:18:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxMi4Ga12L++117p5ueSQr3mJPUFvfSJu2jS118GkGSoc9sRHMlJjeXYR+r6nQyeOkTDS5 X-Received: by 2002:a17:902:a388:b0:1cc:cff:43b6 with SMTP id x8-20020a170902a38800b001cc0cff43b6mr20685629pla.54.1699136318110; Sat, 04 Nov 2023 15:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699136318; cv=none; d=google.com; s=arc-20160816; b=TcfZwJ8Y/Fj4hIWBSeiFdqUdKXpnlA9fq68p/jkx200MdtHFs9LjnI+iJCjtlQ+3dn EVMX/slJpdNMewPmG/jpjOs/N7+aFI8Q6V3LDZlrs8DamWZSqKot5mZsVVkiSrkwa4tQ Mdq6kiCOqB4rFGgE95MI20zftIpPiIGzoz0DUcWXpHbXPm65/watNRdPODdeUc1jhLHr KQkWkcHuaxUIvwD1ORiUrJtY99Kf6pHx5fR1DmFlIX/BXeYuudnM+xGI0ped+JumCrOq PzLTG6EGVwCe2lowZBPdO+it4cxvSoTpcLxAgvDW16pmMi2JpVeMafppglSvbLzKP7qC m9nQ== 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=i50oP6hdMF/fNPKypVya83hZiLLPwB9IoaWwNCmb0yg=; fh=8IHXHRu5mHn3IO/DVj8jqdBGclEosyB3yeeUGryI1Ok=; b=guAS+iUBTlH8C/uiZnutd6YxYHx6QizENbfFXTLOhN7VA3JlceOFI92P0qYce2LDNY n1kjnt0wWP2U1P98VYH+cjvm/qyXhJRVTqQ7xH5Iq9f2m3b2urZwE41+fHvKI+G+euYT Gqfyly42WeZzjbQOoxG8vGuEE1LgoaGvhWnobrZAeRnRLlVBYF+xirWqOohNadskgmcO Oaq9MxyrXvmq5hrSzz+7x0E1ZO88o8NHuvb0cLDJKn3PSKBuwAMz1yACXiyHQvYznM6B e0KcXVNtq8ldCb+uEuG+CO3yGh7cH481F3Yb7F+o25MTNU1QuMGpWy0JA9C5LnOeGmwl ASuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b="Uo/2zhce"; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=BM3qBOKM; 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 Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id r17-20020a170902c7d100b001c9fb3b55f0si4267816pla.652.2023.11.04.15.18.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Nov 2023 15:18:38 -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="Uo/2zhce"; dkim=fail header.i=@alu.unizg.hr header.s=mail header.b=BM3qBOKM; 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 643848057950; Sat, 4 Nov 2023 15:18:35 -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 S231167AbjKDWSV (ORCPT + 99 others); Sat, 4 Nov 2023 18:18:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38628 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229578AbjKDWSR (ORCPT ); Sat, 4 Nov 2023 18:18:17 -0400 Received: from domac.alu.hr (domac.alu.unizg.hr [161.53.235.3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 000621718; Sat, 4 Nov 2023 15:17:55 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by domac.alu.hr (Postfix) with ESMTP id 4E3B960177; Sat, 4 Nov 2023 23:17:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1699136273; bh=Q0Y5ACC0TCRNesSVVs/luWSfBi2RlRcN1YXtTxiIoHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uo/2zhce99IOQiAQB8o3zEYcldvA2ncIPBA+/ikrRYGwjNPN94UWrwDuP8YwKZkpJ Dl5ZxFG1sTvdnjWbDZKL9VZ6ktGHTfGY/dNWP4b80U/wqAMg3gD5XIp/kqEZzdwl5M guAHGqdHhJn90yNzH6Cc8QrjjGs1M5hQ2PH4mFNAHZQ9h1/4JMYkZLdCq2uPuitfdt SmYMMT6BUChAGo125vpgnZ5Eh0bbSh6PVbu9I1a0d4eF/dhQea3Rr2IS0C78HWZTtP kj7cJ0xD9XsQSiwjOIN/mRdmKAO1OWtNN+GuYMSUkuvA6cYvkDA1Dsr/yQnPrmHmKR MnLvMH3e7ndXw== 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 ncAeqU03ugrV; Sat, 4 Nov 2023 23:17:50 +0100 (CET) Received: from defiant.home (78-2-200-71.adsl.net.t-com.hr [78.2.200.71]) by domac.alu.hr (Postfix) with ESMTPSA id DF90D60171; Sat, 4 Nov 2023 23:17:50 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=alu.unizg.hr; s=mail; t=1699136270; bh=Q0Y5ACC0TCRNesSVVs/luWSfBi2RlRcN1YXtTxiIoHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BM3qBOKMoe5VTuI8UYLIBq7JC6IuBKQGoRhSdmMNh7Pwa2liVpTLUq+0LKsBH1Kqz 6LlxO73Px4O9KumghXdf3z2eg8ek6geNewlK4SpvY7/RO5lC9ScrfX8ibzOXnc0co3 q+A1oD1yORi9PP0jq9Wz9Qw/zl5l+VsZ6ols/jy/PVLPPcdwFnv3+VRtX0YM14wb4z h97bU3nVyzS1ySN4B8IhB9JLTAff0g5x4rDYqxKP2EyGAIqB7I8i07iLhnNTcJi015 AG6c+UpglqsvcHhhv202+kwon+0vUZ8s9XKkbndXVaqoiRkRd/BuqwV9ZcNT9tZ8g+ P/w0y+vCA3fyw== From: Mirsad Goran Todorovac To: linux-kernel@vger.kernel.org Cc: "David S. Miller" , Eric Dumazet , Heiner Kallweit , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, nic_swsd@realtek.com, Mirsad Goran Todorovac , Marco Elver , Jacob Keller Subject: [PATCH net-next v6 5/5] r8169: Coalesce mac ocp commands for rtl_hw_init_8125 to reduce spinlocks Date: Sat, 4 Nov 2023 23:15:21 +0100 Message-Id: <20231104221514.45821-6-mirsad.todorovac@alu.unizg.hr> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231104221514.45821-1-mirsad.todorovac@alu.unizg.hr> References: <20231104221514.45821-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,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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: 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]); Sat, 04 Nov 2023 15:18:35 -0700 (PDT) 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 Cc: Marco Elver Cc: nic_swsd@realtek.com Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni 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 Reviewed-by: Jacob Keller --- drivers/net/ethernet/realtek/r8169_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c index 056fe5b3930b..42f0a7486151 100644 --- a/drivers/net/ethernet/realtek/r8169_main.c +++ b/drivers/net/ethernet/realtek/r8169_main.c @@ -5074,6 +5074,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)); @@ -5083,9 +5089,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); } -- 2.34.1