Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 66548
b: refs/heads/master
c: ddbb4de
h: refs/heads/master
v: v3
  • Loading branch information
Brian King authored and David S. Miller committed Oct 10, 2007
1 parent 8a1e7cb commit 374f08f
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 80e536770c2fcb8d2b7be9f5a36b85c36fd5943a
refs/heads/master: ddbb4de9672097da2c0f19c6ebca0ebb5672e9b8
51 changes: 51 additions & 0 deletions trunk/drivers/net/ibmveth.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,28 @@ MODULE_DESCRIPTION("IBM i/pSeries Virtual Ethernet Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(ibmveth_driver_version);

struct ibmveth_stat {
char name[ETH_GSTRING_LEN];
int offset;
};

#define IBMVETH_STAT_OFF(stat) offsetof(struct ibmveth_adapter, stat)
#define IBMVETH_GET_STAT(a, off) *((u64 *)(((unsigned long)(a)) + off))

struct ibmveth_stat ibmveth_stats[] = {
{ "replenish_task_cycles", IBMVETH_STAT_OFF(replenish_task_cycles) },
{ "replenish_no_mem", IBMVETH_STAT_OFF(replenish_no_mem) },
{ "replenish_add_buff_failure", IBMVETH_STAT_OFF(replenish_add_buff_failure) },
{ "replenish_add_buff_success", IBMVETH_STAT_OFF(replenish_add_buff_success) },
{ "rx_invalid_buffer", IBMVETH_STAT_OFF(rx_invalid_buffer) },
{ "rx_no_buffer", IBMVETH_STAT_OFF(rx_no_buffer) },
{ "tx_multidesc_send", IBMVETH_STAT_OFF(tx_multidesc_send) },
{ "tx_linearized", IBMVETH_STAT_OFF(tx_linearized) },
{ "tx_linearize_failed", IBMVETH_STAT_OFF(tx_linearize_failed) },
{ "tx_map_failed", IBMVETH_STAT_OFF(tx_map_failed) },
{ "tx_send_failed", IBMVETH_STAT_OFF(tx_send_failed) },
};

/* simple methods of getting data from the current rxq entry */
static inline int ibmveth_rxq_pending_buffer(struct ibmveth_adapter *adapter)
{
Expand Down Expand Up @@ -769,6 +791,32 @@ static u32 ibmveth_get_rx_csum(struct net_device *dev)
return adapter->rx_csum;
}

static void ibmveth_get_strings(struct net_device *dev, u32 stringset, u8 *data)
{
int i;

if (stringset != ETH_SS_STATS)
return;

for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++, data += ETH_GSTRING_LEN)
memcpy(data, ibmveth_stats[i].name, ETH_GSTRING_LEN);
}

static int ibmveth_get_stats_count(struct net_device *dev)
{
return ARRAY_SIZE(ibmveth_stats);
}

static void ibmveth_get_ethtool_stats(struct net_device *dev,
struct ethtool_stats *stats, u64 *data)
{
int i;
struct ibmveth_adapter *adapter = dev->priv;

for (i = 0; i < ARRAY_SIZE(ibmveth_stats); i++)
data[i] = IBMVETH_GET_STAT(adapter, ibmveth_stats[i].offset);
}

static const struct ethtool_ops netdev_ethtool_ops = {
.get_drvinfo = netdev_get_drvinfo,
.get_settings = netdev_get_settings,
Expand All @@ -780,6 +828,9 @@ static const struct ethtool_ops netdev_ethtool_ops = {
.set_rx_csum = ibmveth_set_rx_csum,
.get_tso = ethtool_op_get_tso,
.get_ufo = ethtool_op_get_ufo,
.get_strings = ibmveth_get_strings,
.get_stats_count = ibmveth_get_stats_count,
.get_ethtool_stats = ibmveth_get_ethtool_stats,
};

static int ibmveth_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
Expand Down

0 comments on commit 374f08f

Please sign in to comment.