Message ID | 20210825070154.14336-9-biju.das.jz@bp.renesas.com |
---|---|
State | New |
Headers | show |
Series | Add Factorisation code to support Gigabit Ethernet driver | expand |
On 8/25/21 10:01 AM, Biju Das wrote: > R-Car uses an extended descriptor in RX whereas, RZ/G2L uses > normal descriptor in RX. Factorise the ravb_rx function to > support the later SoC. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> [...] > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index 148c974499b4..1cace5324261 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c > @@ -562,8 +562,7 @@ static void ravb_rx_csum(struct sk_buff *skb) > skb_trim(skb, skb->len - sizeof(__sum16)); > } > > -/* Packet receive function for Ethernet AVB */ > -static bool ravb_rx(struct net_device *ndev, int *quota, int q) > +static bool ravb_rcar_rx(struct net_device *ndev, int *quota, int q) Mhm, isn't this too large a function to duplicate it all for RZ-G2? [...] MBR, Sergey
Hi Sergei, > Subject: Re: [PATCH net-next 08/13] ravb: Factorise ravb_rx function > > On 8/25/21 10:01 AM, Biju Das wrote: > > > R-Car uses an extended descriptor in RX whereas, RZ/G2L uses normal > > descriptor in RX. Factorise the ravb_rx function to support the later > > SoC. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > [...] > > diff --git a/drivers/net/ethernet/renesas/ravb_main.c > > b/drivers/net/ethernet/renesas/ravb_main.c > > index 148c974499b4..1cace5324261 100644 > > --- a/drivers/net/ethernet/renesas/ravb_main.c > > +++ b/drivers/net/ethernet/renesas/ravb_main.c > > @@ -562,8 +562,7 @@ static void ravb_rx_csum(struct sk_buff *skb) > > skb_trim(skb, skb->len - sizeof(__sum16)); } > > > > -/* Packet receive function for Ethernet AVB */ -static bool > > ravb_rx(struct net_device *ndev, int *quota, int q) > > +static bool ravb_rcar_rx(struct net_device *ndev, int *quota, int q) > > Mhm, isn't this too large a function to duplicate it all for RZ-G2? For your reference, it is a large change. See [1]. [1] https://patchwork.kernel.org/project/linux-renesas-soc/patch/20210722141351.13668-18-biju.das.jz@bp.renesas.com/ Currently I am working on the name change and next RFC patchset for started adding Initial support for RZ/G2. I am expecting your valuable suggestion on that granular RFC Patch for RZ/G2(ravb_rx) function. Regards, Biju > > [...] > > MBR, Sergey
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 39df045b1a0b..00f2d67b4dad 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -983,6 +983,7 @@ struct ravb_hw_info { void (*rx_ring_free)(struct net_device *ndev, int q); void (*rx_ring_format)(struct net_device *ndev, int q); void *(*alloc_rx_desc)(struct net_device *ndev, int q); + bool (*receive)(struct net_device *ndev, int *quota, int q); 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 148c974499b4..1cace5324261 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -562,8 +562,7 @@ static void ravb_rx_csum(struct sk_buff *skb) skb_trim(skb, skb->len - sizeof(__sum16)); } -/* Packet receive function for Ethernet AVB */ -static bool ravb_rx(struct net_device *ndev, int *quota, int q) +static bool ravb_rcar_rx(struct net_device *ndev, int *quota, int q) { struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; @@ -677,6 +676,15 @@ static bool ravb_rx(struct net_device *ndev, int *quota, int q) return boguscnt <= 0; } +/* Packet receive function for Ethernet AVB */ +static bool ravb_rx(struct net_device *ndev, int *quota, int q) +{ + struct ravb_private *priv = netdev_priv(ndev); + const struct ravb_hw_info *info = priv->info; + + return info->receive(ndev, quota, q); +} + static void ravb_rcv_snd_disable(struct net_device *ndev) { /* Disable TX and RX */ @@ -1969,6 +1977,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { .rx_ring_free = ravb_rx_ring_free, .rx_ring_format = ravb_rx_ring_format, .alloc_rx_desc = ravb_alloc_rx_desc, + .receive = ravb_rcar_rx, .gstrings_stats = ravb_gstrings_stats, .gstrings_size = sizeof(ravb_gstrings_stats), .net_hw_features = NETIF_F_RXCSUM, @@ -1985,6 +1994,7 @@ static const struct ravb_hw_info ravb_gen2_hw_info = { .rx_ring_free = ravb_rx_ring_free, .rx_ring_format = ravb_rx_ring_format, .alloc_rx_desc = ravb_alloc_rx_desc, + .receive = ravb_rcar_rx, .gstrings_stats = ravb_gstrings_stats, .gstrings_size = sizeof(ravb_gstrings_stats), .net_hw_features = NETIF_F_RXCSUM,