diff options
author | 2017-08-21 23:56:06 +0800 | |
---|---|---|
committer | 2017-08-22 10:48:54 -0700 | |
commit | edd384f682cc2981420628b769a1929db680f02f (patch) | |
tree | 67c185cb208afe1cf88a4a53ebf50985f5774bb2 /drivers/net/ethernet/huawei/hinic/hinic_port.c | |
parent | net-next/hinic: Add Tx operation (diff) | |
download | linux-edd384f682cc2981420628b769a1929db680f02f.tar.gz linux-edd384f682cc2981420628b769a1929db680f02f.tar.bz2 linux-edd384f682cc2981420628b769a1929db680f02f.zip |
net-next/hinic: Add ethtool and stats
Add ethtool operations and statistics operations.
Signed-off-by: Aviad Krawczyk <aviad.krawczyk@huawei.com>
Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/huawei/hinic/hinic_port.c')
-rw-r--r-- | drivers/net/ethernet/huawei/hinic/hinic_port.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/net/ethernet/huawei/hinic/hinic_port.c b/drivers/net/ethernet/huawei/hinic/hinic_port.c index 528ec6febd04..4d4e3f05fb5f 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_port.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_port.c @@ -346,3 +346,34 @@ int hinic_port_set_func_state(struct hinic_dev *nic_dev, return 0; } + +/** + * hinic_port_get_cap - get port capabilities + * @nic_dev: nic device + * @port_cap: returned port capabilities + * + * Return 0 - Success, negative - Failure + **/ +int hinic_port_get_cap(struct hinic_dev *nic_dev, + struct hinic_port_cap *port_cap) +{ + struct hinic_hwdev *hwdev = nic_dev->hwdev; + struct hinic_hwif *hwif = hwdev->hwif; + struct pci_dev *pdev = hwif->pdev; + u16 out_size; + int err; + + port_cap->func_idx = HINIC_HWIF_FUNC_IDX(hwif); + + err = hinic_port_msg_cmd(hwdev, HINIC_PORT_CMD_GET_CAP, + port_cap, sizeof(*port_cap), + port_cap, &out_size); + if (err || (out_size != sizeof(*port_cap)) || port_cap->status) { + dev_err(&pdev->dev, + "Failed to get port capabilities, ret = %d\n", + port_cap->status); + return -EINVAL; + } + + return 0; +} |