From: Jim Lewis <jim@jklewis.com>
To: Jeff Garzik <jgarzik@pobox.com>
Cc: netdev <netdev@vger.kernel.org>, Andrew Morton <akpm@osdl.org>
Subject: Patch to add ethtool -g to Spidernet network driver
Date: Sat, 05 Aug 2006 10:36:25 -0500 [thread overview]
Message-ID: <1154792185.3692.68.camel@localhost.localdomain> (raw)
This patch adds ethtool -g (show ring sizes) support to the Spidernet
network driver.
Signed-off-by: James K Lewis <jklewis@us.ibm.com>
---
drivers/net/spider_net.c | 12 +++++++-----
drivers/net/spider_net.h | 3 +++
drivers/net/spider_net_ethtool.c | 13 +++++++++++++
3 files changed, 23 insertions(+), 5 deletions(-)
Index: linux-2.6.18-rc2/drivers/net/spider_net.c
===================================================================
--- linux-2.6.18-rc2.orig/drivers/net/spider_net.c 2006-08-03
12:03:01.000000000 -0500
+++ linux-2.6.18-rc2/drivers/net/spider_net.c 2006-08-04
14:48:28.000000000 -0500
@@ -1612,13 +1612,12 @@ spider_net_open(struct net_device *netde
int result;
result = -ENOMEM;
- if (spider_net_init_chain(card, &card->tx_chain,
- card->descr,
- PCI_DMA_TODEVICE, tx_descriptors))
+ if (spider_net_init_chain(card, &card->tx_chain, card->descr,
+ PCI_DMA_TODEVICE, card->tx_desc))
goto alloc_tx_failed;
if (spider_net_init_chain(card, &card->rx_chain,
- card->descr + tx_descriptors,
- PCI_DMA_FROMDEVICE, rx_descriptors))
+ card->descr + card->rx_desc,
+ PCI_DMA_FROMDEVICE, card->rx_desc))
goto alloc_rx_failed;
/* allocate rx skbs */
@@ -2006,6 +2005,9 @@ spider_net_setup_netdev(struct spider_ne
card->options.rx_csum = SPIDER_NET_RX_CSUM_DEFAULT;
+ card->tx_desc = tx_descriptors;
+ card->rx_desc = rx_descriptors;
+
spider_net_setup_netdev_ops(netdev);
netdev->features = NETIF_F_HW_CSUM | NETIF_F_LLTX;
Index: linux-2.6.18-rc2/drivers/net/spider_net.h
===================================================================
--- linux-2.6.18-rc2.orig/drivers/net/spider_net.h 2006-08-03
12:03:01.000000000 -0500
+++ linux-2.6.18-rc2/drivers/net/spider_net.h 2006-08-04
14:48:26.000000000 -0500
@@ -441,6 +441,9 @@ struct spider_net_card {
/* for ethtool */
int msg_enable;
+ int rx_desc;
+ int tx_desc;
+
struct spider_net_descr descr[0];
};
Index: linux-2.6.18-rc2/drivers/net/spider_net_ethtool.c
===================================================================
--- linux-2.6.18-rc2.orig/drivers/net/spider_net_ethtool.c 2006-08-03
12:03:01.000000000 -0500
+++ linux-2.6.18-rc2/drivers/net/spider_net_ethtool.c 2006-08-04
15:00:22.000000000 -0500
@@ -130,6 +130,18 @@ spider_net_ethtool_set_tx_csum(struct ne
return 0;
}
+static void
+spider_net_ethtool_get_ringparam(struct net_device *netdev,
+ struct ethtool_ringparam *ering)
+{
+ struct spider_net_card *card = netdev->priv;
+
+ ering->tx_max_pending = SPIDER_NET_TX_DESCRIPTORS_MAX;
+ ering->tx_pending = card->tx_desc;
+ ering->rx_max_pending = SPIDER_NET_RX_DESCRIPTORS_MAX;
+ ering->rx_pending = card->rx_desc;
+}
+
struct ethtool_ops spider_net_ethtool_ops = {
.get_settings = spider_net_ethtool_get_settings,
.get_drvinfo = spider_net_ethtool_get_drvinfo,
@@ -141,5 +153,6 @@ struct ethtool_ops spider_net_ethtool_op
.set_rx_csum = spider_net_ethtool_set_rx_csum,
.get_tx_csum = spider_net_ethtool_get_tx_csum,
.set_tx_csum = spider_net_ethtool_set_tx_csum,
+ .get_ringparam = spider_net_ethtool_get_ringparam,
};
--
Jim Lewis
next reply other threads:[~2006-08-05 15:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-05 15:36 Jim Lewis [this message]
2006-08-14 18:02 ` Patch to add ethtool -g to Spidernet network driver Jeff Garzik
2006-08-14 18:14 ` Andrew Morton
2006-08-14 18:25 ` Jeff Garzik
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=1154792185.3692.68.camel@localhost.localdomain \
--to=jim@jklewis.com \
--cc=akpm@osdl.org \
--cc=jgarzik@pobox.com \
--cc=netdev@vger.kernel.org \
/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).