From: Jeff Garzik <jeff@garzik.org>
To: Brian King <brking@linux.vnet.ibm.com>
Cc: linuxppc-dev@ozlabs.org, rcjenn@linux.vnet.ibm.com,
santil@linux.vnet.ibm.com, netdev@vger.kernel.org
Subject: Re: [PATCH 4/6] ibmveth: Add ethtool driver stats hooks
Date: Tue, 07 Aug 2007 17:50:47 -0400 [thread overview]
Message-ID: <46B8E937.7000901@garzik.org> (raw)
In-Reply-To: <200708061942.l76JgZRK020999@d03av03.boulder.ibm.com>
Brian King wrote:
> Add ethtool hooks to ibmveth to retrieve driver statistics.
>
> Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
> ---
>
> drivers/net/ibmveth.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 52 insertions(+), 1 deletion(-)
>
> diff -puN drivers/net/ibmveth.c~ibmveth_ethtool_driver_stats drivers/net/ibmveth.c
> --- linux-2.6/drivers/net/ibmveth.c~ibmveth_ethtool_driver_stats 2007-07-19 11:18:41.000000000 -0500
> +++ linux-2.6-bjking1/drivers/net/ibmveth.c 2007-07-19 11:18:41.000000000 -0500
> @@ -112,6 +112,28 @@ MODULE_DESCRIPTION("IBM i/pSeries Virtua
> 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)
> {
> @@ -751,6 +773,32 @@ static u32 ibmveth_get_rx_csum(struct ne
> 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,
> @@ -761,7 +809,10 @@ static const struct ethtool_ops netdev_e
> .get_rx_csum = ibmveth_get_rx_csum,
> .set_rx_csum = ibmveth_set_rx_csum,
> .get_tso = ethtool_op_get_tso,
> - .get_ufo = ethtool_op_get_ufo
> + .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
ACK, modulo comma-at-end-of-initializer per previous email
next prev parent reply other threads:[~2007-08-07 21:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <11864293333377-patch-mail.ibm.com>
2007-08-06 19:42 ` [PATCH 2/6] ibmveth: Implement ethtool hooks to enable/disable checksum offload Brian King
2007-08-07 21:48 ` Jeff Garzik
2007-08-07 22:07 ` Brian King
2007-08-07 22:16 ` Jeff Garzik
2007-08-06 19:42 ` [PATCH 3/6] ibmveth: Add ethtool TSO handlers Brian King
2007-08-07 21:50 ` Jeff Garzik
2007-08-06 19:42 ` [PATCH 4/6] ibmveth: Add ethtool driver stats hooks Brian King
2007-08-07 21:50 ` Jeff Garzik [this message]
2007-08-06 19:42 ` [PATCH 5/6] ibmveth: Remove dead frag processing code Brian King
2007-08-06 19:42 ` [PATCH 6/6] ibmveth: Remove use of bitfields Brian King
2007-08-07 21:56 ` Jeff Garzik
2007-08-07 21:46 ` [PATCH 1/6] ibmveth: Enable TCP checksum offload Jeff Garzik
[not found] <11867741331983-patch-mail.ibm.com>
2007-08-10 19:29 ` [PATCH 4/6] ibmveth: Add ethtool driver stats hooks Brian King
[not found] <11873601831813-patch-mail.ibm.com>
2007-08-17 14:16 ` Brian King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46B8E937.7000901@garzik.org \
--to=jeff@garzik.org \
--cc=brking@linux.vnet.ibm.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=netdev@vger.kernel.org \
--cc=rcjenn@linux.vnet.ibm.com \
--cc=santil@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).