diff mbox series

[net-next,15/18] ravb: Factorise ravb_set_features

Message ID 20210722141351.13668-16-biju.das.jz@bp.renesas.com
State New
Headers show
Series Add Gigabit Ethernet driver support | expand

Commit Message

Biju Das July 22, 2021, 2:13 p.m. UTC
RZ/G2L supports HW checksum. Factorise ravb_set_features
to support this feature.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/net/ethernet/renesas/ravb.h      |  1 +
 drivers/net/ethernet/renesas/ravb_main.c | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/renesas/ravb.h b/drivers/net/ethernet/renesas/ravb.h
index 4725be4e85d0..f1de095f21d9 100644
--- a/drivers/net/ethernet/renesas/ravb.h
+++ b/drivers/net/ethernet/renesas/ravb.h
@@ -996,6 +996,7 @@  struct ravb_ops {
 	void (*dmac_init)(struct net_device *ndev);
 	bool (*receive)(struct net_device *ndev, int *quota, int q);
 	void (*set_rate)(struct net_device *ndev);
+	int (*set_features)(struct net_device *ndev, netdev_features_t features);
 };
 
 struct ravb_drv_data {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 9d5ccd8f9bb1..5a375ac962a0 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1966,8 +1966,8 @@  static void ravb_set_rx_csum(struct net_device *ndev, bool enable)
 	spin_unlock_irqrestore(&priv->lock, flags);
 }
 
-static int ravb_set_features(struct net_device *ndev,
-			     netdev_features_t features)
+static int ravb_set_features_rx_csum(struct net_device *ndev,
+				     netdev_features_t features)
 {
 	netdev_features_t changed = ndev->features ^ features;
 
@@ -1979,6 +1979,15 @@  static int ravb_set_features(struct net_device *ndev,
 	return 0;
 }
 
+static int ravb_set_features(struct net_device *ndev,
+			     netdev_features_t features)
+{
+	struct ravb_private *priv = netdev_priv(ndev);
+	const struct ravb_drv_data *info = priv->info;
+
+	return info->ravb_ops->set_features(ndev, features);
+}
+
 static const struct net_device_ops ravb_netdev_ops = {
 	.ndo_open		= ravb_open,
 	.ndo_stop		= ravb_close,
@@ -2047,6 +2056,7 @@  static const struct ravb_ops ravb_gen3_ops = {
 	.dmac_init = ravb_dmac_init_ex,
 	.receive = ravb_ex_rx,
 	.set_rate = ravb_set_rate,
+	.set_features = ravb_set_features_rx_csum,
 };
 
 static const struct ravb_drv_data ravb_gen3_data = {