From: Brice Goglin <brice@myri.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 2/3] myri10ge: allow to disable link status change reporting
Date: Tue, 15 Aug 2006 08:46:22 -0400 [thread overview]
Message-ID: <44E1C21E.2080308@myri.com> (raw)
In-Reply-To: <44E0F2F6.7020403@garzik.org>
Jeff Garzik wrote:
> Brice Goglin wrote:
>> Add myri10ge_verbose module parameter to disable reporting of
>> link status change since some Ethernet switches seem to generate
>> a lot of status changes under some circumstances and some people
>> want to avoid useless flooding in the logs.
>>
>> Also add a counter for link status changes to statistics.
>>
>> Signed-off-by: Brice Goglin <brice@myri.com>
>
> NAK - use the standard netif_msg_xxx and the msg_enable style variable
> found in many drivers. No need for a module parameter, ethtool
> already covers this type of need.
Oh right, didn't know that, thanks.
Actually, most of the drivers I looked at also define an additional
module parameter "debug" (to initialize their "msg_enable") :) I
copied-pasted and did the same in the following patch. Would it be ok?
Once this is commited, we will probably use the other netif_msg_xxx()
later to disable/enable some other messages.
>From Brice Goglin <brice@myri.com>
[PATCH] myri10ge: use netif_msg_link
Add msg_enable and use netif_msg_link to enable/disable reporting
of link status changes since some Ethernet switches seem to generate
a lot of status changes under some circumstances and some people
want to avoid useless flooding in the logs.
Also add a counter for link status changes to statistics.
---
drivers/net/myri10ge/myri10ge.c | 46 +++++++++++++++++++++++++++++++++-------
1 file changed, 39 insertions(+), 7 deletions(-)
Index: linux-mm/drivers/net/myri10ge/myri10ge.c
===================================================================
--- linux-mm.orig/drivers/net/myri10ge/myri10ge.c 2006-08-14 21:48:14.000000000 -0400
+++ linux-mm/drivers/net/myri10ge/myri10ge.c 2006-08-14 22:13:17.000000000 -0400
@@ -192,6 +192,8 @@
u32 read_dma;
u32 write_dma;
u32 read_write_dma;
+ u32 link_changes;
+ u32 msg_enable;
};
static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat";
@@ -257,6 +259,12 @@
MODULE_PARM_DESC(myri10ge_max_irq_loops,
"Set stuck legacy IRQ detection threshold\n");
+#define MYRI10GE_MSG_DEFAULT NETIF_MSG_LINK
+
+static int myri10ge_debug = -1; /* defaults above */
+module_param(myri10ge_debug, int, 0);
+MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)");
+
#define MYRI10GE_FW_OFFSET 1024*1024
#define MYRI10GE_HIGHPART_TO_U32(X) \
(sizeof (X) == 8) ? ((u32)((u64)(X) >> 32)) : (0)
@@ -764,6 +772,7 @@
mgp->rx_small.cnt = 0;
mgp->rx_done.idx = 0;
mgp->rx_done.cnt = 0;
+ mgp->link_changes = 0;
status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr);
myri10ge_change_promisc(mgp, 0, 0);
myri10ge_change_pause(mgp, mgp->pause);
@@ -1085,13 +1094,19 @@
if (mgp->link_state != stats->link_up) {
mgp->link_state = stats->link_up;
if (mgp->link_state) {
- printk(KERN_INFO "myri10ge: %s: link up\n",
- mgp->dev->name);
+ if (netif_msg_link(mgp))
+ printk(KERN_INFO
+ "myri10ge: %s: link up\n",
+ mgp->dev->name);
netif_carrier_on(mgp->dev);
+ mgp->link_changes++;
} else {
- printk(KERN_INFO "myri10ge: %s: link down\n",
- mgp->dev->name);
+ if (netif_msg_link(mgp))
+ printk(KERN_INFO
+ "myri10ge: %s: link down\n",
+ mgp->dev->name);
netif_carrier_off(mgp->dev);
+ mgp->link_changes++;
}
}
if (mgp->rdma_tags_available !=
@@ -1293,8 +1308,9 @@
"serial_number", "tx_pkt_start", "tx_pkt_done",
"tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt",
"wake_queue", "stop_queue", "watchdog_resets", "tx_linearized",
- "link_up", "dropped_link_overflow", "dropped_link_error_or_filtered",
- "dropped_runt", "dropped_overrun", "dropped_no_small_buffer",
+ "link_changes", "link_up", "dropped_link_overflow",
+ "dropped_link_error_or_filtered", "dropped_runt",
+ "dropped_overrun", "dropped_no_small_buffer",
"dropped_no_big_buffer"
};
@@ -1345,6 +1361,7 @@
data[i++] = (unsigned int)mgp->stop_queue;
data[i++] = (unsigned int)mgp->watchdog_resets;
data[i++] = (unsigned int)mgp->tx_linearized;
+ data[i++] = (unsigned int)mgp->link_changes;
data[i++] = (unsigned int)ntohl(mgp->fw_stats->link_up);
data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow);
data[i++] =
@@ -1355,6 +1372,18 @@
data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_big_buffer);
}
+static void myri10ge_set_msglevel(struct net_device *netdev, u32 value)
+{
+ struct myri10ge_priv *mgp = netdev_priv(netdev);
+ mgp->msg_enable = value;
+}
+
+static u32 myri10ge_get_msglevel(struct net_device *netdev)
+{
+ struct myri10ge_priv *mgp = netdev_priv(netdev);
+ return mgp->msg_enable;
+}
+
static struct ethtool_ops myri10ge_ethtool_ops = {
.get_settings = myri10ge_get_settings,
.get_drvinfo = myri10ge_get_drvinfo,
@@ -1375,7 +1404,9 @@
#endif
.get_strings = myri10ge_get_strings,
.get_stats_count = myri10ge_get_stats_count,
- .get_ethtool_stats = myri10ge_get_ethtool_stats
+ .get_ethtool_stats = myri10ge_get_ethtool_stats,
+ .set_msglevel = myri10ge_set_msglevel,
+ .get_msglevel = myri10ge_get_msglevel
};
static int myri10ge_allocate_rings(struct net_device *dev)
@@ -2580,6 +2611,7 @@
mgp->csum_flag = MXGEFW_FLAGS_CKSUM;
mgp->pause = myri10ge_flow_control;
mgp->intr_coal_delay = myri10ge_intr_coal_delay;
+ mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT);
init_waitqueue_head(&mgp->down_wq);
if (pci_enable_device(pdev)) {
next prev parent reply other threads:[~2006-08-15 12:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <44E0DA08.9080304@myri.com>
2006-08-14 21:52 ` [PATCH 1/3] myri10ge: define some previously hardwired firmware constants Brice Goglin
2006-08-14 21:53 ` [PATCH 2/3] myri10ge: allow to disable link status change reporting Brice Goglin
2006-08-14 22:02 ` Jeff Garzik
2006-08-15 12:46 ` Brice Goglin [this message]
2006-08-15 12:49 ` Brice Goglin
2006-08-14 21:53 ` [PATCH 3/3] myri10ge: convert to netdev_alloc_skb Brice Goglin
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=44E1C21E.2080308@myri.com \
--to=brice@myri.com \
--cc=jeff@garzik.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.