aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge/myri10ge.c
diff options
context:
space:
mode:
authorBrice Goglin <brice@myri.com>2006-08-21 17:36:49 -0400
committerJeff Garzik <jeff@garzik.org>2006-08-24 00:43:51 -0400
commitc58ac5caeb32ef17c2e4fc208f7dc93f6de32b7d (patch)
treeb31514090620ca564bfe75ba970b843800e51015 /drivers/net/myri10ge/myri10ge.c
parent8d8b03297c96811501e3821edd4602b315458030 (diff)
[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. Signed-off-by: Brice Goglin <brice@myri.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/myri10ge/myri10ge.c')
-rw-r--r--drivers/net/myri10ge/myri10ge.c46
1 files changed, 39 insertions, 7 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index c0c41ca688ef..a79afe2134ba 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -192,6 +192,8 @@ struct myri10ge_priv {
192 u32 read_dma; 192 u32 read_dma;
193 u32 write_dma; 193 u32 write_dma;
194 u32 read_write_dma; 194 u32 read_write_dma;
195 u32 link_changes;
196 u32 msg_enable;
195}; 197};
196 198
197static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat"; 199static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat";
@@ -257,6 +259,12 @@ module_param(myri10ge_max_irq_loops, int, S_IRUGO);
257MODULE_PARM_DESC(myri10ge_max_irq_loops, 259MODULE_PARM_DESC(myri10ge_max_irq_loops,
258 "Set stuck legacy IRQ detection threshold\n"); 260 "Set stuck legacy IRQ detection threshold\n");
259 261
262#define MYRI10GE_MSG_DEFAULT NETIF_MSG_LINK
263
264static int myri10ge_debug = -1; /* defaults above */
265module_param(myri10ge_debug, int, 0);
266MODULE_PARM_DESC(myri10ge_debug, "Debug level (0=none,...,16=all)");
267
260#define MYRI10GE_FW_OFFSET 1024*1024 268#define MYRI10GE_FW_OFFSET 1024*1024
261#define MYRI10GE_HIGHPART_TO_U32(X) \ 269#define MYRI10GE_HIGHPART_TO_U32(X) \
262(sizeof (X) == 8) ? ((u32)((u64)(X) >> 32)) : (0) 270(sizeof (X) == 8) ? ((u32)((u64)(X) >> 32)) : (0)
@@ -764,6 +772,7 @@ static int myri10ge_reset(struct myri10ge_priv *mgp)
764 mgp->rx_small.cnt = 0; 772 mgp->rx_small.cnt = 0;
765 mgp->rx_done.idx = 0; 773 mgp->rx_done.idx = 0;
766 mgp->rx_done.cnt = 0; 774 mgp->rx_done.cnt = 0;
775 mgp->link_changes = 0;
767 status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr); 776 status = myri10ge_update_mac_address(mgp, mgp->dev->dev_addr);
768 myri10ge_change_promisc(mgp, 0, 0); 777 myri10ge_change_promisc(mgp, 0, 0);
769 myri10ge_change_pause(mgp, mgp->pause); 778 myri10ge_change_pause(mgp, mgp->pause);
@@ -1085,13 +1094,19 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
1085 if (mgp->link_state != stats->link_up) { 1094 if (mgp->link_state != stats->link_up) {
1086 mgp->link_state = stats->link_up; 1095 mgp->link_state = stats->link_up;
1087 if (mgp->link_state) { 1096 if (mgp->link_state) {
1088 printk(KERN_INFO "myri10ge: %s: link up\n", 1097 if (netif_msg_link(mgp))
1089 mgp->dev->name); 1098 printk(KERN_INFO
1099 "myri10ge: %s: link up\n",
1100 mgp->dev->name);
1090 netif_carrier_on(mgp->dev); 1101 netif_carrier_on(mgp->dev);
1102 mgp->link_changes++;
1091 } else { 1103 } else {
1092 printk(KERN_INFO "myri10ge: %s: link down\n", 1104 if (netif_msg_link(mgp))
1093 mgp->dev->name); 1105 printk(KERN_INFO
1106 "myri10ge: %s: link down\n",
1107 mgp->dev->name);
1094 netif_carrier_off(mgp->dev); 1108 netif_carrier_off(mgp->dev);
1109 mgp->link_changes++;
1095 } 1110 }
1096 } 1111 }
1097 if (mgp->rdma_tags_available != 1112 if (mgp->rdma_tags_available !=
@@ -1293,8 +1308,9 @@ static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN] = {
1293 "serial_number", "tx_pkt_start", "tx_pkt_done", 1308 "serial_number", "tx_pkt_start", "tx_pkt_done",
1294 "tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt", 1309 "tx_req", "tx_done", "rx_small_cnt", "rx_big_cnt",
1295 "wake_queue", "stop_queue", "watchdog_resets", "tx_linearized", 1310 "wake_queue", "stop_queue", "watchdog_resets", "tx_linearized",
1296 "link_up", "dropped_link_overflow", "dropped_link_error_or_filtered", 1311 "link_changes", "link_up", "dropped_link_overflow",
1297 "dropped_runt", "dropped_overrun", "dropped_no_small_buffer", 1312 "dropped_link_error_or_filtered", "dropped_runt",
1313 "dropped_overrun", "dropped_no_small_buffer",
1298 "dropped_no_big_buffer" 1314 "dropped_no_big_buffer"
1299}; 1315};
1300 1316
@@ -1345,6 +1361,7 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1345 data[i++] = (unsigned int)mgp->stop_queue; 1361 data[i++] = (unsigned int)mgp->stop_queue;
1346 data[i++] = (unsigned int)mgp->watchdog_resets; 1362 data[i++] = (unsigned int)mgp->watchdog_resets;
1347 data[i++] = (unsigned int)mgp->tx_linearized; 1363 data[i++] = (unsigned int)mgp->tx_linearized;
1364 data[i++] = (unsigned int)mgp->link_changes;
1348 data[i++] = (unsigned int)ntohl(mgp->fw_stats->link_up); 1365 data[i++] = (unsigned int)ntohl(mgp->fw_stats->link_up);
1349 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow); 1366 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_link_overflow);
1350 data[i++] = 1367 data[i++] =
@@ -1355,6 +1372,18 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1355 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_big_buffer); 1372 data[i++] = (unsigned int)ntohl(mgp->fw_stats->dropped_no_big_buffer);
1356} 1373}
1357 1374
1375static void myri10ge_set_msglevel(struct net_device *netdev, u32 value)
1376{
1377 struct myri10ge_priv *mgp = netdev_priv(netdev);
1378 mgp->msg_enable = value;
1379}
1380
1381static u32 myri10ge_get_msglevel(struct net_device *netdev)
1382{
1383 struct myri10ge_priv *mgp = netdev_priv(netdev);
1384 return mgp->msg_enable;
1385}
1386
1358static struct ethtool_ops myri10ge_ethtool_ops = { 1387static struct ethtool_ops myri10ge_ethtool_ops = {
1359 .get_settings = myri10ge_get_settings, 1388 .get_settings = myri10ge_get_settings,
1360 .get_drvinfo = myri10ge_get_drvinfo, 1389 .get_drvinfo = myri10ge_get_drvinfo,
@@ -1375,7 +1404,9 @@ static struct ethtool_ops myri10ge_ethtool_ops = {
1375#endif 1404#endif
1376 .get_strings = myri10ge_get_strings, 1405 .get_strings = myri10ge_get_strings,
1377 .get_stats_count = myri10ge_get_stats_count, 1406 .get_stats_count = myri10ge_get_stats_count,
1378 .get_ethtool_stats = myri10ge_get_ethtool_stats 1407 .get_ethtool_stats = myri10ge_get_ethtool_stats,
1408 .set_msglevel = myri10ge_set_msglevel,
1409 .get_msglevel = myri10ge_get_msglevel
1379}; 1410};
1380 1411
1381static int myri10ge_allocate_rings(struct net_device *dev) 1412static int myri10ge_allocate_rings(struct net_device *dev)
@@ -2587,6 +2618,7 @@ static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
2587 mgp->csum_flag = MXGEFW_FLAGS_CKSUM; 2618 mgp->csum_flag = MXGEFW_FLAGS_CKSUM;
2588 mgp->pause = myri10ge_flow_control; 2619 mgp->pause = myri10ge_flow_control;
2589 mgp->intr_coal_delay = myri10ge_intr_coal_delay; 2620 mgp->intr_coal_delay = myri10ge_intr_coal_delay;
2621 mgp->msg_enable = netif_msg_init(myri10ge_debug, MYRI10GE_MSG_DEFAULT);
2590 init_waitqueue_head(&mgp->down_wq); 2622 init_waitqueue_head(&mgp->down_wq);
2591 2623
2592 if (pci_enable_device(pdev)) { 2624 if (pci_enable_device(pdev)) {