Skip to content

Commit e8d1354

Browse files
Jijie ShaoPaolo Abeni
authored andcommitted
net: hibmcge: Implement some ethtool_ops functions
Implement the .get_drvinfo .get_link .get_link_ksettings to get the basic information and working status of the driver. Implement the .set_link_ksettings to modify the rate, duplex, and auto-negotiation status. Signed-off-by: Jijie Shao <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Reviewed-by: Kalesh AP <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent f72e255 commit e8d1354

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// SPDX-License-Identifier: GPL-2.0+
2+
// Copyright (c) 2024 Hisilicon Limited.
3+
4+
#include <linux/ethtool.h>
5+
#include <linux/phy.h>
6+
#include "hbg_ethtool.h"
7+
8+
static const struct ethtool_ops hbg_ethtool_ops = {
9+
.get_link = ethtool_op_get_link,
10+
.get_link_ksettings = phy_ethtool_get_link_ksettings,
11+
.set_link_ksettings = phy_ethtool_set_link_ksettings,
12+
};
13+
14+
void hbg_ethtool_set_ops(struct net_device *netdev)
15+
{
16+
netdev->ethtool_ops = &hbg_ethtool_ops;
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* SPDX-License-Identifier: GPL-2.0+ */
2+
/* Copyright (c) 2024 Hisilicon Limited. */
3+
4+
#ifndef __HBG_ETHTOOL_H
5+
#define __HBG_ETHTOOL_H
6+
7+
#include <linux/netdevice.h>
8+
9+
void hbg_ethtool_set_ops(struct net_device *netdev);
10+
11+
#endif

drivers/net/ethernet/hisilicon/hibmcge/hbg_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <linux/netdevice.h>
77
#include <linux/pci.h>
88
#include "hbg_common.h"
9+
#include "hbg_ethtool.h"
910
#include "hbg_hw.h"
1011
#include "hbg_irq.h"
1112
#include "hbg_mdio.h"
@@ -223,6 +224,7 @@ static int hbg_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
223224

224225
hbg_change_mtu(priv, ETH_DATA_LEN);
225226
hbg_net_set_mac_address(priv->netdev, &priv->dev_specs.mac_addr);
227+
hbg_ethtool_set_ops(netdev);
226228

227229
ret = devm_register_netdev(dev, netdev);
228230
if (ret)

0 commit comments

Comments
 (0)