Message ID | 20211005110642.3744-5-biju.das.jz@bp.renesas.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Add functional support for Gigabit Ethernet driver | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Series has a cover letter |
netdev/fixes_present | success | Fixes tag not required for -next series |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Guessed tree name to be net-next |
netdev/subject_prefix | warning | Target tree name not specified in the subject |
netdev/cc_maintainers | warning | 1 maintainers not CCed: s.shtylyov@omp.ru |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Signed-off-by tag matches author and committer |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | No Fixes tag |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 71 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | No static functions without inline keyword in header files |
On 10/5/21 2:06 PM, Biju Das wrote: > Fillup ravb_alloc_rx_desc_gbeth() function to support RZ/G2L. > > This patch also renames ravb_alloc_rx_desc to ravb_alloc_rx_desc_rcar > to be consistent with the naming convention used in sh_eth driver. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> [...] Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> [...] > diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c > index 37f50c041114..31de4e544525 100644 > --- a/drivers/net/ethernet/renesas/ravb_main.c > +++ b/drivers/net/ethernet/renesas/ravb_main.c [...] > -static void *ravb_alloc_rx_desc(struct net_device *ndev, int q) > +static void *ravb_alloc_rx_desc_rcar(struct net_device *ndev, int q) > { > struct ravb_private *priv = netdev_priv(ndev); > unsigned int ring_size; > @@ -1085,16 +1092,25 @@ static int ravb_poll(struct napi_struct *napi, int budget) > struct net_device *ndev = napi->dev; > struct ravb_private *priv = netdev_priv(ndev); > const struct ravb_hw_info *info = priv->info; > + bool gptp = info->gptp || info->ccc_gac; > + struct ravb_rx_desc *desc; > unsigned long flags; > int q = napi - priv->napi; > int mask = BIT(q); > int quota = budget; > + unsigned int entry; > > + if (!gptp) { > + entry = priv->cur_rx[q] % priv->num_rx_ring[q]; > + desc = &priv->gbeth_rx_ring[entry]; > + } > /* Processing RX Descriptor Ring */ > /* Clear RX interrupt */ > ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); > - if (ravb_rx(ndev, "a, q)) > - goto out; > + if (gptp || desc->die_dt != DT_FEMPTY) { > + if (ravb_rx(ndev, "a, q)) > + goto out; > + } Not sure I understand this new logic around the ravb_rx() call, care to explain? [...] MBR, Sergey
Hi Sergey, > Subject: Re: [RFC 04/12] ravb: Fillup ravb_alloc_rx_desc_gbeth() stub > > On 10/5/21 2:06 PM, Biju Das wrote: > > > Fillup ravb_alloc_rx_desc_gbeth() function to support RZ/G2L. > > > > This patch also renames ravb_alloc_rx_desc to ravb_alloc_rx_desc_rcar > > to be consistent with the naming convention used in sh_eth driver. > > > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > > Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > [...] > > Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> > > [...] > > diff --git a/drivers/net/ethernet/renesas/ravb_main.c > > b/drivers/net/ethernet/renesas/ravb_main.c > > index 37f50c041114..31de4e544525 100644 > > --- a/drivers/net/ethernet/renesas/ravb_main.c > > +++ b/drivers/net/ethernet/renesas/ravb_main.c > [...] > > -static void *ravb_alloc_rx_desc(struct net_device *ndev, int q) > > +static void *ravb_alloc_rx_desc_rcar(struct net_device *ndev, int q) > > { > > struct ravb_private *priv = netdev_priv(ndev); > > unsigned int ring_size; > > @@ -1085,16 +1092,25 @@ static int ravb_poll(struct napi_struct *napi, > int budget) > > struct net_device *ndev = napi->dev; > > struct ravb_private *priv = netdev_priv(ndev); > > const struct ravb_hw_info *info = priv->info; > > + bool gptp = info->gptp || info->ccc_gac; > > + struct ravb_rx_desc *desc; > > unsigned long flags; > > int q = napi - priv->napi; > > int mask = BIT(q); > > int quota = budget; > > + unsigned int entry; > > > > + if (!gptp) { > > + entry = priv->cur_rx[q] % priv->num_rx_ring[q]; > > + desc = &priv->gbeth_rx_ring[entry]; > > + } > > /* Processing RX Descriptor Ring */ > > /* Clear RX interrupt */ > > ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); > > - if (ravb_rx(ndev, "a, q)) > > - goto out; > > + if (gptp || desc->die_dt != DT_FEMPTY) { > > + if (ravb_rx(ndev, "a, q)) > > + goto out; > > + } > > Not sure I understand this new logic around the ravb_rx() call, care to > explain? The code is simple. If (gptp || --> means non gptp case that is Gbethernet die_dt --> Descriptor thype So basically the new logic is , on Gbethernet case, if descriptor is not empty, then process rx. Regards, Biju
diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h index 02f425bf9544..c63fad2d2049 100644 --- a/drivers/net/ethernet/renesas/ravb.h +++ b/drivers/net/ethernet/renesas/ravb.h @@ -1076,6 +1076,7 @@ struct ravb_private { struct ravb_desc *desc_bat; dma_addr_t rx_desc_dma[NUM_RX_QUEUE]; dma_addr_t tx_desc_dma[NUM_TX_QUEUE]; + struct ravb_rx_desc *gbeth_rx_ring; struct ravb_ex_rx_desc *rx_ring[NUM_RX_QUEUE]; struct ravb_tx_desc *tx_ring[NUM_TX_QUEUE]; void *tx_align[NUM_TX_QUEUE]; diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 37f50c041114..31de4e544525 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -385,11 +385,18 @@ static void ravb_ring_format(struct net_device *ndev, int q) static void *ravb_alloc_rx_desc_gbeth(struct net_device *ndev, int q) { - /* Place holder */ - return NULL; + struct ravb_private *priv = netdev_priv(ndev); + unsigned int ring_size; + + ring_size = sizeof(struct ravb_rx_desc) * (priv->num_rx_ring[q] + 1); + + priv->gbeth_rx_ring = dma_alloc_coherent(ndev->dev.parent, ring_size, + &priv->rx_desc_dma[q], + GFP_KERNEL); + return priv->gbeth_rx_ring; } -static void *ravb_alloc_rx_desc(struct net_device *ndev, int q) +static void *ravb_alloc_rx_desc_rcar(struct net_device *ndev, int q) { struct ravb_private *priv = netdev_priv(ndev); unsigned int ring_size; @@ -1085,16 +1092,25 @@ static int ravb_poll(struct napi_struct *napi, int budget) struct net_device *ndev = napi->dev; struct ravb_private *priv = netdev_priv(ndev); const struct ravb_hw_info *info = priv->info; + bool gptp = info->gptp || info->ccc_gac; + struct ravb_rx_desc *desc; unsigned long flags; int q = napi - priv->napi; int mask = BIT(q); int quota = budget; + unsigned int entry; + if (!gptp) { + entry = priv->cur_rx[q] % priv->num_rx_ring[q]; + desc = &priv->gbeth_rx_ring[entry]; + } /* Processing RX Descriptor Ring */ /* Clear RX interrupt */ ravb_write(ndev, ~(mask | RIS0_RESERVED), RIS0); - if (ravb_rx(ndev, "a, q)) - goto out; + if (gptp || desc->die_dt != DT_FEMPTY) { + if (ravb_rx(ndev, "a, q)) + goto out; + } /* Processing TX Descriptor Ring */ spin_lock_irqsave(&priv->lock, flags); @@ -2206,7 +2222,7 @@ static int ravb_mdio_release(struct ravb_private *priv) 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, + .alloc_rx_desc = ravb_alloc_rx_desc_rcar, .receive = ravb_rcar_rx, .set_rate = ravb_set_rate_rcar, .set_feature = ravb_set_features_rcar, @@ -2231,7 +2247,7 @@ static const struct ravb_hw_info ravb_gen3_hw_info = { 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, + .alloc_rx_desc = ravb_alloc_rx_desc_rcar, .receive = ravb_rcar_rx, .set_rate = ravb_set_rate_rcar, .set_feature = ravb_set_features_rcar,