Commit 69f49a45 authored by Jijie Shao's avatar Jijie Shao Committed by Hao Chen
Browse files

net: hibmcge: Implement some ethtool_ops functions

maillist inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IAZDQX
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=e8d13548bd08



----------------------------------------------------------------------

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: default avatarJijie Shao <shaojijie@huawei.com>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Signed-off-by: default avatarHao Chen <chenhao418@huawei.com>
parent 51a3c48e
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0+
// Copyright (c) 2024 Hisilicon Limited.

#include <linux/ethtool.h>
#include <linux/phy.h>
#include "hbg_ethtool.h"

static const struct ethtool_ops hbg_ethtool_ops = {
	.get_link		= ethtool_op_get_link,
	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
};

void hbg_ethtool_set_ops(struct net_device *netdev)
{
	netdev->ethtool_ops = &hbg_ethtool_ops;
}
+11 −0
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0+ */
/* Copyright (c) 2024 Hisilicon Limited. */

#ifndef __HBG_ETHTOOL_H
#define __HBG_ETHTOOL_H

#include <linux/netdevice.h>

void hbg_ethtool_set_ops(struct net_device *netdev);

#endif
+2 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/netdevice.h>
#include <linux/pci.h>
#include "hbg_common.h"
#include "hbg_ethtool.h"
#include "hbg_hw.h"
#include "hbg_irq.h"
#include "hbg_mdio.h"
@@ -223,6 +224,7 @@ static int hbg_probe(struct pci_dev *pdev, const struct pci_device_id *ent)

	hbg_change_mtu(priv, ETH_DATA_LEN);
	hbg_net_set_mac_address(priv->netdev, &priv->dev_specs.mac_addr);
	hbg_ethtool_set_ops(netdev);

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