diff mbox series

[net-next,10/13] ravb: Factorise ravb_set_features

Message ID 20210825070154.14336-11-biju.das.jz@bp.renesas.com (mailing list archive)
State Mainlined
Commit 80f35a0df0866ad0eb88575bbdeba6c81123c20b
Delegated to: Geert Uytterhoeven
Headers show
Series Add Factorisation code to support Gigabit Ethernet driver | expand

Commit Message

Biju Das Aug. 25, 2021, 7:01 a.m. UTC
RZ/G2L supports HW checksum on RX and TX whereas R-Car supports on RX.
Factorise ravb_set_features to support this feature.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 15 +++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

Comments

Sergey Shtylyov Aug. 27, 2021, 7:16 p.m. UTC | #1
On 8/25/21 10:01 AM, Biju Das wrote:

> RZ/G2L supports HW checksum on RX and TX whereas R-Car supports on RX.
> Factorise ravb_set_features to support this feature.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> ---
>  drivers/net/ethernet/renesas/ravb.h      |  1 +
>  drivers/net/ethernet/renesas/ravb_main.c | 15 +++++++++++++--
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
[...]
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 1f9d9f54bf1b..1789309c4c03 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -1901,8 +1901,8 @@ static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
>  	spin_unlock_irqrestore(&priv->lock, flags);
>  }
>  
> -static int ravb_set_features(struct net_device *ndev,
> -			     netdev_features_t features)
> +static int ravb_set_features_rx_csum(struct net_device *ndev,
> +				     netdev_features_t features)

   How about ravb_set_features_rcar() or s/th alike?

[...]

   Other than that:

Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
   Let's see the TOC code now...

MBR, Sergey
Biju Das Aug. 28, 2021, 9:20 a.m. UTC | #2
> -----Original Message-----
> From: Sergey Shtylyov <s.shtylyov@omp.ru>
> Sent: 27 August 2021 20:17
> To: Biju Das <biju.das.jz@bp.renesas.com>; David S. Miller
> <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>
> Cc: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>;
> Andrew Lunn <andrew@lunn.ch>; Sergei Shtylyov <sergei.shtylyov@gmail.com>;
> Geert Uytterhoeven <geert+renesas@glider.be>; Adam Ford
> <aford173@gmail.com>; Yoshihiro Shimoda
> <yoshihiro.shimoda.uh@renesas.com>; netdev@vger.kernel.org; linux-renesas-
> soc@vger.kernel.org; Chris Paterson <Chris.Paterson2@renesas.com>; Biju
> Das <biju.das@bp.renesas.com>
> Subject: Re: [PATCH net-next 10/13] ravb: Factorise ravb_set_features
> 
> On 8/25/21 10:01 AM, Biju Das wrote:
> 
> > RZ/G2L supports HW checksum on RX and TX whereas R-Car supports on RX.
> > Factorise ravb_set_features to support this feature.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > ---
> >  drivers/net/ethernet/renesas/ravb.h      |  1 +
> >  drivers/net/ethernet/renesas/ravb_main.c | 15 +++++++++++++--
> >  2 files changed, 14 insertions(+), 2 deletions(-)
> >
> [...]
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> > b/drivers/net/ethernet/renesas/ravb_main.c
> > index 1f9d9f54bf1b..1789309c4c03 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -1901,8 +1901,8 @@ static void ravb_set_rx_csum(struct net_device
> *ndev, bool enable)
> >  	spin_unlock_irqrestore(&priv->lock, flags);  }
> >
> > -static int ravb_set_features(struct net_device *ndev,
> > -			     netdev_features_t features)
> > +static int ravb_set_features_rx_csum(struct net_device *ndev,
> > +				     netdev_features_t features)
> 
>    How about ravb_set_features_rcar() or s/th alike?

What about

ravb_rcar_set_features_csum()?

and

ravb_rgeth_set_features_csum()?


If you are ok with this name change I will incorporate this changes in next - RFC patchset?

If you still want ravb_set_features_rcar() and ravb_set_features_rgeth(), I am ok with that as well.

Please let me know, which name you like.

Regards,
Biju



> [...]
> 
>    Other than that:
> 
> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru>
>    Let's see the TOC code now...
> 
> MBR, Sergey
Sergey Shtylyov Aug. 28, 2021, 11:35 a.m. UTC | #3
On 28.08.2021 12:20, Biju Das wrote:

[...]
>>> RZ/G2L supports HW checksum on RX and TX whereas R-Car supports on RX.
>>> Factorise ravb_set_features to support this feature.
>>>
>>> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
>>> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>>> ---
>>>   drivers/net/ethernet/renesas/ravb.h      |  1 +
>>>   drivers/net/ethernet/renesas/ravb_main.c | 15 +++++++++++++--
>>>   2 files changed, 14 insertions(+), 2 deletions(-)
>>>
>> [...]
>>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
>>> b/drivers/net/ethernet/renesas/ravb_main.c
>>> index 1f9d9f54bf1b..1789309c4c03 100644
>>> --- a/drivers/net/ethernet/renesas/ravb_main.c
>>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
>>> @@ -1901,8 +1901,8 @@ static void ravb_set_rx_csum(struct net_device
>> *ndev, bool enable)
>>>   	spin_unlock_irqrestore(&priv->lock, flags);  }
>>>
>>> -static int ravb_set_features(struct net_device *ndev,
>>> -			     netdev_features_t features)
>>> +static int ravb_set_features_rx_csum(struct net_device *ndev,
>>> +				     netdev_features_t features)
>>
>>     How about ravb_set_features_rcar() or s/th alike?
> 
> What about
> 
> ravb_rcar_set_features_csum()?
> 
> and
> 
> ravb_rgeth_set_features_csum()?
 >
> If you are ok with this name change I will incorporate this changes in next - RFC patchset?
> 
> If you still want ravb_set_features_rcar() and ravb_set_features_rgeth(), I am ok with that as well.
> 
> Please let me know, which name you like.

    Looking back at sh_eth, my variant seems to fit better...

> Regards,
> Biju

[...]

MBR, Sergey
Biju Das Aug. 28, 2021, 12:45 p.m. UTC | #4
Hi Sergei,

> Subject: Re: [PATCH net-next 10/13] ravb: Factorise ravb_set_features
> 
> On 28.08.2021 12:20, Biju Das wrote:
> 
> [...]
> >>> RZ/G2L supports HW checksum on RX and TX whereas R-Car supports on RX.
> >>> Factorise ravb_set_features to support this feature.
> >>>
> >>> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> >>> Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >>> ---
> >>>   drivers/net/ethernet/renesas/ravb.h      |  1 +
> >>>   drivers/net/ethernet/renesas/ravb_main.c | 15 +++++++++++++--
> >>>   2 files changed, 14 insertions(+), 2 deletions(-)
> >>>
> >> [...]
> >>> diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> >>> b/drivers/net/ethernet/renesas/ravb_main.c
> >>> index 1f9d9f54bf1b..1789309c4c03 100644
> >>> --- a/drivers/net/ethernet/renesas/ravb_main.c
> >>> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> >>> @@ -1901,8 +1901,8 @@ static void ravb_set_rx_csum(struct net_device
> >> *ndev, bool enable)
> >>>   	spin_unlock_irqrestore(&priv->lock, flags);  }
> >>>
> >>> -static int ravb_set_features(struct net_device *ndev,
> >>> -			     netdev_features_t features)
> >>> +static int ravb_set_features_rx_csum(struct net_device *ndev,
> >>> +				     netdev_features_t features)
> >>
> >>     How about ravb_set_features_rcar() or s/th alike?
> >
> > What about
> >
> > ravb_rcar_set_features_csum()?
> >
> > and
> >
> > ravb_rgeth_set_features_csum()?
>  >
> > If you are ok with this name change I will incorporate this changes in
> next - RFC patchset?
> >
> > If you still want ravb_set_features_rcar() and
> ravb_set_features_rgeth(), I am ok with that as well.
> >
> > Please let me know, which name you like.
> 
>     Looking back at sh_eth, my variant seems to fit better...

OK, will take care this name change in next RFC- patchset which includes RZ/G2L support.

Regards,
Biju
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 9879690c5cd8..9e284238ed83 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -985,6 +985,7 @@  struct ravb_hw_info {
 	void *(*alloc_rx_desc)(struct net_device *ndev, int q);
 	bool (*receive)(struct net_device *ndev, int *quota, int q);
 	void (*set_rate)(struct net_device *ndev);
+	int (*set_rx_csum_feature)(struct net_device *ndev, netdev_features_t features);
 	const char (*gstrings_stats)[ETH_GSTRING_LEN];
 	size_t gstrings_size;
 	netdev_features_t net_hw_features;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 1f9d9f54bf1b..1789309c4c03 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1901,8 +1901,8 @@  static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-static int ravb_set_features(struct net_device *ndev,
-			     netdev_features_t features)
+static int ravb_set_features_rx_csum(struct net_device *ndev,
+				     netdev_features_t features)
 {
 	netdev_features_t changed = ndev->features ^ features;
 
@@ -1914,6 +1914,15 @@  static int ravb_set_features(struct net_device *ndev,
 	return 0;
 }
 
+static int ravb_set_features(struct net_device *ndev,
+			     netdev_features_t features)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_hw_info *info = priv->info;
+
+	return info->set_rx_csum_feature(ndev, features);
+}
+
 static const struct net_device_ops ravb_netdev_ops = {
 	.ndo_open		= ravb_open,
 	.ndo_stop		= ravb_close,
@@ -1980,6 +1989,7 @@  static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.alloc_rx_desc = ravb_alloc_rx_desc,
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
+	.set_rx_csum_feature = ravb_set_features_rx_csum,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
 	.net_hw_features = NETIF_F_RXCSUM,
@@ -1998,6 +2008,7 @@  static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.alloc_rx_desc = ravb_alloc_rx_desc,
 	.receive = ravb_rcar_rx,
 	.set_rate = ravb_set_rate,
+	.set_rx_csum_feature = ravb_set_features_rx_csum,
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
 	.net_hw_features = NETIF_F_RXCSUM,