All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>
Cc: Biju Das <biju.das.jz@bp.renesas.com>,
	Sergey Shtylyov <s.shtylyov@omp.ru>,
	Sergei Shtylyov <sergei.shtylyov@gmail.com>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Sergey Shtylyov <s.shtylyov@omprussia.ru>,
	Adam Ford <aford173@gmail.com>, Andrew Lunn <andrew@lunn.ch>,
	Yuusuke Ashizuka <ashiduka@fujitsu.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>,
	Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Subject: [PATCH net-next v3 04/14] ravb: Fillup ravb_rx_ring_free_gbeth() stub
Date: Tue, 12 Oct 2021 17:36:03 +0100	[thread overview]
Message-ID: <20211012163613.30030-5-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20211012163613.30030-1-biju.das.jz@bp.renesas.com>

Fillup ravb_rx_ring_free_gbeth() function to support RZ/G2L.

This patch also renames ravb_rx_ring_free to ravb_rx_ring_free_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>
---
v2->v3:
 * No change
v1->v2:
 * No change
RFC->V1:
 * No change. Added Sergey's Rb tag.
RFC Changes:
 * moved "gbeth_rx_ring" to previous patch
 * started using "gbeth_rx_ring" instead of gbeth_rx_ring[q].
 * renamed ravb_rx_ring_free to ravb_rx_ring_free_rcar
---
 drivers/net/ethernet/renesas/ravb_main.c | 28 ++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index c6bab0dfd3bc..1ea25a8d208e 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -236,10 +236,30 @@ static int ravb_tx_free(struct net_device *ndev, int q, bool free_txed_only)
 
 static void ravb_rx_ring_free_gbeth(struct net_device *ndev, int q)
 {
-	/* Place holder */
+	struct ravb_private *priv = netdev_priv(ndev);
+	unsigned int ring_size;
+	unsigned int i;
+
+	if (!priv->gbeth_rx_ring)
+		return;
+
+	for (i = 0; i < priv->num_rx_ring[q]; i++) {
+		struct ravb_rx_desc *desc = &priv->gbeth_rx_ring[i];
+
+		if (!dma_mapping_error(ndev->dev.parent,
+				       le32_to_cpu(desc->dptr)))
+			dma_unmap_single(ndev->dev.parent,
+					 le32_to_cpu(desc->dptr),
+					 GBETH_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->gbeth_rx_ring,
+			  priv->rx_desc_dma[q]);
+	priv->gbeth_rx_ring = NULL;
 }
 
-static void ravb_rx_ring_free(struct net_device *ndev, int q)
+static void ravb_rx_ring_free_rcar(struct net_device *ndev, int q)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
 	unsigned int ring_size;
@@ -2189,7 +2209,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_free = ravb_rx_ring_free_rcar,
 	.rx_ring_format = ravb_rx_ring_format,
 	.alloc_rx_desc = ravb_alloc_rx_desc_rcar,
 	.receive = ravb_rcar_rx,
@@ -2214,7 +2234,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_free = ravb_rx_ring_free_rcar,
 	.rx_ring_format = ravb_rx_ring_format,
 	.alloc_rx_desc = ravb_alloc_rx_desc_rcar,
 	.receive = ravb_rcar_rx,
-- 
2.17.1


  parent reply	other threads:[~2021-10-12 16:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-12 16:35 [PATCH net-next v3 00/14] Add functional support for Gigabit Ethernet driver Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 01/14] ravb: Use ALIGN macro for max_rx_len Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 02/14] ravb: Add rx_max_buf_size to struct ravb_hw_info Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 03/14] ravb: Fillup ravb_alloc_rx_desc_gbeth() stub Biju Das
2021-10-12 16:36 ` Biju Das [this message]
2021-10-12 16:36 ` [PATCH net-next v3 05/14] ravb: Fillup ravb_rx_ring_format_gbeth() stub Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 06/14] ravb: Fillup ravb_rx_gbeth() stub Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 07/14] ravb: Add carrier_counters to struct ravb_hw_info Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 08/14] ravb: Add support to retrieve stats for GbEthernet Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 09/14] ravb: Rename "tsrq" variable Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 10/14] ravb: Optimize ravb_emac_init_gbeth function Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 11/14] ravb: Rename "nc_queue" feature bit Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 12/14] ravb: Document PFRI register bit Biju Das
2021-10-12 16:36 ` [PATCH net-next v3 13/14] ravb: Update ravb_emac_init_gbeth() Biju Das
2021-10-12 17:34   ` Sergey Shtylyov
2021-10-12 17:52     ` Biju Das
2021-10-12 18:03       ` Sergei Shtylyov
2021-10-12 18:23         ` Biju Das
2021-10-12 18:25           ` Sergei Shtylyov
2021-10-12 18:55             ` Biju Das
2021-10-13  6:14               ` Biju Das
2021-10-13 15:46               ` Sergey Shtylyov
     [not found]                 ` <20211013085704.4a059444@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2021-10-13 16:03                   ` Sergey Shtylyov
2021-10-12 16:36 ` [PATCH net-next v3 14/14] ravb: Fix typo AVB->DMAC Biju Das
2021-10-12 18:19 ` [PATCH net-next v3 00/14] Add functional support for Gigabit Ethernet driver Jakub Kicinski
2021-10-12 18:28   ` Biju Das
     [not found]     ` <20211012114125.0a9d71ae@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
2021-10-12 18:53       ` Biju Das
2021-10-12 20:17         ` Jakub Kicinski
2021-10-13  6:41           ` Biju Das
2021-10-13  6:50             ` Biju Das
2021-10-13 16:20 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211012163613.30030-5-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=Chris.Paterson2@renesas.com \
    --cc=aford173@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ashiduka@fujitsu.com \
    --cc=biju.das@bp.renesas.com \
    --cc=davem@davemloft.net \
    --cc=geert+renesas@glider.be \
    --cc=kuba@kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=s.shtylyov@omp.ru \
    --cc=s.shtylyov@omprussia.ru \
    --cc=sergei.shtylyov@gmail.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.