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>,
	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 v2 6/8] ravb: Add net_features and net_hw_features to struct ravb_hw_info
Date: Mon,  2 Aug 2021 11:26:52 +0100	[thread overview]
Message-ID: <20210802102654.5996-7-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20210802102654.5996-1-biju.das.jz@bp.renesas.com>

On R-Car the checksum calculation on RX frames is done by the E-MAC
module, whereas on RZ/G2L it is done by the TOE.

TOE calculates the checksum of received frames from E-MAC and outputs it to
DMAC. TOE also calculates the checksum of transmission frames from DMAC and
outputs it E-MAC.

Add net_features and net_hw_features to struct ravb_hw_info, to support
subsequent SoCs without any code changes in the ravb_probe function.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
v2:
 * Incorporated Andrew and Sergei's review comments for making it smaller patch
   and provided detailed description.
---
 drivers/net/ethernet/renesas/ravb.h      |  2 ++
 drivers/net/ethernet/renesas/ravb_main.c | 12 ++++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index b765b2b7d9e9..3df813b2e253 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -991,6 +991,8 @@ enum ravb_chip_id {
 struct ravb_hw_info {
 	const char (*gstrings_stats)[ETH_GSTRING_LEN];
 	size_t gstrings_size;
+	netdev_features_t net_hw_features;
+	netdev_features_t net_features;
 	enum ravb_chip_id chip_id;
 	int num_gstat_queue;
 	int num_tx_desc;
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 7a69668cb512..2ac962b5b8fb 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1932,6 +1932,8 @@ static int ravb_mdio_release(struct ravb_private *priv)
 static const struct ravb_hw_info ravb_gen3_hw_info = {
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
+	.net_hw_features = NETIF_F_RXCSUM,
+	.net_features = NETIF_F_RXCSUM,
 	.chip_id = RCAR_GEN3,
 	.num_gstat_queue = NUM_RX_QUEUE,
 	.num_tx_desc = NUM_TX_DESC_GEN3,
@@ -1942,6 +1944,8 @@ static const struct ravb_hw_info ravb_gen3_hw_info = {
 static const struct ravb_hw_info ravb_gen2_hw_info = {
 	.gstrings_stats = ravb_gstrings_stats,
 	.gstrings_size = sizeof(ravb_gstrings_stats),
+	.net_hw_features = NETIF_F_RXCSUM,
+	.net_features = NETIF_F_RXCSUM,
 	.chip_id = RCAR_GEN2,
 	.num_gstat_queue = NUM_RX_QUEUE,
 	.num_tx_desc = NUM_TX_DESC_GEN2,
@@ -2077,14 +2081,14 @@ static int ravb_probe(struct platform_device *pdev)
 	if (!ndev)
 		return -ENOMEM;
 
-	ndev->features = NETIF_F_RXCSUM;
-	ndev->hw_features = NETIF_F_RXCSUM;
+	info = of_device_get_match_data(&pdev->dev);
+
+	ndev->features = info->net_features;
+	ndev->hw_features = info->net_hw_features;
 
 	pm_runtime_enable(&pdev->dev);
 	pm_runtime_get_sync(&pdev->dev);
 
-	info = of_device_get_match_data(&pdev->dev);
-
 	if (info->chip_id == RCAR_GEN3)
 		irq = platform_get_irq_byname(pdev, "ch22");
 	else
-- 
2.17.1


  parent reply	other threads:[~2021-08-02 10:27 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02 10:26 [PATCH net-next v2 0/8] Add Gigabit Ethernet driver support Biju Das
2021-08-02 10:26 ` [PATCH net-next v2 1/8] ravb: Add struct ravb_hw_info to driver data Biju Das
2021-08-02 15:02   ` Andrew Lunn
2021-08-02 20:42   ` Sergei Shtylyov
2021-08-03  5:57     ` Biju Das
2021-08-03  6:36       ` Biju Das
2021-08-04 19:27       ` Sergei Shtylyov
2021-08-04 20:27         ` Sergei Shtylyov
2021-08-09 12:06   ` Geert Uytterhoeven
2021-08-12  7:26     ` Biju Das
2021-08-12  7:58       ` Geert Uytterhoeven
2021-08-12  8:13         ` Biju Das
2021-08-17 11:24           ` Biju Das
2021-08-17 20:11             ` Sergey Shtylyov
2021-08-18  6:29               ` Biju Das
2021-08-18 10:11                 ` Sergey Shtylyov
2021-08-18 10:23                   ` Biju Das
2021-08-02 10:26 ` [PATCH net-next v2 2/8] ravb: Add skb_sz to struct ravb_hw_info Biju Das
2021-08-02 15:08   ` Andrew Lunn
2021-08-02 20:54   ` Sergei Shtylyov
2021-08-03  7:13     ` Biju Das
2021-08-02 10:26 ` [PATCH net-next v2 3/8] ravb: Add num_gstat_queue " Biju Das
2021-08-02 15:09   ` Andrew Lunn
2021-08-03 18:21   ` Sergei Shtylyov
2021-08-03 19:13     ` Biju Das
2021-08-03 19:22       ` Sergei Shtylyov
2021-08-03 19:47         ` Biju Das
2021-08-17 15:08           ` Biju Das
2021-08-02 10:26 ` [PATCH net-next v2 4/8] ravb: Add stats_len " Biju Das
2021-08-03 18:35   ` Sergei Shtylyov
2021-08-03 18:47     ` Biju Das
2021-08-03 19:20       ` Sergei Shtylyov
2021-08-02 10:26 ` [PATCH net-next v2 5/8] ravb: Add gstrings_stats and gstrings_size " Biju Das
2021-08-02 15:11   ` Andrew Lunn
2021-08-04 20:36   ` Sergei Shtylyov
2021-08-02 10:26 ` Biju Das [this message]
2021-08-02 15:12   ` [PATCH net-next v2 6/8] ravb: Add net_features and net_hw_features " Andrew Lunn
2021-08-05 19:07   ` Sergei Shtylyov
2021-08-05 19:18     ` Biju Das
2021-08-06 20:20       ` Sergei Shtylyov
2021-08-12  7:35         ` Biju Das
2021-08-06 20:31   ` Sergei Shtylyov
2021-08-02 10:26 ` [PATCH net-next v2 7/8] ravb: Add internal delay hw feature " Biju Das
2021-08-02 15:13   ` Andrew Lunn
2021-08-03 21:06   ` Sergei Shtylyov
2021-08-04  6:19     ` Biju Das
2021-08-03 21:12   ` Sergei Shtylyov
2021-08-04  5:13     ` Biju Das
2021-08-04  9:51       ` Sergey Shtylyov
2021-08-04 10:08         ` Biju Das
2021-08-04 10:34           ` Sergei Shtylyov
2021-08-04 10:20       ` Sergei Shtylyov
2021-08-04 10:32         ` Biju Das
2021-08-02 10:26 ` [PATCH net-next v2 8/8] ravb: Add tx_drop_cntrs " Biju Das
2021-08-02 15:14   ` Andrew Lunn
2021-08-04 20:50   ` Sergei Shtylyov
2021-08-17 15:47     ` Biju Das
2021-08-17 16:30       ` Sergey Shtylyov
2021-08-17 16:33         ` Biju Das

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=20210802102654.5996-7-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@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.