diff mbox series

[RFC/PATCH,13/18] ravb: Add rx_ring_free function support for GbEthernet

Message ID 20210923140813.13541-14-biju.das.jz@bp.renesas.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series Add Gigabit Ethernet driver support | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count fail Series longer than 15 patches
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 success CCed 10 of 10 maintainers
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
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 Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 28 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Biju Das Sept. 23, 2021, 2:08 p.m. UTC
This patch adds rx_ring_free function support for GbEthernet
found on RZ/G2L SoC.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

Comments

Sergey Shtylyov Sept. 27, 2021, 7:28 p.m. UTC | #1
On 9/23/21 5:08 PM, Biju Das wrote:

> This patch adds rx_ring_free function support for GbEthernet
> found on RZ/G2L SoC.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
>  drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++++++++++++++-
>  1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index 2c375002ebcb..038af36141bb 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -236,7 +236,27 @@ static int ravb_tx_free(struct net_device *ndev, int q, bool free_txed_only)
>  
>  static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
>  {
> -	/* Place holder */
> +	struct ravb_private *priv = netdev_priv(ndev);
> +	unsigned int ring_size;
> +	unsigned int i;
> +
> +	if (!priv->rgeth_rx_ring[q])

   Is the network control queue present on your hardware at all? Perhaps we can ignore q for now?

> +		return;
> +
> +	for (i = 0; i < priv->num_rx_ring[q]; i++) {
> +		struct ravb_rx_desc *desc = &priv->rgeth_rx_ring[q][i];

   Looks like patch #12 should come after this one, not before...

> +
> +		if (!dma_mapping_error(ndev->dev.parent,
> +				       le32_to_cpu(desc->dptr)))
> +			dma_unmap_single(ndev->dev.parent,
> +					 le32_to_cpu(desc->dptr),
> +					 RGETH_RX_BUFF_MAX,
> +					 DMA_FROM_DEVICE);
> +	}
> +	ring_size = sizeof(struct ravb_rx_desc) * (priv->num_rx_ring[q] + 1);
> +	dma_free_coherent(ndev->dev.parent, ring_size, priv->rgeth_rx_ring[q],
> +			  priv->rx_desc_dma[q]);
> +	priv->rgeth_rx_ring[q] = NULL;
>  }
>  
>  static void ravb_rx_ring_free(struct net_device *ndev, int q)

MBR, Sergey
Biju Das Sept. 28, 2021, 9:24 a.m. UTC | #2
Hi Sergei,

Thanks for the feedback.

> Subject: Re: [RFC/PATCH 13/18] ravb: Add rx_ring_free function support for
> GbEthernet
> 
> On 9/23/21 5:08 PM, Biju Das wrote:
> 
> > This patch adds rx_ring_free function support for GbEthernet found on
> > RZ/G2L SoC.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> >  drivers/net/ethernet/renesas/ravb_main.c | 22 +++++++++++++++++++++-
> >  1 file changed, 21 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/ethernet/renesas/ravb_main.c
> > b/drivers/net/ethernet/renesas/ravb_main.c
> > index 2c375002ebcb..038af36141bb 100644
> > --- a/drivers/net/ethernet/renesas/ravb_main.c
> > +++ b/drivers/net/ethernet/renesas/ravb_main.c
> > @@ -236,7 +236,27 @@ static int ravb_tx_free(struct net_device *ndev,
> > int q, bool free_txed_only)
> >
> >  static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
> > {
> > -	/* Place holder */
> > +	struct ravb_private *priv = netdev_priv(ndev);
> > +	unsigned int ring_size;
> > +	unsigned int i;
> > +
> > +	if (!priv->rgeth_rx_ring[q])
> 
>    Is the network control queue present on your hardware at all? Perhaps
> we can ignore q for now?

NC queue is not present on RZ/G2L. Will add a feature flag and function pointer related changes to
minimize the check for NC and avoid using NC queue for RZ/G2L platform.

Please let me know, if you think otherwise.

> 
> > +		return;
> > +
> > +	for (i = 0; i < priv->num_rx_ring[q]; i++) {
> > +		struct ravb_rx_desc *desc = &priv->rgeth_rx_ring[q][i];
> 
>    Looks like patch #12 should come after this one, not before...

Patch#12 is timestamp related and we agreed to merge with gPTP support case.

Regards,
Biju

> 
> > +
> > +		if (!dma_mapping_error(ndev->dev.parent,
> > +				       le32_to_cpu(desc->dptr)))
> > +			dma_unmap_single(ndev->dev.parent,
> > +					 le32_to_cpu(desc->dptr),
> > +					 RGETH_RX_BUFF_MAX,
> > +					 DMA_FROM_DEVICE);
> > +	}
> > +	ring_size = sizeof(struct ravb_rx_desc) * (priv->num_rx_ring[q] +
> 1);
> > +	dma_free_coherent(ndev->dev.parent, ring_size, priv-
> >rgeth_rx_ring[q],
> > +			  priv->rx_desc_dma[q]);
> > +	priv->rgeth_rx_ring[q] = NULL;
> >  }
> >
> >  static void ravb_rx_ring_free(struct net_device *ndev, int q)
> 
> MBR, Sergey
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 2c375002ebcb..038af36141bb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -236,7 +236,27 @@  static int ravb_tx_free(struct net_device *ndev, int q, bool free_txed_only)
 
 static void ravb_rx_ring_free_rgeth(struct net_device *ndev, int q)
 {
-	/* Place holder */
+	struct ravb_private *priv = netdev_priv(ndev);
+	unsigned int ring_size;
+	unsigned int i;
+
+	if (!priv->rgeth_rx_ring[q])
+		return;
+
+	for (i = 0; i < priv->num_rx_ring[q]; i++) {
+		struct ravb_rx_desc *desc = &priv->rgeth_rx_ring[q][i];
+
+		if (!dma_mapping_error(ndev->dev.parent,
+				       le32_to_cpu(desc->dptr)))
+			dma_unmap_single(ndev->dev.parent,
+					 le32_to_cpu(desc->dptr),
+					 RGETH_RX_BUFF_MAX,
+					 DMA_FROM_DEVICE);
+	}
+	ring_size = sizeof(struct ravb_rx_desc) * (priv->num_rx_ring[q] + 1);
+	dma_free_coherent(ndev->dev.parent, ring_size, priv->rgeth_rx_ring[q],
+			  priv->rx_desc_dma[q]);
+	priv->rgeth_rx_ring[q] = NULL;
 }
 
 static void ravb_rx_ring_free(struct net_device *ndev, int q)