Skip to contentSkip to conversation

clean up the FEC driver

PATCH Applied Wei Fang 3 participants 6 messages Jul 18, 2023 – Jul 20, 2023

Subsystems (3)
lore
Share & tools
lore

Wei Fang

author maintainer
#0 lore raw

cover clean up the FEC driver

When reading the codes of the FEC driver recently, I found there are some redundant or invalid codes, these codes make the FEC driver a bit messy and not concise, so this patch set has cleaned up the FEC driver. At present, I only found these, but I believe these are not all, I will continue to clean up the FEC driver in the future.

Wei Fang (3):
net: fec: remove the remaining code of rx copybreak
net: fec: remove fec_set_mac_address() from fec_enet_init()
net: fec: remove unused members from struct fec_enet_private

 drivers/net/ethernet/freescale/fec.h      |  5 ---
 drivers/net/ethernet/freescale/fec_main.c | 46 -----------------------
 2 files changed, 51 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 1/3 net: fec: remove the remaining code of rx copybreak

Since the commit 95698ff6177b ("net: fec: using page pool to manage RX buffers") has been applied, all the rx packets, no matter small packets or large packets are put directly into the kernel networking buffers. That is to say, the rx copybreak function has been removed since then, but the related code has not been completely cleaned up. So the purpose of this patch is to clean up the remaining related code of rx copybreak.

---
 drivers/net/ethernet/freescale/fec.h      |  2 --
 drivers/net/ethernet/freescale/fec_main.c | 43 -----------------------
 2 files changed, 45 deletions(-)
drivers/net/ethernet/freescale/fec.h +0 -2
index e4b5ae4884d9..90de14975837 100644
@@ -680,8 +680,6 @@ struct fec_enet_private {
 	struct ethtool_eee eee;
 	unsigned int clk_ref_rate;
 
-	u32 rx_copybreak;
-
 	/* ptp clock period in ns*/
 	unsigned int ptp_inc;
 
drivers/net/ethernet/freescale/fec_main.c +0 -43

67 lines not on this page · raw message

Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH 2/3 net: fec: remove fec_set_mac_address() from fec_enet_init()

In reply to Wei Fang

The fec_enet_init() is only invoked when the FEC driver probes, and the network device of FEC is not been brought up at this moment. So the fec_set_mac_address() does nothing and just returns zero when it is invoked in the fec_enet_init(). Actually, the MAC address is set into the hardware through fec_restart() which is also called in the fec_enet_init().

---
 drivers/net/ethernet/freescale/fec_main.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/ethernet/freescale/fec_main.c +0 -3
index d33bf7979430..1a21cff019b0 100644
@@ -4015,9 +4015,6 @@ static int fec_enet_init(struct net_device *ndev)
 	if (ret)
 		goto free_queue_mem;
 
-	/* make sure MAC we just acquired is programmed into the hw */
-	fec_set_mac_address(ndev, NULL);
-
 	/* Set receive and transmit descriptor base. */
 	for (i = 0; i < fep->num_rx_queues; i++) {
 		struct fec_enet_priv_rx_q *rxq = fep->rx_queue[i];
Signature · 1 line
2.25.1
author maintainer
#3 lore raw

PATCH 3/3 net: fec: remove unused members from struct fec_enet_private

In reply to Wei Fang

Three members of struct fec_enet_private have not been used since they were first introduced into the FEC driver (commit 6605b730c061 ("FEC: Add time stamping code and a PTP hardware clock")). Namely, last_overflow_check, rx_hwtstamp_filter and base_incval. These unused members make the struct fec_enet_private a bit messy and might confuse the readers. There is no reason to keep them in the FEC driver any longer.

---
 drivers/net/ethernet/freescale/fec.h | 3 ---
 1 file changed, 3 deletions(-)
drivers/net/ethernet/freescale/fec.h +0 -3
index 90de14975837..f35445bddc7a 100644
@@ -652,12 +652,9 @@ struct fec_enet_private {
 
 	struct ptp_clock *ptp_clock;
 	struct ptp_clock_info ptp_caps;
-	unsigned long last_overflow_check;
 	spinlock_t tmreg_lock;
 	struct cyclecounter cc;
 	struct timecounter tc;
-	int rx_hwtstamp_filter;
-	u32 base_incval;
 	u32 cycle_speed;
 	int hwts_rx_en;
 	int hwts_tx_en;
Signature · 1 line
2.25.1
Reviewed-by on the v1 series
#4 lore raw
In reply to Wei Fang
Quoted 10 lines · Wei Fang

When reading the codes of the FEC driver recently, I found there are some redundant or invalid codes, these codes make the FEC driver a bit messy and not concise, so this patch set has cleaned up the FEC driver. At present, I only found these, but I believe these are not all, I will continue to clean up the FEC driver in the future.

Wei Fang (3):
net: fec: remove the remaining code of rx copybreak
net: fec: remove fec_set_mac_address() from fec_enet_init()
net: fec: remove unused members from struct fec_enet_private

#5 lore raw
In reply to Wei Fang
This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 6 lines · On Tue, 18 Jul 2023 17:09:25 +0800 you wrote:

When reading the codes of the FEC driver recently, I found there are some redundant or invalid codes, these codes make the FEC driver a bit messy and not concise, so this patch set has cleaned up the FEC driver. At present, I only found these, but I believe these are not all, I will continue to clean up the FEC driver in the future.

Quoted 6 lines

Wei Fang (3):
net: fec: remove the remaining code of rx copybreak
net: fec: remove fec_set_mac_address() from fec_enet_init()
net: fec: remove unused members from struct fec_enet_private

[...]

Here is the summary with links:
- [net-next,1/3] net: fec: remove the remaining code of rx copybreak

    https://git.kernel.org/netdev/net-next/c/3b23ecd53ab5
  - [net-next,2/3] net: fec: remove fec_set_mac_address() from fec_enet_init()
    https://git.kernel.org/netdev/net-next/c/36bde9c1accb
  - [net-next,3/3] net: fec: remove unused members from struct fec_enet_private
    https://git.kernel.org/netdev/net-next/c/636a5e88233a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html