linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming
@ 2025-06-12 14:15 Marc Kleine-Budde
  2025-06-12 14:15 ` [PATCH net-next v2 01/10] net: fec: fix typos found by codespell Marc Kleine-Budde
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:15 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

This series first cleans up the fec driver a bit (typos, obsolete
comments, add missing header files, rename struct, replace magic
number by defines).

The next 2 patches update the order of IRQs in the driver and gives
them names that reflect their function.

The last 5 patches clean up the fec_enet_rx_queue() function,
including VLAN handling.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Changes in v2:
- removed patches 7, 8 for now
- rebased to recent net-next/main:
  dropped patch 6
- 2, 3: wrap patch description at 75 chars:
  (thanks Frank Li)
- 4, 5, 6, 7, 9: updated wording of patch description
  (thanks Frank Li)
- 10: move VLAN_header into the if statement (thanks Wei Fang)
- 10: mark several variables const
- collected Wei Fang's and Frank Li's Reviewed-by
- Link to v1: https://patch.msgid.link/20241016-fec-cleanups-v1-0-de783bd15e6a@pengutronix.de

---
Marc Kleine-Budde (10):
      net: fec: fix typos found by codespell
      net: fec: struct fec_enet_private: remove obsolete comment
      net: fec: add missing header files
      net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info
      net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED
      net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue()
      net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr()
      net: fec: fec_enet_rx_queue(): reduce scope of data
      net: fec: fec_enet_rx_queue(): move_call to _vlan_hwaccel_put_tag()
      net: fec: fec_enet_rx_queue(): factor out VLAN handling into separate function fec_enet_rx_vlan()

 drivers/net/ethernet/freescale/fec.h      | 11 +++---
 drivers/net/ethernet/freescale/fec_main.c | 56 +++++++++++++++----------------
 drivers/net/ethernet/freescale/fec_ptp.c  |  4 +--
 3 files changed, 35 insertions(+), 36 deletions(-)
---
base-commit: 5d6d67c4cb10a4b4d3ae35758d5eeed6239afdc8
change-id: 20240925-fec-cleanups-c9b5544bc854

Best regards,
-- 
Marc Kleine-Budde <mkl@pengutronix.de>



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

* [PATCH net-next v2 01/10] net: fec: fix typos found by codespell
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
@ 2025-06-12 14:15 ` Marc Kleine-Budde
  2025-06-13 18:20   ` Andrew Lunn
  2025-06-12 14:15 ` [PATCH net-next v2 02/10] net: fec: struct fec_enet_private: remove obsolete comment Marc Kleine-Budde
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:15 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

codespell has found some typos in the comments, fix them.

Reviewed-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec.h     | 8 ++++----
 drivers/net/ethernet/freescale/fec_ptp.c | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index c81f2ea588f2..3cce9bba5dee 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -115,7 +115,7 @@
 #define IEEE_T_MCOL		0x254 /* Frames tx'd with multiple collision */
 #define IEEE_T_DEF		0x258 /* Frames tx'd after deferral delay */
 #define IEEE_T_LCOL		0x25c /* Frames tx'd with late collision */
-#define IEEE_T_EXCOL		0x260 /* Frames tx'd with excesv collisions */
+#define IEEE_T_EXCOL		0x260 /* Frames tx'd with excessive collisions */
 #define IEEE_T_MACERR		0x264 /* Frames tx'd with TX FIFO underrun */
 #define IEEE_T_CSERR		0x268 /* Frames tx'd with carrier sense err */
 #define IEEE_T_SQE		0x26c /* Frames tx'd with SQE err */
@@ -342,7 +342,7 @@ struct bufdesc_ex {
 #define FEC_TX_BD_FTYPE(X)	(((X) & 0xf) << 20)
 
 /* The number of Tx and Rx buffers.  These are allocated from the page
- * pool.  The code may assume these are power of two, so it it best
+ * pool.  The code may assume these are power of two, so it is best
  * to keep them that size.
  * We don't need to allocate pages for the transmitter.  We just use
  * the skbuffer directly.
@@ -460,7 +460,7 @@ struct bufdesc_ex {
 #define FEC_QUIRK_SINGLE_MDIO		(1 << 11)
 /* Controller supports RACC register */
 #define FEC_QUIRK_HAS_RACC		(1 << 12)
-/* Controller supports interrupt coalesc */
+/* Controller supports interrupt coalesce */
 #define FEC_QUIRK_HAS_COALESCE		(1 << 13)
 /* Interrupt doesn't wake CPU from deep idle */
 #define FEC_QUIRK_ERR006687		(1 << 14)
@@ -495,7 +495,7 @@ struct bufdesc_ex {
  */
 #define FEC_QUIRK_HAS_EEE		(1 << 20)
 
-/* i.MX8QM ENET IP version add new feture to generate delayed TXC/RXC
+/* i.MX8QM ENET IP version add new feature to generate delayed TXC/RXC
  * as an alternative option to make sure it works well with various PHYs.
  * For the implementation of delayed clock, ENET takes synchronized 250MHz
  * clocks to generate 2ns delay.
diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c
index 876d90832596..3aacd64c9e73 100644
--- a/drivers/net/ethernet/freescale/fec_ptp.c
+++ b/drivers/net/ethernet/freescale/fec_ptp.c
@@ -117,7 +117,7 @@ static u64 fec_ptp_read(const struct cyclecounter *cc)
  * @fep: the fec_enet_private structure handle
  * @enable: enable the channel pps output
  *
- * This function enble the PPS ouput on the timer channel.
+ * This function enable the PPS output on the timer channel.
  */
 static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
 {
@@ -172,7 +172,7 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable)
 		 * very close to the second point, which means NSEC_PER_SEC
 		 * - ts.tv_nsec is close to be zero(For example 20ns); Since the timer
 		 * is still running when we calculate the first compare event, it is
-		 * possible that the remaining nanoseonds run out before the compare
+		 * possible that the remaining nanoseconds run out before the compare
 		 * counter is calculated and written into TCCR register. To avoid
 		 * this possibility, we will set the compare event to be the next
 		 * of next second. The current setting is 31-bit timer and wrap

-- 
2.47.2



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

* [PATCH net-next v2 02/10] net: fec: struct fec_enet_private: remove obsolete comment
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
  2025-06-12 14:15 ` [PATCH net-next v2 01/10] net: fec: fix typos found by codespell Marc Kleine-Budde
@ 2025-06-12 14:15 ` Marc Kleine-Budde
  2025-06-13 18:21   ` Andrew Lunn
  2025-06-12 14:15 ` [PATCH net-next v2 03/10] net: fec: add missing header files Marc Kleine-Budde
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:15 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

In commit 4d494cdc92b3 ("net: fec: change data structure to support
multiqueue") the data structures were changed, so that the comment about
the sent-in-place skb doesn't apply any more. Remove it.

Reviewed-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec.h | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 3cce9bba5dee..ce1e4fe4d492 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -614,7 +614,6 @@ struct fec_enet_private {
 	unsigned int num_tx_queues;
 	unsigned int num_rx_queues;
 
-	/* The saved address of a sent-in-place packet/buffer, for skfree(). */
 	struct fec_enet_priv_tx_q *tx_queue[FEC_ENET_MAX_TX_QS];
 	struct fec_enet_priv_rx_q *rx_queue[FEC_ENET_MAX_RX_QS];
 

-- 
2.47.2



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

* [PATCH net-next v2 03/10] net: fec: add missing header files
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
  2025-06-12 14:15 ` [PATCH net-next v2 01/10] net: fec: fix typos found by codespell Marc Kleine-Budde
  2025-06-12 14:15 ` [PATCH net-next v2 02/10] net: fec: struct fec_enet_private: remove obsolete comment Marc Kleine-Budde
@ 2025-06-12 14:15 ` Marc Kleine-Budde
  2025-06-13 18:22   ` Andrew Lunn
  2025-06-12 14:15 ` [PATCH net-next v2 04/10] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info Marc Kleine-Budde
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:15 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

The fec.h isn't self contained. Add missing header files, so that it can be
parsed by language servers without errors.

Reviewed-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index ce1e4fe4d492..4098d439a6ff 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -15,7 +15,9 @@
 /****************************************************************************/
 
 #include <linux/clocksource.h>
+#include <linux/ethtool.h>
 #include <linux/net_tstamp.h>
+#include <linux/phy.h>
 #include <linux/pm_qos.h>
 #include <linux/bpf.h>
 #include <linux/ptp_clock_kernel.h>

-- 
2.47.2



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

* [PATCH net-next v2 04/10] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (2 preceding siblings ...)
  2025-06-12 14:15 ` [PATCH net-next v2 03/10] net: fec: add missing header files Marc Kleine-Budde
@ 2025-06-12 14:15 ` Marc Kleine-Budde
  2025-06-13 18:24   ` Andrew Lunn
  2025-06-12 14:15 ` [PATCH net-next v2 05/10] net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED Marc Kleine-Budde
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:15 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

In da722186f654 ("net: fec: set GPR bit on suspend by DT
configuration.") the platform_device_id fec_devtype::driver_data was
converted from holding the quirks to a pointing to struct fec_devinfo.

The struct fec_devinfo holding the information for the i.MX6SX was
named fec_imx6x_info.

Rename fec_imx6x_info to fec_imx6sx_info to align with the SoC's name.

Reviewed-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 17e9bddb9ddd..e0d7365e5b4f 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -131,7 +131,7 @@ static const struct fec_devinfo fec_mvf600_info = {
 		  FEC_QUIRK_HAS_MDIO_C45,
 };
 
-static const struct fec_devinfo fec_imx6x_info = {
+static const struct fec_devinfo fec_imx6sx_info = {
 	.quirks = FEC_QUIRK_ENET_MAC | FEC_QUIRK_HAS_GBIT |
 		  FEC_QUIRK_HAS_BUFDESC_EX | FEC_QUIRK_HAS_CSUM |
 		  FEC_QUIRK_HAS_VLAN | FEC_QUIRK_HAS_AVB |
@@ -196,7 +196,7 @@ static const struct of_device_id fec_dt_ids[] = {
 	{ .compatible = "fsl,imx28-fec", .data = &fec_imx28_info, },
 	{ .compatible = "fsl,imx6q-fec", .data = &fec_imx6q_info, },
 	{ .compatible = "fsl,mvf600-fec", .data = &fec_mvf600_info, },
-	{ .compatible = "fsl,imx6sx-fec", .data = &fec_imx6x_info, },
+	{ .compatible = "fsl,imx6sx-fec", .data = &fec_imx6sx_info, },
 	{ .compatible = "fsl,imx6ul-fec", .data = &fec_imx6ul_info, },
 	{ .compatible = "fsl,imx8mq-fec", .data = &fec_imx8mq_info, },
 	{ .compatible = "fsl,imx8qm-fec", .data = &fec_imx8qm_info, },

-- 
2.47.2



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

* [PATCH net-next v2 05/10] net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (3 preceding siblings ...)
  2025-06-12 14:15 ` [PATCH net-next v2 04/10] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info Marc Kleine-Budde
@ 2025-06-12 14:15 ` Marc Kleine-Budde
  2025-06-13 18:28   ` Andrew Lunn
  2025-06-12 14:15 ` [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue() Marc Kleine-Budde
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:15 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

Replace "1 << 5" for configuring 1000 MBit/s with a defined constant to
improve code readability and maintainability.

Reviewed-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index e0d7365e5b4f..21891baa2fc5 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -276,6 +276,7 @@ MODULE_PARM_DESC(macaddr, "FEC Ethernet MAC address");
 #define FEC_ECR_MAGICEN         BIT(2)
 #define FEC_ECR_SLEEP           BIT(3)
 #define FEC_ECR_EN1588          BIT(4)
+#define FEC_ECR_SPEED           BIT(5)
 #define FEC_ECR_BYTESWP         BIT(8)
 /* FEC RCR bits definition */
 #define FEC_RCR_LOOP            BIT(0)
@@ -1207,7 +1208,7 @@ fec_restart(struct net_device *ndev)
 		/* 1G, 100M or 10M */
 		if (ndev->phydev) {
 			if (ndev->phydev->speed == SPEED_1000)
-				ecntl |= (1 << 5);
+				ecntl |= FEC_ECR_SPEED;
 			else if (ndev->phydev->speed == SPEED_100)
 				rcntl &= ~FEC_RCR_10BASET;
 			else

-- 
2.47.2



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

* [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue()
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (4 preceding siblings ...)
  2025-06-12 14:15 ` [PATCH net-next v2 05/10] net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED Marc Kleine-Budde
@ 2025-06-12 14:15 ` Marc Kleine-Budde
  2025-06-13  6:22   ` Wei Fang
  2025-06-13 18:30   ` Andrew Lunn
  2025-06-12 14:16 ` [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr() Marc Kleine-Budde
                   ` (4 subsequent siblings)
  10 siblings, 2 replies; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:15 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde

There are the functions fec_enet_rx_queue() and fec_enet_tx_queue(),
one for handling the RX queue the other one handles the TX queue.

However they don't have the same signature. Align fec_enet_rx_queue()
argument order with fec_enet_tx_queue() to make code more readable.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 21891baa2fc5..6b456372de9a 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1713,7 +1713,7 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog,
  * effectively tossing the packet.
  */
 static int
-fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
+fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 {
 	struct fec_enet_private *fep = netdev_priv(ndev);
 	struct fec_enet_priv_rx_q *rxq;
@@ -1940,7 +1940,7 @@ static int fec_enet_rx(struct net_device *ndev, int budget)
 
 	/* Make sure that AVB queues are processed first. */
 	for (i = fep->num_rx_queues - 1; i >= 0; i--)
-		done += fec_enet_rx_queue(ndev, budget - done, i);
+		done += fec_enet_rx_queue(ndev, i, budget - done);
 
 	return done;
 }

-- 
2.47.2



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

* [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr()
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (5 preceding siblings ...)
  2025-06-12 14:15 ` [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue() Marc Kleine-Budde
@ 2025-06-12 14:16 ` Marc Kleine-Budde
  2025-06-13 18:37   ` Andrew Lunn
  2025-06-12 14:16 ` [PATCH net-next v2 08/10] net: fec: fec_enet_rx_queue(): reduce scope of data Marc Kleine-Budde
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:16 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

Use the provided helper function skb_vlan_eth_hdr() to replace manual VLAN
header calculation for better readability and maintainability.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 6b456372de9a..f238cb60aa65 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1860,8 +1860,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 		    fep->bufdesc_ex &&
 		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
 			/* Push and remove the vlan tag */
-			struct vlan_hdr *vlan_header =
-					(struct vlan_hdr *) (data + ETH_HLEN);
+			struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
 			vlan_tag = ntohs(vlan_header->h_vlan_TCI);
 
 			vlan_packet_rcvd = true;

-- 
2.47.2



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

* [PATCH net-next v2 08/10] net: fec: fec_enet_rx_queue(): reduce scope of data
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (6 preceding siblings ...)
  2025-06-12 14:16 ` [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr() Marc Kleine-Budde
@ 2025-06-12 14:16 ` Marc Kleine-Budde
  2025-06-12 14:16 ` [PATCH net-next v2 09/10] net: fec: fec_enet_rx_queue(): move_call to _vlan_hwaccel_put_tag() Marc Kleine-Budde
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:16 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

In order to clean up of the VLAN handling, reduce the scope of data.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f238cb60aa65..bc547be59dae 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1721,7 +1721,6 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 	unsigned short status;
 	struct  sk_buff *skb;
 	ushort	pkt_len;
-	__u8 *data;
 	int	pkt_received = 0;
 	struct	bufdesc_ex *ebdp = NULL;
 	bool	vlan_packet_rcvd = false;
@@ -1844,10 +1843,11 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 		skb_mark_for_recycle(skb);
 
 		if (unlikely(need_swap)) {
+			u8 *data;
+
 			data = page_address(page) + FEC_ENET_XDP_HEADROOM;
 			swap_buffer(data, pkt_len);
 		}
-		data = skb->data;
 
 		/* Extract the enhanced buffer descriptor */
 		ebdp = NULL;
@@ -1865,7 +1865,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 
 			vlan_packet_rcvd = true;
 
-			memmove(skb->data + VLAN_HLEN, data, ETH_ALEN * 2);
+			memmove(skb->data + VLAN_HLEN, skb->data, ETH_ALEN * 2);
 			skb_pull(skb, VLAN_HLEN);
 		}
 

-- 
2.47.2



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

* [PATCH net-next v2 09/10] net: fec: fec_enet_rx_queue(): move_call to _vlan_hwaccel_put_tag()
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (7 preceding siblings ...)
  2025-06-12 14:16 ` [PATCH net-next v2 08/10] net: fec: fec_enet_rx_queue(): reduce scope of data Marc Kleine-Budde
@ 2025-06-12 14:16 ` Marc Kleine-Budde
  2025-06-12 14:16 ` [PATCH net-next v2 10/10] net: fec: fec_enet_rx_queue(): factor out VLAN handling into separate function fec_enet_rx_vlan() Marc Kleine-Budde
  2025-06-12 14:18 ` [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
  10 siblings, 0 replies; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:16 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

Move __vlan_hwaccel_put_tag() into the if statement that sets
vlan_packet_rcvd = true. This change eliminates the unnecessary
vlan_packet_rcvd variable, simplifying the code and improving clarity.

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Reviewed-by: Wei Fang <wei.fang@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index bc547be59dae..021cf7c2dcf6 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1723,8 +1723,6 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 	ushort	pkt_len;
 	int	pkt_received = 0;
 	struct	bufdesc_ex *ebdp = NULL;
-	bool	vlan_packet_rcvd = false;
-	u16	vlan_tag;
 	int	index = 0;
 	bool	need_swap = fep->quirks & FEC_QUIRK_SWAP_FRAME;
 	struct bpf_prog *xdp_prog = READ_ONCE(fep->xdp_prog);
@@ -1855,18 +1853,18 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 			ebdp = (struct bufdesc_ex *)bdp;
 
 		/* If this is a VLAN packet remove the VLAN Tag */
-		vlan_packet_rcvd = false;
 		if ((ndev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
 		    fep->bufdesc_ex &&
 		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
 			/* Push and remove the vlan tag */
 			struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
-			vlan_tag = ntohs(vlan_header->h_vlan_TCI);
-
-			vlan_packet_rcvd = true;
+			u16 vlan_tag = ntohs(vlan_header->h_vlan_TCI);
 
 			memmove(skb->data + VLAN_HLEN, skb->data, ETH_ALEN * 2);
 			skb_pull(skb, VLAN_HLEN);
+			__vlan_hwaccel_put_tag(skb,
+					       htons(ETH_P_8021Q),
+					       vlan_tag);
 		}
 
 		skb->protocol = eth_type_trans(skb, ndev);
@@ -1886,12 +1884,6 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 			}
 		}
 
-		/* Handle received VLAN packets */
-		if (vlan_packet_rcvd)
-			__vlan_hwaccel_put_tag(skb,
-					       htons(ETH_P_8021Q),
-					       vlan_tag);
-
 		skb_record_rx_queue(skb, queue_id);
 		napi_gro_receive(&fep->napi, skb);
 

-- 
2.47.2



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

* [PATCH net-next v2 10/10] net: fec: fec_enet_rx_queue(): factor out VLAN handling into separate function fec_enet_rx_vlan()
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (8 preceding siblings ...)
  2025-06-12 14:16 ` [PATCH net-next v2 09/10] net: fec: fec_enet_rx_queue(): move_call to _vlan_hwaccel_put_tag() Marc Kleine-Budde
@ 2025-06-12 14:16 ` Marc Kleine-Budde
  2025-06-12 14:18 ` [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
  10 siblings, 0 replies; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:16 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Marc Kleine-Budde, Frank Li

In order to clean up of the VLAN handling, factor out the VLAN
handling into separate function fec_enet_rx_vlan().

Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/ethernet/freescale/fec_main.c | 32 ++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 021cf7c2dcf6..24dd1b280da0 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1707,6 +1707,22 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct bpf_prog *prog,
 	return ret;
 }
 
+static void fec_enet_rx_vlan(const struct net_device *ndev, struct sk_buff *skb)
+{
+	if (ndev->features & NETIF_F_HW_VLAN_CTAG_RX) {
+		const struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
+		const u16 vlan_tag = ntohs(vlan_header->h_vlan_TCI);
+
+		/* Push and remove the vlan tag */
+
+		memmove(skb->data + VLAN_HLEN, skb->data, ETH_ALEN * 2);
+		skb_pull(skb, VLAN_HLEN);
+		__vlan_hwaccel_put_tag(skb,
+				       htons(ETH_P_8021Q),
+				       vlan_tag);
+	}
+}
+
 /* During a receive, the bd_rx.cur points to the current incoming buffer.
  * When we update through the ring, if the next incoming buffer has
  * not been given to the system, we just set the empty indicator,
@@ -1853,19 +1869,9 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
 			ebdp = (struct bufdesc_ex *)bdp;
 
 		/* If this is a VLAN packet remove the VLAN Tag */
-		if ((ndev->features & NETIF_F_HW_VLAN_CTAG_RX) &&
-		    fep->bufdesc_ex &&
-		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
-			/* Push and remove the vlan tag */
-			struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
-			u16 vlan_tag = ntohs(vlan_header->h_vlan_TCI);
-
-			memmove(skb->data + VLAN_HLEN, skb->data, ETH_ALEN * 2);
-			skb_pull(skb, VLAN_HLEN);
-			__vlan_hwaccel_put_tag(skb,
-					       htons(ETH_P_8021Q),
-					       vlan_tag);
-		}
+		if (fep->bufdesc_ex &&
+		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN)))
+			fec_enet_rx_vlan(ndev, skb);
 
 		skb->protocol = eth_type_trans(skb, ndev);
 

-- 
2.47.2



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

* Re: [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming
  2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
                   ` (9 preceding siblings ...)
  2025-06-12 14:16 ` [PATCH net-next v2 10/10] net: fec: fec_enet_rx_queue(): factor out VLAN handling into separate function fec_enet_rx_vlan() Marc Kleine-Budde
@ 2025-06-12 14:18 ` Marc Kleine-Budde
  2025-06-13  6:19   ` Wei Fang
  10 siblings, 1 reply; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-12 14:18 UTC (permalink / raw)
  To: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn
  Cc: imx, netdev, linux-kernel, kernel, Frank Li

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

On 12.06.2025 16:15:53, Marc Kleine-Budde wrote:
> This series first cleans up the fec driver a bit (typos, obsolete
> comments, add missing header files, rename struct, replace magic
> number by defines).
> 
> The next 2 patches update the order of IRQs in the driver and gives
> them names that reflect their function.

Doh! These 2 patches have been removed, I'll send an updated series
tomorrow.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* RE: [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming
  2025-06-12 14:18 ` [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
@ 2025-06-13  6:19   ` Wei Fang
  2025-06-13  6:22     ` Marc Kleine-Budde
  0 siblings, 1 reply; 25+ messages in thread
From: Wei Fang @ 2025-06-13  6:19 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de, Frank Li,
	Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn

> On 12.06.2025 16:15:53, Marc Kleine-Budde wrote:
> > This series first cleans up the fec driver a bit (typos, obsolete
> > comments, add missing header files, rename struct, replace magic
> > number by defines).
> >
> > The next 2 patches update the order of IRQs in the driver and gives
> > them names that reflect their function.
> 
> Doh! These 2 patches have been removed, I'll send an updated series tomorrow.
> 

"update IRQ naming" needs to be removed from the subject as well.


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

* RE: [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue()
  2025-06-12 14:15 ` [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue() Marc Kleine-Budde
@ 2025-06-13  6:22   ` Wei Fang
  2025-06-13 18:30   ` Andrew Lunn
  1 sibling, 0 replies; 25+ messages in thread
From: Wei Fang @ 2025-06-13  6:22 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de, Shenwei Wang,
	Clark Wang, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Richard Cochran, Andrew Lunn

> There are the functions fec_enet_rx_queue() and fec_enet_tx_queue(), one for
> handling the RX queue the other one handles the TX queue.
> 
> However they don't have the same signature. Align fec_enet_rx_queue() argument
> order with fec_enet_tx_queue() to make code more readable.
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 21891baa2fc5..6b456372de9a 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1713,7 +1713,7 @@ fec_enet_run_xdp(struct fec_enet_private *fep, struct
> bpf_prog *prog,
>   * effectively tossing the packet.
>   */
>  static int
> -fec_enet_rx_queue(struct net_device *ndev, int budget, u16 queue_id)
> +fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
>  {
>  	struct fec_enet_private *fep = netdev_priv(ndev);
>  	struct fec_enet_priv_rx_q *rxq;
> @@ -1940,7 +1940,7 @@ static int fec_enet_rx(struct net_device *ndev, int
> budget)
> 
>  	/* Make sure that AVB queues are processed first. */
>  	for (i = fep->num_rx_queues - 1; i >= 0; i--)
> -		done += fec_enet_rx_queue(ndev, budget - done, i);
> +		done += fec_enet_rx_queue(ndev, i, budget - done);
> 
>  	return done;
>  }
> 

Reviewed-by: Wei Fang <wei.fang@nxp.com>


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

* Re: RE: [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming
  2025-06-13  6:19   ` Wei Fang
@ 2025-06-13  6:22     ` Marc Kleine-Budde
  0 siblings, 0 replies; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-13  6:22 UTC (permalink / raw)
  To: Wei Fang
  Cc: imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de, Frank Li,
	Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn

[-- Attachment #1: Type: text/plain, Size: 899 bytes --]

On 13.06.2025 06:19:32, Wei Fang wrote:
> > On 12.06.2025 16:15:53, Marc Kleine-Budde wrote:
> > > This series first cleans up the fec driver a bit (typos, obsolete
> > > comments, add missing header files, rename struct, replace magic
> > > number by defines).
> > >
> > > The next 2 patches update the order of IRQs in the driver and gives
> > > them names that reflect their function.
> > 
> > Doh! These 2 patches have been removed, I'll send an updated series tomorrow.
> > 
> 
> "update IRQ naming" needs to be removed from the subject as well.

ACK, it's already updated in my cover letter.

regards,
Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH net-next v2 01/10] net: fec: fix typos found by codespell
  2025-06-12 14:15 ` [PATCH net-next v2 01/10] net: fec: fix typos found by codespell Marc Kleine-Budde
@ 2025-06-13 18:20   ` Andrew Lunn
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew Lunn @ 2025-06-13 18:20 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn, imx,
	netdev, linux-kernel, kernel, Frank Li

On Thu, Jun 12, 2025 at 04:15:54PM +0200, Marc Kleine-Budde wrote:
> codespell has found some typos in the comments, fix them.
> 
> Reviewed-by: Wei Fang <wei.fang@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 02/10] net: fec: struct fec_enet_private: remove obsolete comment
  2025-06-12 14:15 ` [PATCH net-next v2 02/10] net: fec: struct fec_enet_private: remove obsolete comment Marc Kleine-Budde
@ 2025-06-13 18:21   ` Andrew Lunn
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew Lunn @ 2025-06-13 18:21 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn, imx,
	netdev, linux-kernel, kernel, Frank Li

On Thu, Jun 12, 2025 at 04:15:55PM +0200, Marc Kleine-Budde wrote:
> In commit 4d494cdc92b3 ("net: fec: change data structure to support
> multiqueue") the data structures were changed, so that the comment about
> the sent-in-place skb doesn't apply any more. Remove it.
> 
> Reviewed-by: Wei Fang <wei.fang@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 03/10] net: fec: add missing header files
  2025-06-12 14:15 ` [PATCH net-next v2 03/10] net: fec: add missing header files Marc Kleine-Budde
@ 2025-06-13 18:22   ` Andrew Lunn
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew Lunn @ 2025-06-13 18:22 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn, imx,
	netdev, linux-kernel, kernel, Frank Li

On Thu, Jun 12, 2025 at 04:15:56PM +0200, Marc Kleine-Budde wrote:
> The fec.h isn't self contained. Add missing header files, so that it can be
> parsed by language servers without errors.
> 
> Reviewed-by: Wei Fang <wei.fang@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 04/10] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info
  2025-06-12 14:15 ` [PATCH net-next v2 04/10] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info Marc Kleine-Budde
@ 2025-06-13 18:24   ` Andrew Lunn
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew Lunn @ 2025-06-13 18:24 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn, imx,
	netdev, linux-kernel, kernel, Frank Li

On Thu, Jun 12, 2025 at 04:15:57PM +0200, Marc Kleine-Budde wrote:
> In da722186f654 ("net: fec: set GPR bit on suspend by DT
> configuration.") the platform_device_id fec_devtype::driver_data was
> converted from holding the quirks to a pointing to struct fec_devinfo.
> 
> The struct fec_devinfo holding the information for the i.MX6SX was
> named fec_imx6x_info.
> 
> Rename fec_imx6x_info to fec_imx6sx_info to align with the SoC's name.
> 
> Reviewed-by: Wei Fang <wei.fang@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 05/10] net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED
  2025-06-12 14:15 ` [PATCH net-next v2 05/10] net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED Marc Kleine-Budde
@ 2025-06-13 18:28   ` Andrew Lunn
  0 siblings, 0 replies; 25+ messages in thread
From: Andrew Lunn @ 2025-06-13 18:28 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn, imx,
	netdev, linux-kernel, kernel, Frank Li

On Thu, Jun 12, 2025 at 04:15:58PM +0200, Marc Kleine-Budde wrote:
> Replace "1 << 5" for configuring 1000 MBit/s with a defined constant to
> improve code readability and maintainability.
> 
> Reviewed-by: Wei Fang <wei.fang@nxp.com>
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue()
  2025-06-12 14:15 ` [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue() Marc Kleine-Budde
  2025-06-13  6:22   ` Wei Fang
@ 2025-06-13 18:30   ` Andrew Lunn
  1 sibling, 0 replies; 25+ messages in thread
From: Andrew Lunn @ 2025-06-13 18:30 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn, imx,
	netdev, linux-kernel, kernel

On Thu, Jun 12, 2025 at 04:15:59PM +0200, Marc Kleine-Budde wrote:
> There are the functions fec_enet_rx_queue() and fec_enet_tx_queue(),
> one for handling the RX queue the other one handles the TX queue.
> 
> However they don't have the same signature. Align fec_enet_rx_queue()
> argument order with fec_enet_tx_queue() to make code more readable.
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr()
  2025-06-12 14:16 ` [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr() Marc Kleine-Budde
@ 2025-06-13 18:37   ` Andrew Lunn
  2025-06-16  1:42     ` Wei Fang
  0 siblings, 1 reply; 25+ messages in thread
From: Andrew Lunn @ 2025-06-13 18:37 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn, imx,
	netdev, linux-kernel, kernel, Frank Li

On Thu, Jun 12, 2025 at 04:16:00PM +0200, Marc Kleine-Budde wrote:
> Use the provided helper function skb_vlan_eth_hdr() to replace manual VLAN
> header calculation for better readability and maintainability.
> 
> Reviewed-by: Frank Li <Frank.Li@nxp.com>
> Reviewed-by: Wei Fang <wei.fang@nxp.com>
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
>  drivers/net/ethernet/freescale/fec_main.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 6b456372de9a..f238cb60aa65 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1860,8 +1860,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16 queue_id, int budget)
>  		    fep->bufdesc_ex &&
>  		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
>  			/* Push and remove the vlan tag */
> -			struct vlan_hdr *vlan_header =
> -					(struct vlan_hdr *) (data + ETH_HLEN);
> +			struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);

This is not 'obviously correct', so probably the commit message needs
expanding.

static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb)
{
	return (struct vlan_ethhdr *)skb->data;
}

I can see a few lines early:

		data = skb->data;

but what about the + ETH_HLEN?

	Andrew

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

* RE: [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr()
  2025-06-13 18:37   ` Andrew Lunn
@ 2025-06-16  1:42     ` Wei Fang
  2025-06-16 13:12       ` Andrew Lunn
  0 siblings, 1 reply; 25+ messages in thread
From: Wei Fang @ 2025-06-16  1:42 UTC (permalink / raw)
  To: Andrew Lunn, Marc Kleine-Budde
  Cc: Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn,
	imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de, Frank Li

> >  drivers/net/ethernet/freescale/fec_main.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > b/drivers/net/ethernet/freescale/fec_main.c
> > index 6b456372de9a..f238cb60aa65 100644
> > --- a/drivers/net/ethernet/freescale/fec_main.c
> > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > @@ -1860,8 +1860,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16
> queue_id, int budget)
> >  		    fep->bufdesc_ex &&
> >  		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
> >  			/* Push and remove the vlan tag */
> > -			struct vlan_hdr *vlan_header =
> > -					(struct vlan_hdr *) (data + ETH_HLEN);
> > +			struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
> 
> This is not 'obviously correct', so probably the commit message needs expanding.
> 
> static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb) {
> 	return (struct vlan_ethhdr *)skb->data; }
> 
> I can see a few lines early:
> 
> 		data = skb->data;
> 
> but what about the + ETH_HLEN?
> 

The type of vlan_header has been changed from "struct vlan_hdr *" to
"struct vlan_ethhdr *", so it is correct to use skb->data directly.

struct vlan_ethhdr {
	struct_group(addrs,
		unsigned char	h_dest[ETH_ALEN];
		unsigned char	h_source[ETH_ALEN];
	);
	__be16		h_vlan_proto;
	__be16		h_vlan_TCI;
	__be16		h_vlan_encapsulated_proto;
};


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

* Re: [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr()
  2025-06-16  1:42     ` Wei Fang
@ 2025-06-16 13:12       ` Andrew Lunn
  2025-06-16 13:34         ` Marc Kleine-Budde
  0 siblings, 1 reply; 25+ messages in thread
From: Andrew Lunn @ 2025-06-16 13:12 UTC (permalink / raw)
  To: Wei Fang
  Cc: Marc Kleine-Budde, Shenwei Wang, Clark Wang, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Richard Cochran,
	Andrew Lunn, imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de, Frank Li

On Mon, Jun 16, 2025 at 01:42:08AM +0000, Wei Fang wrote:
> > >  drivers/net/ethernet/freescale/fec_main.c | 3 +--
> > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > > b/drivers/net/ethernet/freescale/fec_main.c
> > > index 6b456372de9a..f238cb60aa65 100644
> > > --- a/drivers/net/ethernet/freescale/fec_main.c
> > > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > > @@ -1860,8 +1860,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16
> > queue_id, int budget)
> > >  		    fep->bufdesc_ex &&
> > >  		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
> > >  			/* Push and remove the vlan tag */
> > > -			struct vlan_hdr *vlan_header =
> > > -					(struct vlan_hdr *) (data + ETH_HLEN);
> > > +			struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
> > 
> > This is not 'obviously correct', so probably the commit message needs expanding.
> > 
> > static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb) {
> > 	return (struct vlan_ethhdr *)skb->data; }
> > 
> > I can see a few lines early:
> > 
> > 		data = skb->data;
> > 
> > but what about the + ETH_HLEN?
> > 
> 
> The type of vlan_header has been changed from "struct vlan_hdr *" to
> "struct vlan_ethhdr *", so it is correct to use skb->data directly.

Doh! I missed that, sorry. Maybe extend the commit message, you
mention skb_vlan_eth_hdr() but you could add something like

... and change the type of vlan_header to struct vlan_ethhdr to take
into account the ethernet header plus vlan header is returned.

With that, please add: Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

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

* Re: [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr()
  2025-06-16 13:12       ` Andrew Lunn
@ 2025-06-16 13:34         ` Marc Kleine-Budde
  0 siblings, 0 replies; 25+ messages in thread
From: Marc Kleine-Budde @ 2025-06-16 13:34 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Wei Fang, Shenwei Wang, Clark Wang, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Richard Cochran, Andrew Lunn,
	imx@lists.linux.dev, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel@pengutronix.de, Frank Li

[-- Attachment #1: Type: text/plain, Size: 2107 bytes --]

On 16.06.2025 15:12:37, Andrew Lunn wrote:
> On Mon, Jun 16, 2025 at 01:42:08AM +0000, Wei Fang wrote:
> > > >  drivers/net/ethernet/freescale/fec_main.c | 3 +--
> > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/net/ethernet/freescale/fec_main.c
> > > > b/drivers/net/ethernet/freescale/fec_main.c
> > > > index 6b456372de9a..f238cb60aa65 100644
> > > > --- a/drivers/net/ethernet/freescale/fec_main.c
> > > > +++ b/drivers/net/ethernet/freescale/fec_main.c
> > > > @@ -1860,8 +1860,7 @@ fec_enet_rx_queue(struct net_device *ndev, u16
> > > queue_id, int budget)
> > > >  		    fep->bufdesc_ex &&
> > > >  		    (ebdp->cbd_esc & cpu_to_fec32(BD_ENET_RX_VLAN))) {
> > > >  			/* Push and remove the vlan tag */
> > > > -			struct vlan_hdr *vlan_header =
> > > > -					(struct vlan_hdr *) (data + ETH_HLEN);
> > > > +			struct vlan_ethhdr *vlan_header = skb_vlan_eth_hdr(skb);
> > > 
> > > This is not 'obviously correct', so probably the commit message needs expanding.
> > > 
> > > static inline struct vlan_ethhdr *skb_vlan_eth_hdr(const struct sk_buff *skb) {
> > > 	return (struct vlan_ethhdr *)skb->data; }
> > > 
> > > I can see a few lines early:
> > > 
> > > 		data = skb->data;
> > > 
> > > but what about the + ETH_HLEN?
> > > 
> > 
> > The type of vlan_header has been changed from "struct vlan_hdr *" to
> > "struct vlan_ethhdr *", so it is correct to use skb->data directly.
> 
> Doh! I missed that, sorry. Maybe extend the commit message, you
> mention skb_vlan_eth_hdr() but you could add something like
> 
> ... and change the type of vlan_header to struct vlan_ethhdr to take
> into account the ethernet header plus vlan header is returned.
> 
> With that, please add: Reviewed-by: Andrew Lunn <andrew@lunn.ch>

Will do, thanks!

Marc

-- 
Pengutronix e.K.                 | Marc Kleine-Budde          |
Embedded Linux                   | https://www.pengutronix.de |
Vertretung Nürnberg              | Phone: +49-5121-206917-129 |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-9   |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2025-06-16 13:34 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-12 14:15 [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
2025-06-12 14:15 ` [PATCH net-next v2 01/10] net: fec: fix typos found by codespell Marc Kleine-Budde
2025-06-13 18:20   ` Andrew Lunn
2025-06-12 14:15 ` [PATCH net-next v2 02/10] net: fec: struct fec_enet_private: remove obsolete comment Marc Kleine-Budde
2025-06-13 18:21   ` Andrew Lunn
2025-06-12 14:15 ` [PATCH net-next v2 03/10] net: fec: add missing header files Marc Kleine-Budde
2025-06-13 18:22   ` Andrew Lunn
2025-06-12 14:15 ` [PATCH net-next v2 04/10] net: fec: rename struct fec_devinfo fec_imx6x_info -> fec_imx6sx_info Marc Kleine-Budde
2025-06-13 18:24   ` Andrew Lunn
2025-06-12 14:15 ` [PATCH net-next v2 05/10] net: fec: fec_restart(): introduce a define for FEC_ECR_SPEED Marc Kleine-Budde
2025-06-13 18:28   ` Andrew Lunn
2025-06-12 14:15 ` [PATCH net-next v2 06/10] net: fec: fec_enet_rx_queue(): use same signature as fec_enet_tx_queue() Marc Kleine-Budde
2025-06-13  6:22   ` Wei Fang
2025-06-13 18:30   ` Andrew Lunn
2025-06-12 14:16 ` [PATCH net-next v2 07/10] net: fec: fec_enet_rx_queue(): replace manual VLAN header calculation with skb_vlan_eth_hdr() Marc Kleine-Budde
2025-06-13 18:37   ` Andrew Lunn
2025-06-16  1:42     ` Wei Fang
2025-06-16 13:12       ` Andrew Lunn
2025-06-16 13:34         ` Marc Kleine-Budde
2025-06-12 14:16 ` [PATCH net-next v2 08/10] net: fec: fec_enet_rx_queue(): reduce scope of data Marc Kleine-Budde
2025-06-12 14:16 ` [PATCH net-next v2 09/10] net: fec: fec_enet_rx_queue(): move_call to _vlan_hwaccel_put_tag() Marc Kleine-Budde
2025-06-12 14:16 ` [PATCH net-next v2 10/10] net: fec: fec_enet_rx_queue(): factor out VLAN handling into separate function fec_enet_rx_vlan() Marc Kleine-Budde
2025-06-12 14:18 ` [PATCH net-next v2 00/10] net: fec: cleanups, update quirk, update IRQ naming Marc Kleine-Budde
2025-06-13  6:19   ` Wei Fang
2025-06-13  6:22     ` Marc Kleine-Budde

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