Commit 8f8d322b authored by Shinas Rasheed's avatar Shinas Rasheed Committed by David S. Miller

octeon_ep_vf: add support for ndo ops

Add support for ndo ops to set MAC address, change MTU, get stats.
Add control path support to set MAC address, change MTU, get stats,
set speed, get and set link mode.
Signed-off-by: default avatarShinas Rasheed <srasheed@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 6ca7b548
...@@ -187,6 +187,23 @@ static netdev_tx_t octep_vf_start_xmit(struct sk_buff *skb, ...@@ -187,6 +187,23 @@ static netdev_tx_t octep_vf_start_xmit(struct sk_buff *skb,
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
int octep_vf_get_if_stats(struct octep_vf_device *oct)
{
struct octep_vf_iface_rxtx_stats vf_stats;
int ret, size;
memset(&vf_stats, 0, sizeof(struct octep_vf_iface_rxtx_stats));
ret = octep_vf_mbox_bulk_read(oct, OCTEP_PFVF_MBOX_CMD_GET_STATS,
(u8 *)&vf_stats, &size);
if (!ret) {
memcpy(&oct->iface_rx_stats, &vf_stats.iface_rx_stats,
sizeof(struct octep_vf_iface_rx_stats));
memcpy(&oct->iface_tx_stats, &vf_stats.iface_tx_stats,
sizeof(struct octep_vf_iface_tx_stats));
}
return ret;
}
int octep_vf_get_link_info(struct octep_vf_device *oct) int octep_vf_get_link_info(struct octep_vf_device *oct)
{ {
int ret, size; int ret, size;
...@@ -200,6 +217,42 @@ int octep_vf_get_link_info(struct octep_vf_device *oct) ...@@ -200,6 +217,42 @@ int octep_vf_get_link_info(struct octep_vf_device *oct)
return 0; return 0;
} }
/**
* octep_vf_get_stats64() - Get Octeon network device statistics.
*
* @netdev: kernel network device.
* @stats: pointer to stats structure to be filled in.
*/
static void octep_vf_get_stats64(struct net_device *netdev,
struct rtnl_link_stats64 *stats)
{
struct octep_vf_device *oct = netdev_priv(netdev);
u64 tx_packets, tx_bytes, rx_packets, rx_bytes;
int q;
tx_packets = 0;
tx_bytes = 0;
rx_packets = 0;
rx_bytes = 0;
for (q = 0; q < oct->num_oqs; q++) {
struct octep_vf_iq *iq = oct->iq[q];
struct octep_vf_oq *oq = oct->oq[q];
tx_packets += iq->stats.instr_completed;
tx_bytes += iq->stats.bytes_sent;
rx_packets += oq->stats.packets;
rx_bytes += oq->stats.bytes;
}
stats->tx_packets = tx_packets;
stats->tx_bytes = tx_bytes;
stats->rx_packets = rx_packets;
stats->rx_bytes = rx_bytes;
if (!octep_vf_get_if_stats(oct)) {
stats->multicast = oct->iface_rx_stats.mcast_pkts;
stats->rx_errors = oct->iface_rx_stats.err_pkts;
}
}
/** /**
* octep_vf_tx_timeout_task - work queue task to Handle Tx queue timeout. * octep_vf_tx_timeout_task - work queue task to Handle Tx queue timeout.
* *
...@@ -312,6 +365,7 @@ static const struct net_device_ops octep_vf_netdev_ops = { ...@@ -312,6 +365,7 @@ static const struct net_device_ops octep_vf_netdev_ops = {
.ndo_open = octep_vf_open, .ndo_open = octep_vf_open,
.ndo_stop = octep_vf_stop, .ndo_stop = octep_vf_stop,
.ndo_start_xmit = octep_vf_start_xmit, .ndo_start_xmit = octep_vf_start_xmit,
.ndo_get_stats64 = octep_vf_get_stats64,
.ndo_tx_timeout = octep_vf_tx_timeout, .ndo_tx_timeout = octep_vf_tx_timeout,
.ndo_set_mac_address = octep_vf_set_mac, .ndo_set_mac_address = octep_vf_set_mac,
.ndo_change_mtu = octep_vf_change_mtu, .ndo_change_mtu = octep_vf_change_mtu,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment