netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] clean up the FEC driver
@ 2023-07-18  9:09 Wei Fang
  2023-07-18  9:09 ` [PATCH net-next 1/3] net: fec: remove the remaining code of rx copybreak Wei Fang
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Wei Fang @ 2023-07-18  9:09 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, xiaoning.wang, shenwei.wang, netdev
  Cc: linux-kernel, linux-imx

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(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH net-next 1/3] net: fec: remove the remaining code of rx copybreak
  2023-07-18  9:09 [PATCH net-next 0/3] clean up the FEC driver Wei Fang
@ 2023-07-18  9:09 ` Wei Fang
  2023-07-18  9:09 ` [PATCH net-next 2/3] net: fec: remove fec_set_mac_address() from fec_enet_init() Wei Fang
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Fang @ 2023-07-18  9:09 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, xiaoning.wang, shenwei.wang, netdev
  Cc: linux-kernel, linux-imx

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.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/fec.h      |  2 --
 drivers/net/ethernet/freescale/fec_main.c | 43 -----------------------
 2 files changed, 45 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index e4b5ae4884d9..90de14975837 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -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;
 
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 1063552980bc..d33bf7979430 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -327,8 +327,6 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
 #define FEC_WOL_FLAG_ENABLE		(0x1 << 1)
 #define FEC_WOL_FLAG_SLEEP_ON		(0x1 << 2)
 
-#define COPYBREAK_DEFAULT	256
-
 /* Max number of allowed TCP segments for software TSO */
 #define FEC_MAX_TSO_SEGS	100
 #define FEC_MAX_SKB_DESCS	(FEC_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
@@ -3065,44 +3063,6 @@ static int fec_enet_set_coalesce(struct net_device *ndev,
 	return 0;
 }
 
-static int fec_enet_get_tunable(struct net_device *netdev,
-				const struct ethtool_tunable *tuna,
-				void *data)
-{
-	struct fec_enet_private *fep = netdev_priv(netdev);
-	int ret = 0;
-
-	switch (tuna->id) {
-	case ETHTOOL_RX_COPYBREAK:
-		*(u32 *)data = fep->rx_copybreak;
-		break;
-	default:
-		ret = -EINVAL;
-		break;
-	}
-
-	return ret;
-}
-
-static int fec_enet_set_tunable(struct net_device *netdev,
-				const struct ethtool_tunable *tuna,
-				const void *data)
-{
-	struct fec_enet_private *fep = netdev_priv(netdev);
-	int ret = 0;
-
-	switch (tuna->id) {
-	case ETHTOOL_RX_COPYBREAK:
-		fep->rx_copybreak = *(u32 *)data;
-		break;
-	default:
-		ret = -EINVAL;
-		break;
-	}
-
-	return ret;
-}
-
 /* LPI Sleep Ts count base on tx clk (clk_ref).
  * The lpi sleep cnt value = X us / (cycle_ns).
  */
@@ -3240,8 +3200,6 @@ static const struct ethtool_ops fec_enet_ethtool_ops = {
 	.get_sset_count		= fec_enet_get_sset_count,
 #endif
 	.get_ts_info		= fec_enet_get_ts_info,
-	.get_tunable		= fec_enet_get_tunable,
-	.set_tunable		= fec_enet_set_tunable,
 	.get_wol		= fec_enet_get_wol,
 	.set_wol		= fec_enet_set_wol,
 	.get_eee		= fec_enet_get_eee,
@@ -4525,7 +4483,6 @@ fec_probe(struct platform_device *pdev)
 	if (fep->bufdesc_ex && fep->ptp_clock)
 		netdev_info(ndev, "registered PHC device %d\n", fep->dev_id);
 
-	fep->rx_copybreak = COPYBREAK_DEFAULT;
 	INIT_WORK(&fep->tx_timeout_work, fec_enet_timeout_work);
 
 	pm_runtime_mark_last_busy(&pdev->dev);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 2/3] net: fec: remove fec_set_mac_address() from fec_enet_init()
  2023-07-18  9:09 [PATCH net-next 0/3] clean up the FEC driver Wei Fang
  2023-07-18  9:09 ` [PATCH net-next 1/3] net: fec: remove the remaining code of rx copybreak Wei Fang
@ 2023-07-18  9:09 ` Wei Fang
  2023-07-18  9:09 ` [PATCH net-next 3/3] net: fec: remove unused members from struct fec_enet_private Wei Fang
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Fang @ 2023-07-18  9:09 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, xiaoning.wang, shenwei.wang, netdev
  Cc: linux-kernel, linux-imx

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().

Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/fec_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index d33bf7979430..1a21cff019b0 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -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];
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH net-next 3/3] net: fec: remove unused members from struct fec_enet_private
  2023-07-18  9:09 [PATCH net-next 0/3] clean up the FEC driver Wei Fang
  2023-07-18  9:09 ` [PATCH net-next 1/3] net: fec: remove the remaining code of rx copybreak Wei Fang
  2023-07-18  9:09 ` [PATCH net-next 2/3] net: fec: remove fec_set_mac_address() from fec_enet_init() Wei Fang
@ 2023-07-18  9:09 ` Wei Fang
  2023-07-19 20:45 ` [PATCH net-next 0/3] clean up the FEC driver Simon Horman
  2023-07-20  4:10 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Wei Fang @ 2023-07-18  9:09 UTC (permalink / raw)
  To: davem, edumazet, kuba, pabeni, xiaoning.wang, shenwei.wang, netdev
  Cc: linux-kernel, linux-imx

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.

Signed-off-by: Wei Fang <wei.fang@nxp.com>
---
 drivers/net/ethernet/freescale/fec.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 90de14975837..f35445bddc7a 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/3] clean up the FEC driver
  2023-07-18  9:09 [PATCH net-next 0/3] clean up the FEC driver Wei Fang
                   ` (2 preceding siblings ...)
  2023-07-18  9:09 ` [PATCH net-next 3/3] net: fec: remove unused members from struct fec_enet_private Wei Fang
@ 2023-07-19 20:45 ` Simon Horman
  2023-07-20  4:10 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2023-07-19 20:45 UTC (permalink / raw)
  To: Wei Fang
  Cc: davem, edumazet, kuba, pabeni, xiaoning.wang, shenwei.wang,
	netdev, linux-kernel, linux-imx

On Tue, Jul 18, 2023 at 05:09:25PM +0800, Wei Fang 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.
> 
> 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

Reviewed-by: Simon Horman <simon.horman@corigine.com>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next 0/3] clean up the FEC driver
  2023-07-18  9:09 [PATCH net-next 0/3] clean up the FEC driver Wei Fang
                   ` (3 preceding siblings ...)
  2023-07-19 20:45 ` [PATCH net-next 0/3] clean up the FEC driver Simon Horman
@ 2023-07-20  4:10 ` patchwork-bot+netdevbpf
  4 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-20  4:10 UTC (permalink / raw)
  To: Wei Fang
  Cc: davem, edumazet, kuba, pabeni, xiaoning.wang, shenwei.wang,
	netdev, linux-kernel, linux-imx

Hello:

This series was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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.
> 
> 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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-07-20  4:10 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-18  9:09 [PATCH net-next 0/3] clean up the FEC driver Wei Fang
2023-07-18  9:09 ` [PATCH net-next 1/3] net: fec: remove the remaining code of rx copybreak Wei Fang
2023-07-18  9:09 ` [PATCH net-next 2/3] net: fec: remove fec_set_mac_address() from fec_enet_init() Wei Fang
2023-07-18  9:09 ` [PATCH net-next 3/3] net: fec: remove unused members from struct fec_enet_private Wei Fang
2023-07-19 20:45 ` [PATCH net-next 0/3] clean up the FEC driver Simon Horman
2023-07-20  4:10 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).