Netdev List
 help / color / mirror / Atom feed
From: Horatiu Vultur <horatiu.vultur@microchip.com>
To: <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>,
	<bpf@vger.kernel.org>
Cc: <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <ast@kernel.org>, <daniel@iogearbox.net>,
	<hawk@kernel.org>, <john.fastabend@gmail.com>,
	<linux@armlinux.org.uk>, <UNGLinuxDriver@microchip.com>,
	Horatiu Vultur <horatiu.vultur@microchip.com>
Subject: [PATCH net-next 2/5] net: lan966x: Rename lan966x_fdma_get_max_mtu
Date: Wed, 19 Oct 2022 15:50:05 +0200	[thread overview]
Message-ID: <20221019135008.3281743-3-horatiu.vultur@microchip.com> (raw)
In-Reply-To: <20221019135008.3281743-1-horatiu.vultur@microchip.com>

Rename the function lan966x_fdma_get_max_mtu to lan966x_get_max_mtu
because it doesn't have anything to do with fdma. Because of this
rename, the function is moved also in a different file.

Signed-off-by: Horatiu Vultur <horatiu.vultur@microchip.com>
---
 .../ethernet/microchip/lan966x/lan966x_fdma.c | 22 +------------------
 .../ethernet/microchip/lan966x/lan966x_main.c | 19 ++++++++++++++++
 .../ethernet/microchip/lan966x/lan966x_main.h |  2 ++
 3 files changed, 22 insertions(+), 21 deletions(-)

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
index 1dc4e6ace8b56..e0b9cd289994f 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_fdma.c
@@ -661,25 +661,6 @@ int lan966x_fdma_xmit(struct sk_buff *skb, __be32 *ifh, struct net_device *dev)
 	return err;
 }
 
-static int lan966x_fdma_get_max_mtu(struct lan966x *lan966x)
-{
-	int max_mtu = 0;
-	int i;
-
-	for (i = 0; i < lan966x->num_phys_ports; ++i) {
-		int mtu;
-
-		if (!lan966x->ports[i])
-			continue;
-
-		mtu = lan966x->ports[i]->dev->mtu;
-		if (mtu > max_mtu)
-			max_mtu = mtu;
-	}
-
-	return max_mtu;
-}
-
 static int lan966x_qsys_sw_status(struct lan966x *lan966x)
 {
 	return lan_rd(lan966x, QSYS_SW_STATUS(CPU_PORT));
@@ -749,8 +730,7 @@ int lan966x_fdma_change_mtu(struct lan966x *lan966x)
 	int err;
 	u32 val;
 
-	max_mtu = lan966x_fdma_get_max_mtu(lan966x);
-	max_mtu += IFH_LEN_BYTES;
+	max_mtu = lan966x_get_max_mtu(lan966x);
 
 	if (round_up(max_mtu, PAGE_SIZE) / PAGE_SIZE - 1 ==
 	    lan966x->rx.page_order)
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 6fd857880d3fe..4fa8c07039d9f 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -379,6 +379,25 @@ static netdev_tx_t lan966x_port_xmit(struct sk_buff *skb,
 	return err;
 }
 
+int lan966x_get_max_mtu(struct lan966x *lan966x)
+{
+	int max_mtu = 0;
+	int i;
+
+	for (i = 0; i < lan966x->num_phys_ports; ++i) {
+		int mtu;
+
+		if (!lan966x->ports[i])
+			continue;
+
+		mtu = lan966x->ports[i]->dev->mtu;
+		if (mtu > max_mtu)
+			max_mtu = mtu;
+	}
+
+	return max_mtu + IFH_LEN_BYTES;
+}
+
 static int lan966x_port_change_mtu(struct net_device *dev, int new_mtu)
 {
 	struct lan966x_port *port = netdev_priv(dev);
diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
index 9656071b8289e..e05036841f825 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.h
@@ -333,6 +333,8 @@ void lan966x_unregister_notifier_blocks(void);
 
 bool lan966x_hw_offload(struct lan966x *lan966x, u32 port, struct sk_buff *skb);
 
+int lan966x_get_max_mtu(struct lan966x *lan966x);
+
 void lan966x_ifh_get_src_port(void *ifh, u64 *src_port);
 void lan966x_ifh_get_timestamp(void *ifh, u64 *timestamp);
 
-- 
2.38.0


  parent reply	other threads:[~2022-10-19 14:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-19 13:50 [PATCH net-next 0/5] net: lan966x: Add xdp support Horatiu Vultur
2022-10-19 13:50 ` [PATCH net-next 1/5] net: lan966x: Add define IFH_LEN_BYTES Horatiu Vultur
2022-10-19 13:50 ` Horatiu Vultur [this message]
2022-10-19 13:50 ` [PATCH net-next 3/5] net: lan966x: Split function lan966x_fdma_rx_get_frame Horatiu Vultur
2022-10-19 13:50 ` [PATCH net-next 4/5] net: lan966x: Add basic XDP support Horatiu Vultur
2022-10-19 13:50 ` [PATCH net-next 5/5] net: lan96x: Use page_pool API Horatiu Vultur
2022-10-20 20:51 ` [PATCH net-next 0/5] net: lan966x: Add xdp support Horatiu Vultur

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221019135008.3281743-3-horatiu.vultur@microchip.com \
    --to=horatiu.vultur@microchip.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox