mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
net: hns3: Add support for hns3_nic_netdev_ops.ndo_do_ioctl
This patch adds the .ndo_do_ioctl net_device_ops operation to support
the PHY MII ioctl for PF driver.
Fixes: 76ad4f0ee7
("net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC")
Signed-off-by: Xi Wang <wangxi11@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
3152fcc69a
commit
26483246b5
3 changed files with 30 additions and 0 deletions
|
@ -337,6 +337,8 @@ struct hnae3_ae_ops {
|
|||
void (*get_mac_addr)(struct hnae3_handle *handle, u8 *p);
|
||||
int (*set_mac_addr)(struct hnae3_handle *handle, void *p,
|
||||
bool is_first);
|
||||
int (*do_ioctl)(struct hnae3_handle *handle,
|
||||
struct ifreq *ifr, int cmd);
|
||||
int (*add_uc_addr)(struct hnae3_handle *handle,
|
||||
const unsigned char *addr);
|
||||
int (*rm_uc_addr)(struct hnae3_handle *handle,
|
||||
|
|
|
@ -1239,6 +1239,20 @@ static int hns3_nic_net_set_mac_address(struct net_device *netdev, void *p)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int hns3_nic_do_ioctl(struct net_device *netdev,
|
||||
struct ifreq *ifr, int cmd)
|
||||
{
|
||||
struct hnae3_handle *h = hns3_get_handle(netdev);
|
||||
|
||||
if (!netif_running(netdev))
|
||||
return -EINVAL;
|
||||
|
||||
if (!h->ae_algo->ops->do_ioctl)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return h->ae_algo->ops->do_ioctl(h, ifr, cmd);
|
||||
}
|
||||
|
||||
static int hns3_nic_set_features(struct net_device *netdev,
|
||||
netdev_features_t features)
|
||||
{
|
||||
|
@ -1565,6 +1579,7 @@ static const struct net_device_ops hns3_nic_netdev_ops = {
|
|||
.ndo_start_xmit = hns3_nic_net_xmit,
|
||||
.ndo_tx_timeout = hns3_nic_net_timeout,
|
||||
.ndo_set_mac_address = hns3_nic_net_set_mac_address,
|
||||
.ndo_do_ioctl = hns3_nic_do_ioctl,
|
||||
.ndo_change_mtu = hns3_nic_change_mtu,
|
||||
.ndo_set_features = hns3_nic_set_features,
|
||||
.ndo_get_stats64 = hns3_nic_get_stats64,
|
||||
|
|
|
@ -4308,6 +4308,18 @@ static int hclge_set_mac_addr(struct hnae3_handle *handle, void *p,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int hclge_do_ioctl(struct hnae3_handle *handle, struct ifreq *ifr,
|
||||
int cmd)
|
||||
{
|
||||
struct hclge_vport *vport = hclge_get_vport(handle);
|
||||
struct hclge_dev *hdev = vport->back;
|
||||
|
||||
if (!hdev->hw.mac.phydev)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
return phy_mii_ioctl(hdev->hw.mac.phydev, ifr, cmd);
|
||||
}
|
||||
|
||||
static int hclge_set_vlan_filter_ctrl(struct hclge_dev *hdev, u8 vlan_type,
|
||||
bool filter_en)
|
||||
{
|
||||
|
@ -5977,6 +5989,7 @@ static const struct hnae3_ae_ops hclge_ops = {
|
|||
.get_tc_size = hclge_get_tc_size,
|
||||
.get_mac_addr = hclge_get_mac_addr,
|
||||
.set_mac_addr = hclge_set_mac_addr,
|
||||
.do_ioctl = hclge_do_ioctl,
|
||||
.add_uc_addr = hclge_add_uc_addr,
|
||||
.rm_uc_addr = hclge_rm_uc_addr,
|
||||
.add_mc_addr = hclge_add_mc_addr,
|
||||
|
|
Loading…
Add table
Reference in a new issue