lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20221019135008.3281743-3-horatiu.vultur@microchip.com>
Date:   Wed, 19 Oct 2022 15:50:05 +0200
From:   Horatiu Vultur <horatiu.vultur@...rochip.com>
To:     <linux-kernel@...r.kernel.org>, <netdev@...r.kernel.org>,
        <bpf@...r.kernel.org>
CC:     <davem@...emloft.net>, <edumazet@...gle.com>, <kuba@...nel.org>,
        <pabeni@...hat.com>, <ast@...nel.org>, <daniel@...earbox.net>,
        <hawk@...nel.org>, <john.fastabend@...il.com>,
        <linux@...linux.org.uk>, <UNGLinuxDriver@...rochip.com>,
        Horatiu Vultur <horatiu.vultur@...rochip.com>
Subject: [PATCH net-next 2/5] net: lan966x: Rename lan966x_fdma_get_max_mtu

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@...rochip.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ