aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/myri10ge
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/myri10ge')
-rw-r--r--drivers/net/myri10ge/myri10ge.c229
1 files changed, 93 insertions, 136 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index f3624517cb0e..ecde0876a785 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -38,6 +38,8 @@
38 * Myricom, Inc., 325N Santa Anita Avenue, Arcadia, CA 91006 38 * Myricom, Inc., 325N Santa Anita Avenue, Arcadia, CA 91006
39 *************************************************************************/ 39 *************************************************************************/
40 40
41#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
42
41#include <linux/tcp.h> 43#include <linux/tcp.h>
42#include <linux/netdevice.h> 44#include <linux/netdevice.h>
43#include <linux/skbuff.h> 45#include <linux/skbuff.h>
@@ -62,6 +64,7 @@
62#include <linux/moduleparam.h> 64#include <linux/moduleparam.h>
63#include <linux/io.h> 65#include <linux/io.h>
64#include <linux/log2.h> 66#include <linux/log2.h>
67#include <linux/slab.h>
65#include <net/checksum.h> 68#include <net/checksum.h>
66#include <net/ip.h> 69#include <net/ip.h>
67#include <net/tcp.h> 70#include <net/tcp.h>
@@ -75,7 +78,7 @@
75#include "myri10ge_mcp.h" 78#include "myri10ge_mcp.h"
76#include "myri10ge_mcp_gen_header.h" 79#include "myri10ge_mcp_gen_header.h"
77 80
78#define MYRI10GE_VERSION_STR "1.5.1-1.451" 81#define MYRI10GE_VERSION_STR "1.5.2-1.459"
79 82
80MODULE_DESCRIPTION("Myricom 10G driver (10GbE)"); 83MODULE_DESCRIPTION("Myricom 10G driver (10GbE)");
81MODULE_AUTHOR("Maintainer: help@myri.com"); 84MODULE_AUTHOR("Maintainer: help@myri.com");
@@ -207,7 +210,6 @@ struct myri10ge_priv {
207 int big_bytes; 210 int big_bytes;
208 int max_intr_slots; 211 int max_intr_slots;
209 struct net_device *dev; 212 struct net_device *dev;
210 struct net_device_stats stats;
211 spinlock_t stats_lock; 213 spinlock_t stats_lock;
212 u8 __iomem *sram; 214 u8 __iomem *sram;
213 int sram_size; 215 int sram_size;
@@ -264,6 +266,10 @@ static char *myri10ge_fw_unaligned = "myri10ge_ethp_z8e.dat";
264static char *myri10ge_fw_aligned = "myri10ge_eth_z8e.dat"; 266static char *myri10ge_fw_aligned = "myri10ge_eth_z8e.dat";
265static char *myri10ge_fw_rss_unaligned = "myri10ge_rss_ethp_z8e.dat"; 267static char *myri10ge_fw_rss_unaligned = "myri10ge_rss_ethp_z8e.dat";
266static char *myri10ge_fw_rss_aligned = "myri10ge_rss_eth_z8e.dat"; 268static char *myri10ge_fw_rss_aligned = "myri10ge_rss_eth_z8e.dat";
269MODULE_FIRMWARE("myri10ge_ethp_z8e.dat");
270MODULE_FIRMWARE("myri10ge_eth_z8e.dat");
271MODULE_FIRMWARE("myri10ge_rss_ethp_z8e.dat");
272MODULE_FIRMWARE("myri10ge_rss_eth_z8e.dat");
267 273
268static char *myri10ge_fw_name = NULL; 274static char *myri10ge_fw_name = NULL;
269module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR); 275module_param(myri10ge_fw_name, charp, S_IRUGO | S_IWUSR);
@@ -344,7 +350,7 @@ static int myri10ge_max_slices = 1;
344module_param(myri10ge_max_slices, int, S_IRUGO); 350module_param(myri10ge_max_slices, int, S_IRUGO);
345MODULE_PARM_DESC(myri10ge_max_slices, "Max tx/rx queues"); 351MODULE_PARM_DESC(myri10ge_max_slices, "Max tx/rx queues");
346 352
347static int myri10ge_rss_hash = MXGEFW_RSS_HASH_TYPE_SRC_PORT; 353static int myri10ge_rss_hash = MXGEFW_RSS_HASH_TYPE_SRC_DST_PORT;
348module_param(myri10ge_rss_hash, int, S_IRUGO); 354module_param(myri10ge_rss_hash, int, S_IRUGO);
349MODULE_PARM_DESC(myri10ge_rss_hash, "Type of RSS hashing to do"); 355MODULE_PARM_DESC(myri10ge_rss_hash, "Type of RSS hashing to do");
350 356
@@ -407,8 +413,8 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
407 * and try to get the completion quickly 413 * and try to get the completion quickly
408 * (1ms will be enough for those commands) */ 414 * (1ms will be enough for those commands) */
409 for (sleep_total = 0; 415 for (sleep_total = 0;
410 sleep_total < 1000 416 sleep_total < 1000 &&
411 && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT); 417 response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT);
412 sleep_total += 10) { 418 sleep_total += 10) {
413 udelay(10); 419 udelay(10);
414 mb(); 420 mb();
@@ -416,8 +422,8 @@ myri10ge_send_cmd(struct myri10ge_priv *mgp, u32 cmd,
416 } else { 422 } else {
417 /* use msleep for most command */ 423 /* use msleep for most command */
418 for (sleep_total = 0; 424 for (sleep_total = 0;
419 sleep_total < 15 425 sleep_total < 15 &&
420 && response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT); 426 response->result == htonl(MYRI10GE_NO_RESPONSE_RESULT);
421 sleep_total++) 427 sleep_total++)
422 msleep(1); 428 msleep(1);
423 } 429 }
@@ -554,8 +560,8 @@ myri10ge_validate_firmware(struct myri10ge_priv *mgp,
554 sscanf(mgp->fw_version, "%d.%d.%d", &mgp->fw_ver_major, 560 sscanf(mgp->fw_version, "%d.%d.%d", &mgp->fw_ver_major,
555 &mgp->fw_ver_minor, &mgp->fw_ver_tiny); 561 &mgp->fw_ver_minor, &mgp->fw_ver_tiny);
556 562
557 if (!(mgp->fw_ver_major == MXGEFW_VERSION_MAJOR 563 if (!(mgp->fw_ver_major == MXGEFW_VERSION_MAJOR &&
558 && mgp->fw_ver_minor == MXGEFW_VERSION_MINOR)) { 564 mgp->fw_ver_minor == MXGEFW_VERSION_MINOR)) {
559 dev_err(dev, "Found firmware version %s\n", mgp->fw_version); 565 dev_err(dev, "Found firmware version %s\n", mgp->fw_version);
560 dev_err(dev, "Driver needs %d.%d\n", MXGEFW_VERSION_MAJOR, 566 dev_err(dev, "Driver needs %d.%d\n", MXGEFW_VERSION_MAJOR,
561 MXGEFW_VERSION_MINOR); 567 MXGEFW_VERSION_MINOR);
@@ -816,9 +822,7 @@ static int myri10ge_change_pause(struct myri10ge_priv *mgp, int pause)
816 status = myri10ge_send_cmd(mgp, ctl, &cmd, 0); 822 status = myri10ge_send_cmd(mgp, ctl, &cmd, 0);
817 823
818 if (status) { 824 if (status) {
819 printk(KERN_ERR 825 netdev_err(mgp->dev, "Failed to set flow control mode\n");
820 "myri10ge: %s: Failed to set flow control mode\n",
821 mgp->dev->name);
822 return status; 826 return status;
823 } 827 }
824 mgp->pause = pause; 828 mgp->pause = pause;
@@ -834,8 +838,7 @@ myri10ge_change_promisc(struct myri10ge_priv *mgp, int promisc, int atomic)
834 ctl = promisc ? MXGEFW_ENABLE_PROMISC : MXGEFW_DISABLE_PROMISC; 838 ctl = promisc ? MXGEFW_ENABLE_PROMISC : MXGEFW_DISABLE_PROMISC;
835 status = myri10ge_send_cmd(mgp, ctl, &cmd, atomic); 839 status = myri10ge_send_cmd(mgp, ctl, &cmd, atomic);
836 if (status) 840 if (status)
837 printk(KERN_ERR "myri10ge: %s: Failed to set promisc mode\n", 841 netdev_err(mgp->dev, "Failed to set promisc mode\n");
838 mgp->dev->name);
839} 842}
840 843
841static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type) 844static int myri10ge_dma_test(struct myri10ge_priv *mgp, int test_type)
@@ -1198,6 +1201,9 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1198{ 1201{
1199 struct page *page; 1202 struct page *page;
1200 int idx; 1203 int idx;
1204#if MYRI10GE_ALLOC_SIZE > 4096
1205 int end_offset;
1206#endif
1201 1207
1202 if (unlikely(rx->watchdog_needed && !watchdog)) 1208 if (unlikely(rx->watchdog_needed && !watchdog))
1203 return; 1209 return;
@@ -1239,9 +1245,9 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1239 1245
1240#if MYRI10GE_ALLOC_SIZE > 4096 1246#if MYRI10GE_ALLOC_SIZE > 4096
1241 /* don't cross a 4KB boundary */ 1247 /* don't cross a 4KB boundary */
1242 if ((rx->page_offset >> 12) != 1248 end_offset = rx->page_offset + bytes - 1;
1243 ((rx->page_offset + bytes - 1) >> 12)) 1249 if ((unsigned)(rx->page_offset ^ end_offset) > 4095)
1244 rx->page_offset = (rx->page_offset + 4096) & ~4095; 1250 rx->page_offset = end_offset & ~4095;
1245#endif 1251#endif
1246 rx->fill_cnt++; 1252 rx->fill_cnt++;
1247 1253
@@ -1409,8 +1415,8 @@ myri10ge_tx_done(struct myri10ge_slice_state *ss, int mcp_index)
1409 } 1415 }
1410 1416
1411 /* start the queue if we've stopped it */ 1417 /* start the queue if we've stopped it */
1412 if (netif_tx_queue_stopped(dev_queue) 1418 if (netif_tx_queue_stopped(dev_queue) &&
1413 && tx->req - tx->done < (tx->mask >> 1)) { 1419 tx->req - tx->done < (tx->mask >> 1)) {
1414 tx->wake_queue++; 1420 tx->wake_queue++;
1415 netif_tx_wake_queue(dev_queue); 1421 netif_tx_wake_queue(dev_queue);
1416 } 1422 }
@@ -1479,19 +1485,15 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
1479 1485
1480 if (mgp->link_state == MXGEFW_LINK_UP) { 1486 if (mgp->link_state == MXGEFW_LINK_UP) {
1481 if (netif_msg_link(mgp)) 1487 if (netif_msg_link(mgp))
1482 printk(KERN_INFO 1488 netdev_info(mgp->dev, "link up\n");
1483 "myri10ge: %s: link up\n",
1484 mgp->dev->name);
1485 netif_carrier_on(mgp->dev); 1489 netif_carrier_on(mgp->dev);
1486 mgp->link_changes++; 1490 mgp->link_changes++;
1487 } else { 1491 } else {
1488 if (netif_msg_link(mgp)) 1492 if (netif_msg_link(mgp))
1489 printk(KERN_INFO 1493 netdev_info(mgp->dev, "link %s\n",
1490 "myri10ge: %s: link %s\n", 1494 link_up == MXGEFW_LINK_MYRINET ?
1491 mgp->dev->name, 1495 "mismatch (Myrinet detected)" :
1492 (link_up == MXGEFW_LINK_MYRINET ? 1496 "down");
1493 "mismatch (Myrinet detected)" :
1494 "down"));
1495 netif_carrier_off(mgp->dev); 1497 netif_carrier_off(mgp->dev);
1496 mgp->link_changes++; 1498 mgp->link_changes++;
1497 } 1499 }
@@ -1500,9 +1502,8 @@ static inline void myri10ge_check_statblock(struct myri10ge_priv *mgp)
1500 ntohl(stats->rdma_tags_available)) { 1502 ntohl(stats->rdma_tags_available)) {
1501 mgp->rdma_tags_available = 1503 mgp->rdma_tags_available =
1502 ntohl(stats->rdma_tags_available); 1504 ntohl(stats->rdma_tags_available);
1503 printk(KERN_WARNING "myri10ge: %s: RDMA timed out! " 1505 netdev_warn(mgp->dev, "RDMA timed out! %d tags left\n",
1504 "%d tags left\n", mgp->dev->name, 1506 mgp->rdma_tags_available);
1505 mgp->rdma_tags_available);
1506 } 1507 }
1507 mgp->down_cnt += stats->link_down; 1508 mgp->down_cnt += stats->link_down;
1508 if (stats->link_down) 1509 if (stats->link_down)
@@ -1573,8 +1574,7 @@ static irqreturn_t myri10ge_intr(int irq, void *arg)
1573 if (send_done_count != tx->pkt_done) 1574 if (send_done_count != tx->pkt_done)
1574 myri10ge_tx_done(ss, (int)send_done_count); 1575 myri10ge_tx_done(ss, (int)send_done_count);
1575 if (unlikely(i > myri10ge_max_irq_loops)) { 1576 if (unlikely(i > myri10ge_max_irq_loops)) {
1576 printk(KERN_WARNING "myri10ge: %s: irq stuck?\n", 1577 netdev_err(mgp->dev, "irq stuck?\n");
1577 mgp->dev->name);
1578 stats->valid = 0; 1578 stats->valid = 0;
1579 schedule_work(&mgp->watchdog_work); 1579 schedule_work(&mgp->watchdog_work);
1580 } 1580 }
@@ -1611,16 +1611,14 @@ myri10ge_get_settings(struct net_device *netdev, struct ethtool_cmd *cmd)
1611 */ 1611 */
1612 ptr = mgp->product_code_string; 1612 ptr = mgp->product_code_string;
1613 if (ptr == NULL) { 1613 if (ptr == NULL) {
1614 printk(KERN_ERR "myri10ge: %s: Missing product code\n", 1614 netdev_err(netdev, "Missing product code\n");
1615 netdev->name);
1616 return 0; 1615 return 0;
1617 } 1616 }
1618 for (i = 0; i < 3; i++, ptr++) { 1617 for (i = 0; i < 3; i++, ptr++) {
1619 ptr = strchr(ptr, '-'); 1618 ptr = strchr(ptr, '-');
1620 if (ptr == NULL) { 1619 if (ptr == NULL) {
1621 printk(KERN_ERR "myri10ge: %s: Invalid product " 1620 netdev_err(netdev, "Invalid product code %s\n",
1622 "code %s\n", netdev->name, 1621 mgp->product_code_string);
1623 mgp->product_code_string);
1624 return 0; 1622 return 0;
1625 } 1623 }
1626 } 1624 }
@@ -1692,7 +1690,7 @@ myri10ge_set_pauseparam(struct net_device *netdev,
1692 if (pause->tx_pause != mgp->pause) 1690 if (pause->tx_pause != mgp->pause)
1693 return myri10ge_change_pause(mgp, pause->tx_pause); 1691 return myri10ge_change_pause(mgp, pause->tx_pause);
1694 if (pause->rx_pause != mgp->pause) 1692 if (pause->rx_pause != mgp->pause)
1695 return myri10ge_change_pause(mgp, pause->tx_pause); 1693 return myri10ge_change_pause(mgp, pause->rx_pause);
1696 if (pause->autoneg != 0) 1694 if (pause->autoneg != 0)
1697 return -EINVAL; 1695 return -EINVAL;
1698 return 0; 1696 return 0;
@@ -1832,7 +1830,7 @@ myri10ge_get_ethtool_stats(struct net_device *netdev,
1832 /* force stats update */ 1830 /* force stats update */
1833 (void)myri10ge_get_stats(netdev); 1831 (void)myri10ge_get_stats(netdev);
1834 for (i = 0; i < MYRI10GE_NET_STATS_LEN; i++) 1832 for (i = 0; i < MYRI10GE_NET_STATS_LEN; i++)
1835 data[i] = ((unsigned long *)&mgp->stats)[i]; 1833 data[i] = ((unsigned long *)&netdev->stats)[i];
1836 1834
1837 data[i++] = (unsigned int)mgp->tx_boundary; 1835 data[i++] = (unsigned int)mgp->tx_boundary;
1838 data[i++] = (unsigned int)mgp->wc_enabled; 1836 data[i++] = (unsigned int)mgp->wc_enabled;
@@ -2006,17 +2004,15 @@ static int myri10ge_allocate_rings(struct myri10ge_slice_state *ss)
2006 mgp->small_bytes + MXGEFW_PAD, 0); 2004 mgp->small_bytes + MXGEFW_PAD, 0);
2007 2005
2008 if (ss->rx_small.fill_cnt < ss->rx_small.mask + 1) { 2006 if (ss->rx_small.fill_cnt < ss->rx_small.mask + 1) {
2009 printk(KERN_ERR 2007 netdev_err(dev, "slice-%d: alloced only %d small bufs\n",
2010 "myri10ge: %s:slice-%d: alloced only %d small bufs\n", 2008 slice, ss->rx_small.fill_cnt);
2011 dev->name, slice, ss->rx_small.fill_cnt);
2012 goto abort_with_rx_small_ring; 2009 goto abort_with_rx_small_ring;
2013 } 2010 }
2014 2011
2015 myri10ge_alloc_rx_pages(mgp, &ss->rx_big, mgp->big_bytes, 0); 2012 myri10ge_alloc_rx_pages(mgp, &ss->rx_big, mgp->big_bytes, 0);
2016 if (ss->rx_big.fill_cnt < ss->rx_big.mask + 1) { 2013 if (ss->rx_big.fill_cnt < ss->rx_big.mask + 1) {
2017 printk(KERN_ERR 2014 netdev_err(dev, "slice-%d: alloced only %d big bufs\n",
2018 "myri10ge: %s:slice-%d: alloced only %d big bufs\n", 2015 slice, ss->rx_big.fill_cnt);
2019 dev->name, slice, ss->rx_big.fill_cnt);
2020 goto abort_with_rx_big_ring; 2016 goto abort_with_rx_big_ring;
2021 } 2017 }
2022 2018
@@ -2355,7 +2351,7 @@ static int myri10ge_open(struct net_device *dev)
2355 mgp->running = MYRI10GE_ETH_STARTING; 2351 mgp->running = MYRI10GE_ETH_STARTING;
2356 status = myri10ge_reset(mgp); 2352 status = myri10ge_reset(mgp);
2357 if (status != 0) { 2353 if (status != 0) {
2358 printk(KERN_ERR "myri10ge: %s: failed reset\n", dev->name); 2354 netdev_err(dev, "failed reset\n");
2359 goto abort_with_nothing; 2355 goto abort_with_nothing;
2360 } 2356 }
2361 2357
@@ -2367,9 +2363,7 @@ static int myri10ge_open(struct net_device *dev)
2367 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ENABLE_RSS_QUEUES, 2363 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ENABLE_RSS_QUEUES,
2368 &cmd, 0); 2364 &cmd, 0);
2369 if (status != 0) { 2365 if (status != 0) {
2370 printk(KERN_ERR 2366 netdev_err(dev, "failed to set number of slices\n");
2371 "myri10ge: %s: failed to set number of slices\n",
2372 dev->name);
2373 goto abort_with_nothing; 2367 goto abort_with_nothing;
2374 } 2368 }
2375 /* setup the indirection table */ 2369 /* setup the indirection table */
@@ -2381,9 +2375,7 @@ static int myri10ge_open(struct net_device *dev)
2381 MXGEFW_CMD_GET_RSS_TABLE_OFFSET, 2375 MXGEFW_CMD_GET_RSS_TABLE_OFFSET,
2382 &cmd, 0); 2376 &cmd, 0);
2383 if (status != 0) { 2377 if (status != 0) {
2384 printk(KERN_ERR 2378 netdev_err(dev, "failed to setup rss tables\n");
2385 "myri10ge: %s: failed to setup rss tables\n",
2386 dev->name);
2387 goto abort_with_nothing; 2379 goto abort_with_nothing;
2388 } 2380 }
2389 2381
@@ -2397,9 +2389,7 @@ static int myri10ge_open(struct net_device *dev)
2397 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_RSS_ENABLE, 2389 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_RSS_ENABLE,
2398 &cmd, 0); 2390 &cmd, 0);
2399 if (status != 0) { 2391 if (status != 0) {
2400 printk(KERN_ERR 2392 netdev_err(dev, "failed to enable slices\n");
2401 "myri10ge: %s: failed to enable slices\n",
2402 dev->name);
2403 goto abort_with_nothing; 2393 goto abort_with_nothing;
2404 } 2394 }
2405 } 2395 }
@@ -2447,9 +2437,7 @@ static int myri10ge_open(struct net_device *dev)
2447 2437
2448 status = myri10ge_get_txrx(mgp, slice); 2438 status = myri10ge_get_txrx(mgp, slice);
2449 if (status != 0) { 2439 if (status != 0) {
2450 printk(KERN_ERR 2440 netdev_err(dev, "failed to get ring sizes or locations\n");
2451 "myri10ge: %s: failed to get ring sizes or locations\n",
2452 dev->name);
2453 goto abort_with_rings; 2441 goto abort_with_rings;
2454 } 2442 }
2455 status = myri10ge_allocate_rings(ss); 2443 status = myri10ge_allocate_rings(ss);
@@ -2462,9 +2450,7 @@ static int myri10ge_open(struct net_device *dev)
2462 if (slice == 0 || mgp->dev->real_num_tx_queues > 1) 2450 if (slice == 0 || mgp->dev->real_num_tx_queues > 1)
2463 status = myri10ge_set_stats(mgp, slice); 2451 status = myri10ge_set_stats(mgp, slice);
2464 if (status) { 2452 if (status) {
2465 printk(KERN_ERR 2453 netdev_err(dev, "Couldn't set stats DMA\n");
2466 "myri10ge: %s: Couldn't set stats DMA\n",
2467 dev->name);
2468 goto abort_with_rings; 2454 goto abort_with_rings;
2469 } 2455 }
2470 2456
@@ -2495,8 +2481,7 @@ static int myri10ge_open(struct net_device *dev)
2495 status |= 2481 status |=
2496 myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_BIG_BUFFER_SIZE, &cmd, 0); 2482 myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_BIG_BUFFER_SIZE, &cmd, 0);
2497 if (status) { 2483 if (status) {
2498 printk(KERN_ERR "myri10ge: %s: Couldn't set buffer sizes\n", 2484 netdev_err(dev, "Couldn't set buffer sizes\n");
2499 dev->name);
2500 goto abort_with_rings; 2485 goto abort_with_rings;
2501 } 2486 }
2502 2487
@@ -2508,8 +2493,7 @@ static int myri10ge_open(struct net_device *dev)
2508 cmd.data0 = 0; 2493 cmd.data0 = 0;
2509 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_TSO_MODE, &cmd, 0); 2494 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_SET_TSO_MODE, &cmd, 0);
2510 if (status && status != -ENOSYS) { 2495 if (status && status != -ENOSYS) {
2511 printk(KERN_ERR "myri10ge: %s: Couldn't set TSO mode\n", 2496 netdev_err(dev, "Couldn't set TSO mode\n");
2512 dev->name);
2513 goto abort_with_rings; 2497 goto abort_with_rings;
2514 } 2498 }
2515 2499
@@ -2518,8 +2502,7 @@ static int myri10ge_open(struct net_device *dev)
2518 2502
2519 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_UP, &cmd, 0); 2503 status = myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_UP, &cmd, 0);
2520 if (status) { 2504 if (status) {
2521 printk(KERN_ERR "myri10ge: %s: Couldn't bring up link\n", 2505 netdev_err(dev, "Couldn't bring up link\n");
2522 dev->name);
2523 goto abort_with_rings; 2506 goto abort_with_rings;
2524 } 2507 }
2525 2508
@@ -2572,15 +2555,12 @@ static int myri10ge_close(struct net_device *dev)
2572 status = 2555 status =
2573 myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_DOWN, &cmd, 0); 2556 myri10ge_send_cmd(mgp, MXGEFW_CMD_ETHERNET_DOWN, &cmd, 0);
2574 if (status) 2557 if (status)
2575 printk(KERN_ERR 2558 netdev_err(dev, "Couldn't bring down link\n");
2576 "myri10ge: %s: Couldn't bring down link\n",
2577 dev->name);
2578 2559
2579 wait_event_timeout(mgp->down_wq, old_down_cnt != mgp->down_cnt, 2560 wait_event_timeout(mgp->down_wq, old_down_cnt != mgp->down_cnt,
2580 HZ); 2561 HZ);
2581 if (old_down_cnt == mgp->down_cnt) 2562 if (old_down_cnt == mgp->down_cnt)
2582 printk(KERN_ERR "myri10ge: %s never got down irq\n", 2563 netdev_err(dev, "never got down irq\n");
2583 dev->name);
2584 } 2564 }
2585 netif_tx_disable(dev); 2565 netif_tx_disable(dev);
2586 myri10ge_free_irq(mgp); 2566 myri10ge_free_irq(mgp);
@@ -2941,9 +2921,7 @@ abort_linearize:
2941 idx = (idx + 1) & tx->mask; 2921 idx = (idx + 1) & tx->mask;
2942 } while (idx != last_idx); 2922 } while (idx != last_idx);
2943 if (skb_is_gso(skb)) { 2923 if (skb_is_gso(skb)) {
2944 printk(KERN_ERR 2924 netdev_err(mgp->dev, "TSO but wanted to linearize?!?!?\n");
2945 "myri10ge: %s: TSO but wanted to linearize?!?!?\n",
2946 mgp->dev->name);
2947 goto drop; 2925 goto drop;
2948 } 2926 }
2949 2927
@@ -3002,7 +2980,7 @@ static struct net_device_stats *myri10ge_get_stats(struct net_device *dev)
3002{ 2980{
3003 struct myri10ge_priv *mgp = netdev_priv(dev); 2981 struct myri10ge_priv *mgp = netdev_priv(dev);
3004 struct myri10ge_slice_netstats *slice_stats; 2982 struct myri10ge_slice_netstats *slice_stats;
3005 struct net_device_stats *stats = &mgp->stats; 2983 struct net_device_stats *stats = &dev->stats;
3006 int i; 2984 int i;
3007 2985
3008 spin_lock(&mgp->stats_lock); 2986 spin_lock(&mgp->stats_lock);
@@ -3040,8 +3018,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3040 3018
3041 err = myri10ge_send_cmd(mgp, MXGEFW_ENABLE_ALLMULTI, &cmd, 1); 3019 err = myri10ge_send_cmd(mgp, MXGEFW_ENABLE_ALLMULTI, &cmd, 1);
3042 if (err != 0) { 3020 if (err != 0) {
3043 printk(KERN_ERR "myri10ge: %s: Failed MXGEFW_ENABLE_ALLMULTI," 3021 netdev_err(dev, "Failed MXGEFW_ENABLE_ALLMULTI, error status: %d\n",
3044 " error status: %d\n", dev->name, err); 3022 err);
3045 goto abort; 3023 goto abort;
3046 } 3024 }
3047 3025
@@ -3055,14 +3033,13 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3055 err = myri10ge_send_cmd(mgp, MXGEFW_LEAVE_ALL_MULTICAST_GROUPS, 3033 err = myri10ge_send_cmd(mgp, MXGEFW_LEAVE_ALL_MULTICAST_GROUPS,
3056 &cmd, 1); 3034 &cmd, 1);
3057 if (err != 0) { 3035 if (err != 0) {
3058 printk(KERN_ERR 3036 netdev_err(dev, "Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS, error status: %d\n",
3059 "myri10ge: %s: Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS" 3037 err);
3060 ", error status: %d\n", dev->name, err);
3061 goto abort; 3038 goto abort;
3062 } 3039 }
3063 3040
3064 /* Walk the multicast list, and add each address */ 3041 /* Walk the multicast list, and add each address */
3065 for (mc_list = dev->mc_list; mc_list != NULL; mc_list = mc_list->next) { 3042 netdev_for_each_mc_addr(mc_list, dev) {
3066 memcpy(data, &mc_list->dmi_addr, 6); 3043 memcpy(data, &mc_list->dmi_addr, 6);
3067 cmd.data0 = ntohl(data[0]); 3044 cmd.data0 = ntohl(data[0]);
3068 cmd.data1 = ntohl(data[1]); 3045 cmd.data1 = ntohl(data[1]);
@@ -3070,18 +3047,16 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3070 &cmd, 1); 3047 &cmd, 1);
3071 3048
3072 if (err != 0) { 3049 if (err != 0) {
3073 printk(KERN_ERR "myri10ge: %s: Failed " 3050 netdev_err(dev, "Failed MXGEFW_JOIN_MULTICAST_GROUP, error status:%d %pM\n",
3074 "MXGEFW_JOIN_MULTICAST_GROUP, error status:" 3051 err, mc_list->dmi_addr);
3075 "%d\t", dev->name, err);
3076 printk(KERN_ERR "MAC %pM\n", mc_list->dmi_addr);
3077 goto abort; 3052 goto abort;
3078 } 3053 }
3079 } 3054 }
3080 /* Enable multicast filtering */ 3055 /* Enable multicast filtering */
3081 err = myri10ge_send_cmd(mgp, MXGEFW_DISABLE_ALLMULTI, &cmd, 1); 3056 err = myri10ge_send_cmd(mgp, MXGEFW_DISABLE_ALLMULTI, &cmd, 1);
3082 if (err != 0) { 3057 if (err != 0) {
3083 printk(KERN_ERR "myri10ge: %s: Failed MXGEFW_DISABLE_ALLMULTI," 3058 netdev_err(dev, "Failed MXGEFW_DISABLE_ALLMULTI, error status: %d\n",
3084 "error status: %d\n", dev->name, err); 3059 err);
3085 goto abort; 3060 goto abort;
3086 } 3061 }
3087 3062
@@ -3102,9 +3077,8 @@ static int myri10ge_set_mac_address(struct net_device *dev, void *addr)
3102 3077
3103 status = myri10ge_update_mac_address(mgp, sa->sa_data); 3078 status = myri10ge_update_mac_address(mgp, sa->sa_data);
3104 if (status != 0) { 3079 if (status != 0) {
3105 printk(KERN_ERR 3080 netdev_err(dev, "changing mac address failed with %d\n",
3106 "myri10ge: %s: changing mac address failed with %d\n", 3081 status);
3107 dev->name, status);
3108 return status; 3082 return status;
3109 } 3083 }
3110 3084
@@ -3119,12 +3093,10 @@ static int myri10ge_change_mtu(struct net_device *dev, int new_mtu)
3119 int error = 0; 3093 int error = 0;
3120 3094
3121 if ((new_mtu < 68) || (ETH_HLEN + new_mtu > MYRI10GE_MAX_ETHER_MTU)) { 3095 if ((new_mtu < 68) || (ETH_HLEN + new_mtu > MYRI10GE_MAX_ETHER_MTU)) {
3122 printk(KERN_ERR "myri10ge: %s: new mtu (%d) is not valid\n", 3096 netdev_err(dev, "new mtu (%d) is not valid\n", new_mtu);
3123 dev->name, new_mtu);
3124 return -EINVAL; 3097 return -EINVAL;
3125 } 3098 }
3126 printk(KERN_INFO "%s: changing mtu from %d to %d\n", 3099 netdev_info(dev, "changing mtu from %d to %d\n", dev->mtu, new_mtu);
3127 dev->name, dev->mtu, new_mtu);
3128 if (mgp->running) { 3100 if (mgp->running) {
3129 /* if we change the mtu on an active device, we must 3101 /* if we change the mtu on an active device, we must
3130 * reset the device so the firmware sees the change */ 3102 * reset the device so the firmware sees the change */
@@ -3353,7 +3325,7 @@ static int myri10ge_suspend(struct pci_dev *pdev, pm_message_t state)
3353 3325
3354 netif_device_detach(netdev); 3326 netif_device_detach(netdev);
3355 if (netif_running(netdev)) { 3327 if (netif_running(netdev)) {
3356 printk(KERN_INFO "myri10ge: closing %s\n", netdev->name); 3328 netdev_info(netdev, "closing\n");
3357 rtnl_lock(); 3329 rtnl_lock();
3358 myri10ge_close(netdev); 3330 myri10ge_close(netdev);
3359 rtnl_unlock(); 3331 rtnl_unlock();
@@ -3380,8 +3352,7 @@ static int myri10ge_resume(struct pci_dev *pdev)
3380 msleep(5); /* give card time to respond */ 3352 msleep(5); /* give card time to respond */
3381 pci_read_config_word(mgp->pdev, PCI_VENDOR_ID, &vendor); 3353 pci_read_config_word(mgp->pdev, PCI_VENDOR_ID, &vendor);
3382 if (vendor == 0xffff) { 3354 if (vendor == 0xffff) {
3383 printk(KERN_ERR "myri10ge: %s: device disappeared!\n", 3355 netdev_err(mgp->dev, "device disappeared!\n");
3384 mgp->dev->name);
3385 return -EIO; 3356 return -EIO;
3386 } 3357 }
3387 3358
@@ -3460,10 +3431,9 @@ static void myri10ge_watchdog(struct work_struct *work)
3460 * if the card rebooted due to a parity error 3431 * if the card rebooted due to a parity error
3461 * For now, just report it */ 3432 * For now, just report it */
3462 reboot = myri10ge_read_reboot(mgp); 3433 reboot = myri10ge_read_reboot(mgp);
3463 printk(KERN_ERR 3434 netdev_err(mgp->dev, "NIC rebooted (0x%x),%s resetting\n",
3464 "myri10ge: %s: NIC rebooted (0x%x),%s resetting\n", 3435 reboot,
3465 mgp->dev->name, reboot, 3436 myri10ge_reset_recover ? "" : " not");
3466 myri10ge_reset_recover ? " " : " not");
3467 if (myri10ge_reset_recover == 0) 3437 if (myri10ge_reset_recover == 0)
3468 return; 3438 return;
3469 rtnl_lock(); 3439 rtnl_lock();
@@ -3491,31 +3461,26 @@ static void myri10ge_watchdog(struct work_struct *work)
3491 if (cmd == 0xffff) { 3461 if (cmd == 0xffff) {
3492 pci_read_config_word(mgp->pdev, PCI_VENDOR_ID, &vendor); 3462 pci_read_config_word(mgp->pdev, PCI_VENDOR_ID, &vendor);
3493 if (vendor == 0xffff) { 3463 if (vendor == 0xffff) {
3494 printk(KERN_ERR 3464 netdev_err(mgp->dev, "device disappeared!\n");
3495 "myri10ge: %s: device disappeared!\n",
3496 mgp->dev->name);
3497 return; 3465 return;
3498 } 3466 }
3499 } 3467 }
3500 /* Perhaps it is a software error. Try to reset */ 3468 /* Perhaps it is a software error. Try to reset */
3501 3469
3502 printk(KERN_ERR "myri10ge: %s: device timeout, resetting\n", 3470 netdev_err(mgp->dev, "device timeout, resetting\n");
3503 mgp->dev->name);
3504 for (i = 0; i < mgp->num_slices; i++) { 3471 for (i = 0; i < mgp->num_slices; i++) {
3505 tx = &mgp->ss[i].tx; 3472 tx = &mgp->ss[i].tx;
3506 printk(KERN_INFO 3473 netdev_err(mgp->dev, "(%d): %d %d %d %d %d %d\n",
3507 "myri10ge: %s: (%d): %d %d %d %d %d %d\n", 3474 i, tx->queue_active, tx->req,
3508 mgp->dev->name, i, tx->queue_active, tx->req, 3475 tx->done, tx->pkt_start, tx->pkt_done,
3509 tx->done, tx->pkt_start, tx->pkt_done, 3476 (int)ntohl(mgp->ss[i].fw_stats->
3510 (int)ntohl(mgp->ss[i].fw_stats-> 3477 send_done_count));
3511 send_done_count));
3512 msleep(2000); 3478 msleep(2000);
3513 printk(KERN_INFO 3479 netdev_info(mgp->dev, "(%d): %d %d %d %d %d %d\n",
3514 "myri10ge: %s: (%d): %d %d %d %d %d %d\n", 3480 i, tx->queue_active, tx->req,
3515 mgp->dev->name, i, tx->queue_active, tx->req, 3481 tx->done, tx->pkt_start, tx->pkt_done,
3516 tx->done, tx->pkt_start, tx->pkt_done, 3482 (int)ntohl(mgp->ss[i].fw_stats->
3517 (int)ntohl(mgp->ss[i].fw_stats-> 3483 send_done_count));
3518 send_done_count));
3519 } 3484 }
3520 } 3485 }
3521 3486
@@ -3525,8 +3490,7 @@ static void myri10ge_watchdog(struct work_struct *work)
3525 } 3490 }
3526 status = myri10ge_load_firmware(mgp, 1); 3491 status = myri10ge_load_firmware(mgp, 1);
3527 if (status != 0) 3492 if (status != 0)
3528 printk(KERN_ERR "myri10ge: %s: failed to load firmware\n", 3493 netdev_err(mgp->dev, "failed to load firmware\n");
3529 mgp->dev->name);
3530 else 3494 else
3531 myri10ge_open(mgp->dev); 3495 myri10ge_open(mgp->dev);
3532 rtnl_unlock(); 3496 rtnl_unlock();
@@ -3577,14 +3541,10 @@ static void myri10ge_watchdog_timer(unsigned long arg)
3577 /* nic seems like it might be stuck.. */ 3541 /* nic seems like it might be stuck.. */
3578 if (rx_pause_cnt != mgp->watchdog_pause) { 3542 if (rx_pause_cnt != mgp->watchdog_pause) {
3579 if (net_ratelimit()) 3543 if (net_ratelimit())
3580 printk(KERN_WARNING 3544 netdev_err(mgp->dev, "slice %d: TX paused, check link partner\n",
3581 "myri10ge %s slice %d:" 3545 i);
3582 "TX paused, check link partner\n",
3583 mgp->dev->name, i);
3584 } else { 3546 } else {
3585 printk(KERN_WARNING 3547 netdev_warn(mgp->dev, "slice %d stuck:", i);
3586 "myri10ge %s slice %d stuck:",
3587 mgp->dev->name, i);
3588 reset_needed = 1; 3548 reset_needed = 1;
3589 } 3549 }
3590 } 3550 }
@@ -3728,7 +3688,6 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
3728 if (status != 0) { 3688 if (status != 0) {
3729 dev_err(&mgp->pdev->dev, "failed reset\n"); 3689 dev_err(&mgp->pdev->dev, "failed reset\n");
3730 goto abort_with_fw; 3690 goto abort_with_fw;
3731 return;
3732 } 3691 }
3733 3692
3734 mgp->max_intr_slots = cmd.data0 / sizeof(struct mcp_slot); 3693 mgp->max_intr_slots = cmd.data0 / sizeof(struct mcp_slot);
@@ -4082,7 +4041,7 @@ static void myri10ge_remove(struct pci_dev *pdev)
4082#define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E 0x0008 4041#define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E 0x0008
4083#define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E_9 0x0009 4042#define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E_9 0x0009
4084 4043
4085static struct pci_device_id myri10ge_pci_tbl[] = { 4044static DEFINE_PCI_DEVICE_TABLE(myri10ge_pci_tbl) = {
4086 {PCI_DEVICE(PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E)}, 4045 {PCI_DEVICE(PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E)},
4087 {PCI_DEVICE 4046 {PCI_DEVICE
4088 (PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E_9)}, 4047 (PCI_VENDOR_ID_MYRICOM, PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E_9)},
@@ -4124,13 +4083,11 @@ static struct notifier_block myri10ge_dca_notifier = {
4124 4083
4125static __init int myri10ge_init_module(void) 4084static __init int myri10ge_init_module(void)
4126{ 4085{
4127 printk(KERN_INFO "%s: Version %s\n", myri10ge_driver.name, 4086 pr_info("Version %s\n", MYRI10GE_VERSION_STR);
4128 MYRI10GE_VERSION_STR);
4129 4087
4130 if (myri10ge_rss_hash > MXGEFW_RSS_HASH_TYPE_MAX) { 4088 if (myri10ge_rss_hash > MXGEFW_RSS_HASH_TYPE_MAX) {
4131 printk(KERN_ERR 4089 pr_err("Illegal rssh hash type %d, defaulting to source port\n",
4132 "%s: Illegal rssh hash type %d, defaulting to source port\n", 4090 myri10ge_rss_hash);
4133 myri10ge_driver.name, myri10ge_rss_hash);
4134 myri10ge_rss_hash = MXGEFW_RSS_HASH_TYPE_SRC_PORT; 4091 myri10ge_rss_hash = MXGEFW_RSS_HASH_TYPE_SRC_PORT;
4135 } 4092 }
4136#ifdef CONFIG_MYRI10GE_DCA 4093#ifdef CONFIG_MYRI10GE_DCA