From patchwork Mon Jun 24 13:26:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13709516 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61A80C2BD09 for ; Mon, 24 Jun 2024 13:28:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=weoB2927OHeQLkItSsl1+92aESa5A0VbbSHXdYNaCxU=; b=YIoSSZn2x6zGcO9mUgflYBtc6K KwdEFLUtmBFSGVZrUkzcoIUrEjdrDYtvPUho9tPucAO7A133fwICtHo5Q1GIE2DFqczvUGLo0j5V/ riaiOAKR+gqyjz0iIV0k2/ycsTPX+1QKV5ugPsh0fsrSR15mx9W9EO9hs/tcdvReDz+Soj/sE1PqX JB1TOsFVFQP8lE+gQTyhCgK1ks65pxqT2rnn8Qih+owblz853a1QqZyuHfA+1BR30cfb7KvW3kBUs eg5MYYUYxhJgAzse13OQ92poz8HSP7PHBeTn3B7qF78S3tnxKET2DAjqf+eZ4t3kvxqEz1kSvYQLZ dRCDjcAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLjkN-0000000Gv0E-1VHi; Mon, 24 Jun 2024 13:28:39 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sLjkH-0000000Guwg-0PYx for linux-arm-kernel@lists.infradead.org; Mon, 24 Jun 2024 13:28:34 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-52cd87277d8so2669950e87.2 for ; Mon, 24 Jun 2024 06:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1719235711; x=1719840511; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=weoB2927OHeQLkItSsl1+92aESa5A0VbbSHXdYNaCxU=; b=g3T41FiBfYqGal/w0VK96zEqAA4Z9bFz3qAstlkYPfQBRxnOO0cT1FIDY/DwB8Eh4U bVB6eZn1gjl+e9gzg8hDa4EYaGUWBtAdxu6gN7Gn7MgonIe+m7q8p10/Wn6FIo41vJEu SC9Bgjt+njQsMPXqkdM4BXwR2q6qTD11rK28hJliobjcmluRrqBgsv3oBrbHmMERNZEm F18ImPDdzoyWTu0vOvycz9kIaFrjJU+kZPeWWPRVOKmwtW4eYF25emDjGauUIKAeHx4Q 59OyCqxgGd30ytX6fZ55H+l8KRYGNeSjaZhYy5RH690DetcVeTcJm6RRfq2UM8GA9nDP CDiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719235711; x=1719840511; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=weoB2927OHeQLkItSsl1+92aESa5A0VbbSHXdYNaCxU=; b=ZFrO5kCIppvLRAxO4kYlWvMxtwC5HvstP51hFk+A40UgxVCYWCFRajmQEgLmARY41/ G2whdP2fvUZOVA+tbqvI950h872vikoTBkMTsthPDqW9/bZS3gVVca+oRrH4w4MwOO7H 28y41A1CgUsoFYHxzQnpZ7FTuYze6f69GSbR3r6LNY+/gCaOvaTXhZ2nLhTSmJrGg6/N 7x0l390Gdv+hjLePwF9OzLUPXc2Uwg8SWlK5I85yu7quouwWSzRVGQAlMLTNbxUSr9iF b5ErNk1lZQPbxnmXLYY6DM+djMaopIxnX37H5Y+pzNLqw2DBhDnaEPcveRfR6jgGDdRN 61Ig== X-Forwarded-Encrypted: i=1; AJvYcCUC0SvJZ91+GmhWjgX9Ie4pBG0dwUdQJYlUCQTAwjsOZZ4TsVOIvYuWgzuq6SBKNCA6HDg/zDLNUFnZ9oyyHoE09ph5WU5rVOC67kAHo6ajxsjtAcY= X-Gm-Message-State: AOJu0YzLibaQGO/CIWRSyAXbc2coSVEc2GuPLqO/2dBz4Q5nVOuV1J5g QPl0ZfDAjXlUPoGRpHKDvNYT461pf87jo2tjVuu1Xey70wkuxMk8 X-Google-Smtp-Source: AGHT+IFq8C6kBEtbmGEGitX4D9FUoJzf8LPqBHNhfBy21YGAueF442o3wAvxepev68ZGGljisU8J+g== X-Received: by 2002:a05:6512:ba1:b0:52c:dd38:f3a3 with SMTP id 2adb3069b0e04-52ce185cf4amr3356821e87.46.1719235710522; Mon, 24 Jun 2024 06:28:30 -0700 (PDT) Received: from localhost ([213.79.110.82]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52cd6454a96sm968129e87.303.2024.06.24.06.28.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Jun 2024 06:28:30 -0700 (PDT) From: Serge Semin To: Russell King , Andrew Halaney , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Alexei Starovoitov , Jesper Dangaard Brouer , John Fastabend , Daniel Borkmann , linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, bpf@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC net-next v2 09/17] net: stmmac: Introduce mac_device_info::priv pointer Date: Mon, 24 Jun 2024 16:26:26 +0300 Message-ID: <20240624132802.14238-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240624_062833_199779_401565BC X-CRM114-Status: GOOD ( 13.97 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There is going to be introduced an PCS-specific CSR space pointer defined in the stmmac_priv structure nearby the mmcaddr, estaddr and ptpaddr fields. In order to have that pointer accessible from the PCS-specific callback, let's introduce pointer to stmmac_priv defined in the mac_device_info structure. Signed-off-by: Serge Semin --- Note the better approach would be to convert the mac_device_info instance to being embedded into the stmmac_priv structure. It would have solved many driver problems like non-unified HW abstraction interface, duplicated fields (ioaddr and pcsr, etc) or too many non-runtime parameters passed to the callbacks, etc. But the change also would have been much-much more invasive than this one is. If despite of that you find the mac_device_info embedding into stmmac_priv more appropriate (as I do), then I'll provide the respective patch in place of this one. --- drivers/net/ethernet/stmicro/stmmac/common.h | 1 + drivers/net/ethernet/stmicro/stmmac/hwif.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index a66b836996d6..f7661268518f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -580,6 +580,7 @@ struct mii_regs { }; struct mac_device_info { + struct stmmac_priv *priv; const struct stmmac_ops *mac; const struct stmmac_desc_ops *desc; const struct stmmac_dma_ops *dma; diff --git a/drivers/net/ethernet/stmicro/stmmac/hwif.c b/drivers/net/ethernet/stmicro/stmmac/hwif.c index 29367105df54..84fd57b76fad 100644 --- a/drivers/net/ethernet/stmicro/stmmac/hwif.c +++ b/drivers/net/ethernet/stmicro/stmmac/hwif.c @@ -351,6 +351,7 @@ int stmmac_hwif_init(struct stmmac_priv *priv) mac->tc = mac->tc ? : entry->tc; mac->mmc = mac->mmc ? : entry->mmc; mac->est = mac->est ? : entry->est; + mac->priv = priv; priv->hw = mac; priv->ptpaddr = priv->ioaddr + entry->regs.ptp_off;