netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next 0/2] Add support for the RTL907XD-VA and fix a driver warning
@ 2024-11-11  2:55 Justin Lai
  2024-11-11  2:55 ` [PATCH net-next 1/2] rtase: Add support for RTL907XD-VA PCIe port Justin Lai
  2024-11-11  2:55 ` [PATCH net-next 2/2] rtase: Fix error code in rtase_init_one() Justin Lai
  0 siblings, 2 replies; 6+ messages in thread
From: Justin Lai @ 2024-11-11  2:55 UTC (permalink / raw)
  To: kuba
  Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
	horms, pkshih, larry.chiu, Justin Lai

This patch set includes adding support for the RTL907XD-VA. Fixing the
warning raised by the reviewer, which points out that error handling
should be implemented when rtase_check_mac_version_valid() returns an
error.

Justin Lai (2):
  rtase: Add support for RTL907XD-VA PCIe port
  rtase: Fix error code in rtase_init_one()

 drivers/net/ethernet/realtek/rtase/rtase.h    | 10 +++-
 .../net/ethernet/realtek/rtase/rtase_main.c   | 54 ++++++++++++-------
 2 files changed, 44 insertions(+), 20 deletions(-)

-- 
2.34.1


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

* [PATCH net-next 1/2] rtase: Add support for RTL907XD-VA PCIe port
  2024-11-11  2:55 [PATCH net-next 0/2] Add support for the RTL907XD-VA and fix a driver warning Justin Lai
@ 2024-11-11  2:55 ` Justin Lai
  2024-11-12 13:57   ` Simon Horman
  2024-11-11  2:55 ` [PATCH net-next 2/2] rtase: Fix error code in rtase_init_one() Justin Lai
  1 sibling, 1 reply; 6+ messages in thread
From: Justin Lai @ 2024-11-11  2:55 UTC (permalink / raw)
  To: kuba
  Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
	horms, pkshih, larry.chiu, Justin Lai

Add RTL907XD-VA hardware version and modify the speed reported by
.get_link_ksettings in ethtool_ops.

Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
 drivers/net/ethernet/realtek/rtase/rtase.h    | 10 +++++--
 .../net/ethernet/realtek/rtase/rtase_main.c   | 26 ++++++++++++++-----
 2 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h b/drivers/net/ethernet/realtek/rtase/rtase.h
index 583c33930f88..2bbfcad613ab 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase.h
+++ b/drivers/net/ethernet/realtek/rtase/rtase.h
@@ -9,7 +9,11 @@
 #ifndef RTASE_H
 #define RTASE_H
 
-#define RTASE_HW_VER_MASK 0x7C800000
+#define RTASE_HW_VER_MASK     0x7C800000
+#define RTASE_HW_VER_906X_7XA 0x00800000
+#define RTASE_HW_VER_906X_7XC 0x04000000
+#define RTASE_HW_VER_907XD_V1 0x04800000
+#define RTASE_HW_VER_907XD_VA 0x08000000
 
 #define RTASE_RX_DMA_BURST_256       4
 #define RTASE_TX_DMA_BURST_UNLIMITED 7
@@ -170,7 +174,7 @@ enum rtase_registers {
 	RTASE_INT_MITI_TX = 0x0A00,
 	RTASE_INT_MITI_RX = 0x0A80,
 
-	RTASE_VLAN_ENTRY_0     = 0xAC80,
+	RTASE_VLAN_ENTRY_0 = 0xAC80,
 };
 
 enum rtase_desc_status_bit {
@@ -327,6 +331,8 @@ struct rtase_private {
 	u16 int_nums;
 	u16 tx_int_mit;
 	u16 rx_int_mit;
+
+	u32 hw_ver;
 };
 
 #define RTASE_LSO_64K 64000
diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index f8777b7663d3..73ebdf0bc376 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -1714,10 +1714,22 @@ static int rtase_get_settings(struct net_device *dev,
 			      struct ethtool_link_ksettings *cmd)
 {
 	u32 supported = SUPPORTED_MII | SUPPORTED_Pause | SUPPORTED_Asym_Pause;
+	const struct rtase_private *tp = netdev_priv(dev);
 
 	ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
 						supported);
-	cmd->base.speed = SPEED_5000;
+
+	switch (tp->hw_ver) {
+	case RTASE_HW_VER_906X_7XA:
+	case RTASE_HW_VER_906X_7XC:
+		cmd->base.speed = SPEED_5000;
+		break;
+	case RTASE_HW_VER_907XD_V1:
+	case RTASE_HW_VER_907XD_VA:
+		cmd->base.speed = SPEED_10000;
+		break;
+	}
+
 	cmd->base.duplex = DUPLEX_FULL;
 	cmd->base.port = PORT_MII;
 	cmd->base.autoneg = AUTONEG_DISABLE;
@@ -1974,13 +1986,15 @@ static void rtase_init_software_variable(struct pci_dev *pdev,
 
 static bool rtase_check_mac_version_valid(struct rtase_private *tp)
 {
-	u32 hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK;
 	bool known_ver = false;
 
-	switch (hw_ver) {
-	case 0x00800000:
-	case 0x04000000:
-	case 0x04800000:
+	tp->hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK;
+
+	switch (tp->hw_ver) {
+	case RTASE_HW_VER_906X_7XA:
+	case RTASE_HW_VER_906X_7XC:
+	case RTASE_HW_VER_907XD_V1:
+	case RTASE_HW_VER_907XD_VA:
 		known_ver = true;
 		break;
 	}
-- 
2.34.1


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

* [PATCH net-next 2/2] rtase: Fix error code in rtase_init_one()
  2024-11-11  2:55 [PATCH net-next 0/2] Add support for the RTL907XD-VA and fix a driver warning Justin Lai
  2024-11-11  2:55 ` [PATCH net-next 1/2] rtase: Add support for RTL907XD-VA PCIe port Justin Lai
@ 2024-11-11  2:55 ` Justin Lai
  2024-11-12 13:40   ` Simon Horman
  1 sibling, 1 reply; 6+ messages in thread
From: Justin Lai @ 2024-11-11  2:55 UTC (permalink / raw)
  To: kuba
  Cc: davem, edumazet, pabeni, andrew+netdev, linux-kernel, netdev,
	horms, pkshih, larry.chiu, Justin Lai

Change the return type of rtase_check_mac_version_valid() to int. Add
error handling for when rtase_check_mac_version_valid() returns an error.

Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module")
Signed-off-by: Justin Lai <justinlai0215@realtek.com>
---
 .../net/ethernet/realtek/rtase/rtase_main.c   | 28 +++++++++++--------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
index 73ebdf0bc376..ba1d376d2319 100644
--- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
+++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
@@ -1984,9 +1984,9 @@ static void rtase_init_software_variable(struct pci_dev *pdev,
 	tp->dev->max_mtu = RTASE_MAX_JUMBO_SIZE;
 }
 
-static bool rtase_check_mac_version_valid(struct rtase_private *tp)
+static int rtase_check_mac_version_valid(struct rtase_private *tp)
 {
-	bool known_ver = false;
+	int ret = -ENODEV;
 
 	tp->hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK;
 
@@ -1995,11 +1995,11 @@ static bool rtase_check_mac_version_valid(struct rtase_private *tp)
 	case RTASE_HW_VER_906X_7XC:
 	case RTASE_HW_VER_907XD_V1:
 	case RTASE_HW_VER_907XD_VA:
-		known_ver = true;
+		ret = 0;
 		break;
 	}
 
-	return known_ver;
+	return ret;
 }
 
 static int rtase_init_board(struct pci_dev *pdev, struct net_device **dev_out,
@@ -2119,9 +2119,12 @@ static int rtase_init_one(struct pci_dev *pdev,
 	tp->pdev = pdev;
 
 	/* identify chip attached to board */
-	if (!rtase_check_mac_version_valid(tp))
-		return dev_err_probe(&pdev->dev, -ENODEV,
-				     "unknown chip version, contact rtase maintainers (see MAINTAINERS file)\n");
+	ret = rtase_check_mac_version_valid(tp);
+	if (ret != 0) {
+		dev_err(&pdev->dev,
+			"unknown chip version, contact rtase maintainers (see MAINTAINERS file)\n");
+		goto err_out_release_board;
+	}
 
 	rtase_init_software_variable(pdev, tp);
 	rtase_init_hardware(tp);
@@ -2129,7 +2132,7 @@ static int rtase_init_one(struct pci_dev *pdev,
 	ret = rtase_alloc_interrupt(pdev, tp);
 	if (ret < 0) {
 		dev_err(&pdev->dev, "unable to alloc MSIX/MSI\n");
-		goto err_out_1;
+		goto err_out_del_napi;
 	}
 
 	rtase_init_netdev_ops(dev);
@@ -2162,7 +2165,7 @@ static int rtase_init_one(struct pci_dev *pdev,
 					     GFP_KERNEL);
 	if (!tp->tally_vaddr) {
 		ret = -ENOMEM;
-		goto err_out;
+		goto err_out_free_dma;
 	}
 
 	rtase_tally_counter_clear(tp);
@@ -2173,13 +2176,13 @@ static int rtase_init_one(struct pci_dev *pdev,
 
 	ret = register_netdev(dev);
 	if (ret != 0)
-		goto err_out;
+		goto err_out_free_dma;
 
 	netdev_dbg(dev, "%pM, IRQ %d\n", dev->dev_addr, dev->irq);
 
 	return 0;
 
-err_out:
+err_out_free_dma:
 	if (tp->tally_vaddr) {
 		dma_free_coherent(&pdev->dev,
 				  sizeof(*tp->tally_vaddr),
@@ -2189,12 +2192,13 @@ static int rtase_init_one(struct pci_dev *pdev,
 		tp->tally_vaddr = NULL;
 	}
 
-err_out_1:
+err_out_del_napi:
 	for (i = 0; i < tp->int_nums; i++) {
 		ivec = &tp->int_vector[i];
 		netif_napi_del(&ivec->napi);
 	}
 
+err_out_release_board:
 	rtase_release_board(pdev, dev, ioaddr);
 
 	return ret;
-- 
2.34.1


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

* Re: [PATCH net-next 2/2] rtase: Fix error code in rtase_init_one()
  2024-11-11  2:55 ` [PATCH net-next 2/2] rtase: Fix error code in rtase_init_one() Justin Lai
@ 2024-11-12 13:40   ` Simon Horman
  0 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2024-11-12 13:40 UTC (permalink / raw)
  To: Justin Lai
  Cc: kuba, davem, edumazet, pabeni, andrew+netdev, linux-kernel,
	netdev, pkshih, larry.chiu

On Mon, Nov 11, 2024 at 10:55:32AM +0800, Justin Lai wrote:
> Change the return type of rtase_check_mac_version_valid() to int. Add
> error handling for when rtase_check_mac_version_valid() returns an error.
> 
> Fixes: a36e9f5cfe9e ("rtase: Add support for a pci table in this module")
> Signed-off-by: Justin Lai <justinlai0215@realtek.com>

Hi Justin,

The cited commit appears to be present in net. So I think that this fix
needs to also be targeted at net rather than net-next.

Also, I think this patch is doing too much for a fix.  I think that
changing the return type of rtase_check_mac_version_valid() and updating
the names of the labels should be omitted from a revised version of this
patch for net.

...

-- 
pw-bot: changes-requested

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

* Re: [PATCH net-next 1/2] rtase: Add support for RTL907XD-VA PCIe port
  2024-11-11  2:55 ` [PATCH net-next 1/2] rtase: Add support for RTL907XD-VA PCIe port Justin Lai
@ 2024-11-12 13:57   ` Simon Horman
  2024-11-14  4:01     ` Justin Lai
  0 siblings, 1 reply; 6+ messages in thread
From: Simon Horman @ 2024-11-12 13:57 UTC (permalink / raw)
  To: Justin Lai
  Cc: kuba, davem, edumazet, pabeni, andrew+netdev, linux-kernel,
	netdev, pkshih, larry.chiu

On Mon, Nov 11, 2024 at 10:55:31AM +0800, Justin Lai wrote:
> Add RTL907XD-VA hardware version and modify the speed reported by
> .get_link_ksettings in ethtool_ops.
> 
> Signed-off-by: Justin Lai <justinlai0215@realtek.com>

Hi Justin,

this seems to be doing several things:

1) Adding defines for existing values
2) Correcting the speed for RTL907XD-V1
3) Adding support for RTL907XD-VA

I think these would be best handled as 3 patches.
And I wonder if 2) is a bug fix for net rather than an
enhancement for net-next.

> ---
>  drivers/net/ethernet/realtek/rtase/rtase.h    | 10 +++++--
>  .../net/ethernet/realtek/rtase/rtase_main.c   | 26 ++++++++++++++-----
>  2 files changed, 28 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h b/drivers/net/ethernet/realtek/rtase/rtase.h
> index 583c33930f88..2bbfcad613ab 100644
> --- a/drivers/net/ethernet/realtek/rtase/rtase.h
> +++ b/drivers/net/ethernet/realtek/rtase/rtase.h
> @@ -9,7 +9,11 @@
>  #ifndef RTASE_H
>  #define RTASE_H
>  
> -#define RTASE_HW_VER_MASK 0x7C800000
> +#define RTASE_HW_VER_MASK     0x7C800000
> +#define RTASE_HW_VER_906X_7XA 0x00800000
> +#define RTASE_HW_VER_906X_7XC 0x04000000
> +#define RTASE_HW_VER_907XD_V1 0x04800000
> +#define RTASE_HW_VER_907XD_VA 0x08000000
>  
>  #define RTASE_RX_DMA_BURST_256       4
>  #define RTASE_TX_DMA_BURST_UNLIMITED 7
> @@ -170,7 +174,7 @@ enum rtase_registers {
>  	RTASE_INT_MITI_TX = 0x0A00,
>  	RTASE_INT_MITI_RX = 0x0A80,
>  
> -	RTASE_VLAN_ENTRY_0     = 0xAC80,
> +	RTASE_VLAN_ENTRY_0 = 0xAC80,

This change doesn't seem related to the rest of the patch.

>  };
>  
>  enum rtase_desc_status_bit {
> @@ -327,6 +331,8 @@ struct rtase_private {
>  	u16 int_nums;
>  	u16 tx_int_mit;
>  	u16 rx_int_mit;
> +
> +	u32 hw_ver;
>  };
>  
>  #define RTASE_LSO_64K 64000
> diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> index f8777b7663d3..73ebdf0bc376 100644
> --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> @@ -1714,10 +1714,22 @@ static int rtase_get_settings(struct net_device *dev,
>  			      struct ethtool_link_ksettings *cmd)
>  {
>  	u32 supported = SUPPORTED_MII | SUPPORTED_Pause | SUPPORTED_Asym_Pause;
> +	const struct rtase_private *tp = netdev_priv(dev);
>  
>  	ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
>  						supported);
> -	cmd->base.speed = SPEED_5000;
> +
> +	switch (tp->hw_ver) {
> +	case RTASE_HW_VER_906X_7XA:
> +	case RTASE_HW_VER_906X_7XC:
> +		cmd->base.speed = SPEED_5000;
> +		break;
> +	case RTASE_HW_VER_907XD_V1:
> +	case RTASE_HW_VER_907XD_VA:
> +		cmd->base.speed = SPEED_10000;
> +		break;
> +	}
> +
>  	cmd->base.duplex = DUPLEX_FULL;
>  	cmd->base.port = PORT_MII;
>  	cmd->base.autoneg = AUTONEG_DISABLE;

> @@ -1974,13 +1986,15 @@ static void rtase_init_software_variable(struct pci_dev *pdev,
>  
>  static bool rtase_check_mac_version_valid(struct rtase_private *tp)
>  {
> -	u32 hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK;
>  	bool known_ver = false;
>  
> -	switch (hw_ver) {
> -	case 0x00800000:
> -	case 0x04000000:
> -	case 0x04800000:
> +	tp->hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) & RTASE_HW_VER_MASK;

Now that this is setting tp->hw_ver perhaps the name of the function should
be changed? Perhaps rtase_set_mac_version() ? Perhaps a single patch can be
created that reworks this function, preparing for other work, by:

* Changes the name of the function
* Sets tp->hw_ver
* Changes the return type from bool to int
  (as is currently done as part of patch 2/2)

Although a refactor, perhaps that could be part of a series for net that
also includes two more patches that depend on it and:

* Correct the speed for RTL907XD-V1
* Corrects error handling in the case where the version is invalid
  (as is currently done as part of patch 2/2)

And then any remaning enhancements can be addressed as follow-up
patches for net-next.


> +
> +	switch (tp->hw_ver) {
> +	case RTASE_HW_VER_906X_7XA:
> +	case RTASE_HW_VER_906X_7XC:
> +	case RTASE_HW_VER_907XD_V1:
> +	case RTASE_HW_VER_907XD_VA:
>  		known_ver = true;
>  		break;
>  	}
> -- 
> 2.34.1
> 

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

* RE: [PATCH net-next 1/2] rtase: Add support for RTL907XD-VA PCIe port
  2024-11-12 13:57   ` Simon Horman
@ 2024-11-14  4:01     ` Justin Lai
  0 siblings, 0 replies; 6+ messages in thread
From: Justin Lai @ 2024-11-14  4:01 UTC (permalink / raw)
  To: Simon Horman
  Cc: kuba@kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	Ping-Ke Shih, Larry Chiu

> 
> On Mon, Nov 11, 2024 at 10:55:31AM +0800, Justin Lai wrote:
> > Add RTL907XD-VA hardware version and modify the speed reported by
> > .get_link_ksettings in ethtool_ops.
> >
> > Signed-off-by: Justin Lai <justinlai0215@realtek.com>
> 
> Hi Justin,
> 
> this seems to be doing several things:
> 
> 1) Adding defines for existing values
> 2) Correcting the speed for RTL907XD-V1
> 3) Adding support for RTL907XD-VA
> 
> I think these would be best handled as 3 patches.
> And I wonder if 2) is a bug fix for net rather than an enhancement for net-next.

Ok, I'll try to break down the patch into more detailed parts to 
make it clearer.
> 
> > ---
> >  drivers/net/ethernet/realtek/rtase/rtase.h    | 10 +++++--
> >  .../net/ethernet/realtek/rtase/rtase_main.c   | 26 ++++++++++++++-----
> >  2 files changed, 28 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/realtek/rtase/rtase.h
> > b/drivers/net/ethernet/realtek/rtase/rtase.h
> > index 583c33930f88..2bbfcad613ab 100644
> > --- a/drivers/net/ethernet/realtek/rtase/rtase.h
> > +++ b/drivers/net/ethernet/realtek/rtase/rtase.h
> > @@ -9,7 +9,11 @@
> >  #ifndef RTASE_H
> >  #define RTASE_H
> >
> > -#define RTASE_HW_VER_MASK 0x7C800000
> > +#define RTASE_HW_VER_MASK     0x7C800000
> > +#define RTASE_HW_VER_906X_7XA 0x00800000 #define
> > +RTASE_HW_VER_906X_7XC 0x04000000 #define
> RTASE_HW_VER_907XD_V1
> > +0x04800000 #define RTASE_HW_VER_907XD_VA 0x08000000
> >
> >  #define RTASE_RX_DMA_BURST_256       4
> >  #define RTASE_TX_DMA_BURST_UNLIMITED 7 @@ -170,7 +174,7 @@
> enum
> > rtase_registers {
> >       RTASE_INT_MITI_TX = 0x0A00,
> >       RTASE_INT_MITI_RX = 0x0A80,
> >
> > -     RTASE_VLAN_ENTRY_0     = 0xAC80,
> > +     RTASE_VLAN_ENTRY_0 = 0xAC80,
> 
> This change doesn't seem related to the rest of the patch.

I'll separate this into an additional patch and upload it.
> 
> >  };
> >
> >  enum rtase_desc_status_bit {
> > @@ -327,6 +331,8 @@ struct rtase_private {
> >       u16 int_nums;
> >       u16 tx_int_mit;
> >       u16 rx_int_mit;
> > +
> > +     u32 hw_ver;
> >  };
> >
> >  #define RTASE_LSO_64K 64000
> > diff --git a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > index f8777b7663d3..73ebdf0bc376 100644
> > --- a/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > +++ b/drivers/net/ethernet/realtek/rtase/rtase_main.c
> > @@ -1714,10 +1714,22 @@ static int rtase_get_settings(struct net_device
> *dev,
> >                             struct ethtool_link_ksettings *cmd)  {
> >       u32 supported = SUPPORTED_MII | SUPPORTED_Pause |
> > SUPPORTED_Asym_Pause;
> > +     const struct rtase_private *tp = netdev_priv(dev);
> >
> >
> ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
> >                                               supported);
> > -     cmd->base.speed = SPEED_5000;
> > +
> > +     switch (tp->hw_ver) {
> > +     case RTASE_HW_VER_906X_7XA:
> > +     case RTASE_HW_VER_906X_7XC:
> > +             cmd->base.speed = SPEED_5000;
> > +             break;
> > +     case RTASE_HW_VER_907XD_V1:
> > +     case RTASE_HW_VER_907XD_VA:
> > +             cmd->base.speed = SPEED_10000;
> > +             break;
> > +     }
> > +
> >       cmd->base.duplex = DUPLEX_FULL;
> >       cmd->base.port = PORT_MII;
> >       cmd->base.autoneg = AUTONEG_DISABLE;
> 
> > @@ -1974,13 +1986,15 @@ static void
> > rtase_init_software_variable(struct pci_dev *pdev,
> >
> >  static bool rtase_check_mac_version_valid(struct rtase_private *tp)
> > {
> > -     u32 hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) &
> RTASE_HW_VER_MASK;
> >       bool known_ver = false;
> >
> > -     switch (hw_ver) {
> > -     case 0x00800000:
> > -     case 0x04000000:
> > -     case 0x04800000:
> > +     tp->hw_ver = rtase_r32(tp, RTASE_TX_CONFIG_0) &
> > + RTASE_HW_VER_MASK;
> 
> Now that this is setting tp->hw_ver perhaps the name of the function should be
> changed? Perhaps rtase_set_mac_version() ? Perhaps a single patch can be
> created that reworks this function, preparing for other work, by:
> 
> * Changes the name of the function
> * Sets tp->hw_ver
> * Changes the return type from bool to int
>   (as is currently done as part of patch 2/2)

This function is not simply used to set tp->hw_ver. Its primary purpose
is to validate the MAC version. Since hw_ver is also used elsewhere, it
is stored in tp->hw_ver. Therefore, I don't believe the function name
needs to be changed. However, I will group the remaining two items into
a separate patch and include it in this patch set.
> 
> Although a refactor, perhaps that could be part of a series for net that also
> includes two more patches that depend on it and:
> 
> * Correct the speed for RTL907XD-V1
> * Corrects error handling in the case where the version is invalid
>   (as is currently done as part of patch 2/2)

Thank you for your valuable suggestions. I will upload the three patches
as discussed to the net.
> 
> And then any remaning enhancements can be addressed as follow-up patches
> for net-next.

Ok, I will do that.
> 
> 
> > +
> > +     switch (tp->hw_ver) {
> > +     case RTASE_HW_VER_906X_7XA:
> > +     case RTASE_HW_VER_906X_7XC:
> > +     case RTASE_HW_VER_907XD_V1:
> > +     case RTASE_HW_VER_907XD_VA:
> >               known_ver = true;
> >               break;
> >       }
> > --
> > 2.34.1
> >

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

end of thread, other threads:[~2024-11-14  4:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11  2:55 [PATCH net-next 0/2] Add support for the RTL907XD-VA and fix a driver warning Justin Lai
2024-11-11  2:55 ` [PATCH net-next 1/2] rtase: Add support for RTL907XD-VA PCIe port Justin Lai
2024-11-12 13:57   ` Simon Horman
2024-11-14  4:01     ` Justin Lai
2024-11-11  2:55 ` [PATCH net-next 2/2] rtase: Fix error code in rtase_init_one() Justin Lai
2024-11-12 13:40   ` Simon Horman

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