41 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
43 #include <linux/tcp.h>
44 #include <linux/netdevice.h>
46 #include <linux/string.h>
47 #include <linux/module.h>
48 #include <linux/pci.h>
51 #include <linux/if_ether.h>
52 #include <linux/if_vlan.h>
58 #include <linux/ethtool.h>
67 #include <linux/slab.h>
68 #include <linux/prefetch.h>
72 #include <asm/byteorder.h>
74 #include <asm/processor.h>
82 #define MYRI10GE_VERSION_STR "1.5.3-1.534"
89 #define MYRI10GE_MAX_ETHER_MTU 9014
91 #define MYRI10GE_ETH_STOPPED 0
92 #define MYRI10GE_ETH_STOPPING 1
93 #define MYRI10GE_ETH_STARTING 2
94 #define MYRI10GE_ETH_RUNNING 3
95 #define MYRI10GE_ETH_OPEN_FAILED 4
97 #define MYRI10GE_EEPROM_STRINGS_SIZE 256
98 #define MYRI10GE_MAX_SEND_DESC_TSO ((65536 / 2048) * 2)
99 #define MYRI10GE_MAX_LRO_DESCRIPTORS 8
100 #define MYRI10GE_LRO_MAX_PKTS 64
102 #define MYRI10GE_NO_CONFIRM_DATA htonl(0xffffffff)
103 #define MYRI10GE_NO_RESPONSE_RESULT 0xffffffff
105 #define MYRI10GE_ALLOC_ORDER 0
106 #define MYRI10GE_ALLOC_SIZE ((1 << MYRI10GE_ALLOC_ORDER) * PAGE_SIZE)
107 #define MYRI10GE_MAX_FRAGS_PER_FRAME (MYRI10GE_MAX_ETHER_MTU/MYRI10GE_ALLOC_SIZE + 1)
109 #define MYRI10GE_MAX_SLICES 32
197 #ifdef CONFIG_MYRI10GE_DCA
226 #ifdef CONFIG_MYRI10GE_DCA
267 static char *myri10ge_fw_unaligned =
"myri10ge_ethp_z8e.dat";
268 static char *myri10ge_fw_aligned =
"myri10ge_eth_z8e.dat";
269 static char *myri10ge_fw_rss_unaligned =
"myri10ge_rss_ethp_z8e.dat";
270 static char *myri10ge_fw_rss_aligned =
"myri10ge_rss_eth_z8e.dat";
277 static char *myri10ge_fw_name =
NULL;
281 #define MYRI10GE_MAX_BOARDS 8
288 static int myri10ge_ecrc_enable = 1;
292 static int myri10ge_small_bytes = -1;
296 static int myri10ge_msi = 1;
300 static int myri10ge_intr_coal_delay = 75;
304 static int myri10ge_flow_control = 1;
308 static int myri10ge_deassert_wait = 1;
311 "Wait when deasserting legacy interrupts");
313 static int myri10ge_force_firmware = 0;
316 "Force firmware to assume aligned completions");
322 static int myri10ge_napi_weight = 64;
326 static int myri10ge_watchdog_timeout = 1;
330 static int myri10ge_max_irq_loops = 1048576;
333 "Set stuck legacy IRQ detection threshold");
335 #define MYRI10GE_MSG_DEFAULT NETIF_MSG_LINK
337 static int myri10ge_debug = -1;
344 "Number of LRO packets to be aggregated");
346 static int myri10ge_fill_thresh = 256;
350 static int myri10ge_reset_recover = 1;
352 static int myri10ge_max_slices = 1;
360 static int myri10ge_dca = 1;
364 #define MYRI10GE_FW_OFFSET 1024*1024
365 #define MYRI10GE_HIGHPART_TO_U32(X) \
366 (sizeof (X) == 8) ? ((u32)((u64)(X) >> 32)) : (0)
367 #define MYRI10GE_LOWPART_TO_U32(X) ((u32)(X))
369 #define myri10ge_pio_copy(to,from,size) __iowrite64_copy(to,from,size/8)
371 static void myri10ge_set_multicast_list(
struct net_device *
dev);
396 char buf_bytes[
sizeof(*buf) + 8];
403 buf = (
struct mcp_cmd *)
ALIGN((
unsigned long)buf_bytes, 8);
427 for (sleep_total = 0;
428 sleep_total < 1000 &&
436 for (sleep_total = 0;
461 "command %d failed, result = %d\n",
467 dev_err(&mgp->
pdev->dev,
"command %d timed out, result = %d\n",
487 while (*ptr !=
'\0' && ptr < limit) {
488 if (
memcmp(ptr,
"MAC=", 4) == 0) {
491 for (i = 0; i < 6; i++) {
492 if ((ptr + 2) > limit)
499 if (
memcmp(ptr,
"PC=", 3) == 0) {
503 if (
memcmp((
const void *)ptr,
"SN=", 3) == 0) {
507 while (ptr < limit && *ptr++) ;
513 dev_err(&mgp->
pdev->dev,
"failed to parse eeprom_strings\n");
526 u32 dma_low, dma_high;
540 buf[0] =
htonl(dma_high);
541 buf[1] =
htonl(dma_low);
543 buf[3] =
htonl(dma_high);
544 buf[4] =
htonl(dma_low);
545 buf[5] =
htonl(enable);
554 (enable ?
"enable" :
"disable"));
587 unsigned crc, reread_crc;
590 unsigned char *fw_readback;
597 dev_err(dev,
"Unable to load %s firmware image via hotplug\n",
600 goto abort_with_nothing;
607 dev_err(dev,
"Firmware size invalid:%d\n", (
int)fw->
size);
614 if ((hdr_offset & 3) || hdr_offset +
sizeof(*hdr) > fw->
size) {
615 dev_err(dev,
"Bad firmware file\n");
619 hdr = (
void *)(fw->
data + hdr_offset);
621 status = myri10ge_validate_firmware(mgp, hdr);
626 for (i = 0; i < fw->
size; i += 256) {
629 min(256
U, (
unsigned)(fw->
size - i)));
640 reread_crc =
crc32(~0, fw_readback, fw->
size);
642 if (crc != reread_crc) {
643 dev_err(dev,
"CRC failed(fw-len=%u), got 0x%x (expect 0x%x)\n",
644 (
unsigned)fw->
size, reread_crc, crc);
657 static int myri10ge_adopt_running_firmware(
struct myri10ge_priv *mgp)
668 if ((hdr_offset & 3) || hdr_offset +
sizeof(*hdr) > mgp->
sram_size) {
669 dev_err(dev,
"Running firmware has bad header offset (%d)\n",
678 dev_err(dev,
"could not malloc firmware hdr\n");
682 status = myri10ge_validate_firmware(mgp, hdr);
691 dev_warn(dev,
"Adopting fw %d.%d.%d: "
692 "working around rx filter bug\n",
699 static int myri10ge_get_firmware_capabilities(
struct myri10ge_priv *mgp)
716 "failed MXGEFW_CMD_GET_RX_RING_SIZE\n");
725 static int myri10ge_load_firmware(
struct myri10ge_priv *mgp,
int adopt)
733 status = myri10ge_load_hotplug_firmware(mgp, &size);
737 dev_warn(&mgp->
pdev->dev,
"hotplug firmware loading failed\n");
744 status = myri10ge_adopt_running_firmware(mgp);
747 "failed to adopt running firmware\n");
751 "Successfully adopted running firmware\n");
754 "Using firmware currently running on NIC"
757 "performance consider loading optimized "
762 set_fw_name(mgp,
"adopted",
false);
764 myri10ge_dummy_rdma(mgp, 1);
765 status = myri10ge_get_firmware_capabilities(mgp);
780 buf[0] =
htonl(dma_high);
781 buf[1] =
htonl(dma_low);
789 buf[4] =
htonl(size - 8);
808 myri10ge_dummy_rdma(mgp, 1);
809 status = myri10ge_get_firmware_capabilities(mgp);
819 cmd.data0 = ((addr[0] << 24) | (addr[1] << 16)
820 | (addr[2] << 8) | addr[3]);
822 cmd.data1 = ((addr[4] << 8) | (addr[5]));
834 status = myri10ge_send_cmd(mgp, ctl, &cmd, 0);
837 netdev_err(mgp->
dev,
"Failed to set flow control mode\n");
845 myri10ge_change_promisc(
struct myri10ge_priv *mgp,
int promisc,
int atomic)
851 status = myri10ge_send_cmd(mgp, ctl, &cmd, atomic);
853 netdev_err(mgp->
dev,
"Failed to set promisc mode\n");
856 static int myri10ge_dma_test(
struct myri10ge_priv *mgp,
int test_type)
861 struct page *dmatest_page;
868 dmatest_bus = pci_map_page(mgp->
pdev, dmatest_page, 0,
PAGE_SIZE,
884 cmd.data2 = len * 0x10000;
885 status = myri10ge_send_cmd(mgp, test_type, &cmd, 0);
890 mgp->
read_dma = ((cmd.data0 >> 16) * len * 2) / (cmd.data0 & 0xffff);
893 cmd.data2 = len * 0x1;
894 status = myri10ge_send_cmd(mgp, test_type, &cmd, 0);
899 mgp->
write_dma = ((cmd.data0 >> 16) * len * 2) / (cmd.data0 & 0xffff);
903 cmd.data2 = len * 0x10001;
904 status = myri10ge_send_cmd(mgp, test_type, &cmd, 0);
910 (cmd.data0 & 0xffff);
917 dev_warn(&mgp->
pdev->dev,
"DMA %s benchmark failed: %d\n",
929 #ifdef CONFIG_MYRI10GE_DCA
930 unsigned long dca_tag_off;
935 memset(&cmd, 0,
sizeof(cmd));
955 cmd.data0 = (
u32) bytes;
976 "failed to get number of slices\n");
986 if (mgp->
dev->real_num_tx_queues > 1)
994 if (status != 0 && mgp->
dev->real_num_tx_queues > 1) {
998 status = myri10ge_send_cmd(mgp,
1005 "failed to set number of slices\n");
1030 status |= myri10ge_send_cmd
1034 dev_err(&mgp->
pdev->dev,
"failed set interrupt parameters\n");
1039 #ifdef CONFIG_MYRI10GE_DCA
1041 dca_tag_off = cmd.data0;
1046 (mgp->
sram + dca_tag_off + 4 * i);
1062 ss->
tx.pkt_start = 0;
1063 ss->
tx.pkt_done = 0;
1068 ss->
tx.wake_queue = 0;
1069 ss->
tx.stop_queue = 0;
1072 status = myri10ge_update_mac_address(mgp, mgp->
dev->dev_addr);
1073 myri10ge_change_pause(mgp, mgp->
pause);
1074 myri10ge_set_multicast_list(mgp->
dev);
1078 #ifdef CONFIG_MYRI10GE_DCA
1079 static int myri10ge_toggle_relaxed(
struct pci_dev *pdev,
int on)
1098 ss->cached_dca_tag =
tag;
1099 put_be32(
htonl(tag), ss->dca_tag);
1107 if (cpu != ss->cpu) {
1109 if (ss->cached_dca_tag != tag)
1110 myri10ge_write_dca(ss, cpu, tag);
1121 if (mgp->
ss[0].dca_tag ==
NULL || mgp->dca_enabled)
1123 if (!myri10ge_dca) {
1124 dev_err(&pdev->
dev,
"dca disabled by administrator\n");
1131 "dca_add_requester() failed, err=%d\n", err);
1134 mgp->relaxed_order = myri10ge_toggle_relaxed(pdev, 0);
1135 mgp->dca_enabled = 1;
1137 mgp->
ss[
i].cpu = -1;
1138 mgp->
ss[
i].cached_dca_tag = -1;
1139 myri10ge_update_dca(&mgp->
ss[i]);
1143 static void myri10ge_teardown_dca(
struct myri10ge_priv *mgp)
1147 if (!mgp->dca_enabled)
1149 mgp->dca_enabled = 0;
1150 if (mgp->relaxed_order)
1151 myri10ge_toggle_relaxed(pdev, 1);
1155 static int myri10ge_notify_dca_device(
struct device *dev,
void *data)
1158 unsigned long event;
1161 event = *(
unsigned long *)data;
1164 myri10ge_setup_dca(mgp);
1166 myri10ge_teardown_dca(mgp);
1184 put_be32(low, &dst->addr_low);
1188 static inline void myri10ge_vlan_ip_csum(
struct sk_buff *
skb,
__wsum hw_csum)
1195 skb->
csum = hw_csum;
1201 myri10ge_rx_skb_build(
struct sk_buff *skb,
u8 *
va,
1209 skb_frags = skb_shinfo(skb)->frags;
1211 memcpy(skb_frags, rx_frags,
sizeof(*skb_frags));
1212 len -= skb_frag_size(rx_frags);
1215 skb_shinfo(skb)->nr_frags++;
1222 skb_copy_to_linear_data(skb, va, hlen);
1223 skb_shinfo(skb)->frags[0].page_offset += hlen;
1224 skb_frag_size_sub(&skb_shinfo(skb)->frags[0], hlen);
1236 #if MYRI10GE_ALLOC_SIZE > 4096
1261 rx->
bus = pci_map_page(mgp->
pdev, page, 0,
1278 #if MYRI10GE_ALLOC_SIZE > 4096
1281 if ((
unsigned)(rx->
page_offset ^ end_offset) > 4095)
1287 if ((idx & 7) == 7) {
1288 myri10ge_submit_8rx(&rx->
lanai[idx - 7],
1295 myri10ge_unmap_rx_page(
struct pci_dev *pdev,
1307 #define MYRI10GE_HLEN 64
1323 if (len <= mgp->small_bytes) {
1336 for (i = 0, remainder = len; remainder > 0; i++) {
1337 myri10ge_unmap_rx_page(pdev, &rx->
info[idx], bytes);
1338 __skb_frag_set_page(&rx_frags[i], rx->
info[idx].page);
1341 skb_frag_size_set(&rx_frags[i], remainder);
1356 (
void *)(
__force unsigned long)csum, csum);
1368 ss->
stats.rx_dropped++;
1371 __skb_frag_unref(&rx_frags[i]);
1377 myri10ge_rx_skb_build(skb, va, rx_frags, len, hlen);
1378 if (skb_frag_size(&skb_shinfo(skb)->frags[0]) <= 0) {
1379 skb_frag_unref(skb, 0);
1380 skb_shinfo(skb)->nr_frags = 0;
1382 skb->
truesize += bytes * skb_shinfo(skb)->nr_frags;
1385 skb_record_rx_queue(skb, ss - &mgp->
ss[0]);
1393 myri10ge_vlan_ip_csum(skb, csum);
1408 while (tx->
pkt_done != mcp_index) {
1409 idx = tx->done & tx->
mask;
1414 if (tx->
info[idx].last) {
1423 ss->
stats.tx_packets++;
1426 pci_unmap_single(pdev,
1432 pci_unmap_page(pdev,
1439 dev_queue = netdev_get_tx_queue(ss->
dev, ss - ss->
mgp->ss);
1449 if ((ss->
mgp->dev->real_num_tx_queues > 1) &&
1450 __netif_tx_trylock(dev_queue)) {
1451 if (tx->req == tx->done) {
1457 __netif_tx_unlock(dev_queue);
1461 if (netif_tx_queue_stopped(dev_queue) &&
1462 tx->req - tx->done < (tx->
mask >> 1) &&
1465 netif_tx_wake_queue(dev_queue);
1476 unsigned long rx_ok;
1477 int idx = rx_done->
idx;
1490 while (rx_done->
entry[idx].length != 0 && work_done < budget) {
1493 checksum = csum_unfold(rx_done->
entry[idx].checksum);
1495 rx_packets += rx_ok;
1496 rx_bytes += rx_ok * (
unsigned long)length;
1511 myri10ge_alloc_rx_pages(mgp, &ss->
rx_small,
1513 if (ss->
rx_big.fill_cnt - ss->
rx_big.cnt < myri10ge_fill_thresh)
1519 static inline void myri10ge_check_statblock(
struct myri10ge_priv *mgp)
1535 "mismatch (Myrinet detected)" :
1545 netdev_warn(mgp->
dev,
"RDMA timed out! %d tags left\n",
1560 #ifdef CONFIG_MYRI10GE_DCA
1561 if (ss->
mgp->dca_enabled)
1562 myri10ge_update_dca(ss);
1566 work_done = myri10ge_clean_rx_done(ss, budget);
1568 if (work_done < budget) {
1581 u32 send_done_count;
1586 if ((mgp->
dev->real_num_tx_queues == 1) && (ss != mgp->
ss)) {
1587 napi_schedule(&ss->
napi);
1597 if (stats->
valid & 1)
1598 napi_schedule(&ss->
napi);
1602 if (!myri10ge_deassert_wait)
1614 if (send_done_count != tx->
pkt_done)
1615 myri10ge_tx_done(ss, (
int)send_done_count);
1616 if (
unlikely(i > myri10ge_max_irq_loops)) {
1617 netdev_warn(mgp->
dev,
"irq stuck?\n");
1629 myri10ge_check_statblock(mgp);
1654 netdev_err(netdev,
"Missing product code\n");
1657 for (i = 0; i < 3; i++, ptr++) {
1660 netdev_err(netdev,
"Invalid product code %s\n",
1667 if (*ptr ==
'R' || *ptr ==
'Q' || *ptr ==
'S') {
1675 if (*ptr ==
'R' || *ptr ==
'S')
1714 myri10ge_get_pauseparam(
struct net_device *netdev,
1725 myri10ge_set_pauseparam(
struct net_device *netdev,
1731 return myri10ge_change_pause(mgp, pause->
tx_pause);
1733 return myri10ge_change_pause(mgp, pause->
rx_pause);
1740 myri10ge_get_ringparam(
struct net_device *netdev,
1756 "rx_packets",
"tx_packets",
"rx_bytes",
"tx_bytes",
"rx_errors",
1757 "tx_errors",
"rx_dropped",
"tx_dropped",
"multicast",
"collisions",
1758 "rx_length_errors",
"rx_over_errors",
"rx_crc_errors",
1759 "rx_frame_errors",
"rx_fifo_errors",
"rx_missed_errors",
1760 "tx_aborted_errors",
"tx_carrier_errors",
"tx_fifo_errors",
1761 "tx_heartbeat_errors",
"tx_window_errors",
1763 "tx_boundary",
"WC",
"irq",
"MSI",
"MSIX",
1764 "read_dma_bw_MBs",
"write_dma_bw_MBs",
"read_write_dma_bw_MBs",
1765 "serial_number",
"watchdog_resets",
1766 #ifdef CONFIG_MYRI10GE_DCA
1767 "dca_capable_firmware",
"dca_device_present",
1769 "link_changes",
"link_up",
"dropped_link_overflow",
1770 "dropped_link_error_or_filtered",
1771 "dropped_pause",
"dropped_bad_phy",
"dropped_bad_crc32",
1772 "dropped_unicast_filtered",
"dropped_multicast_filtered",
1773 "dropped_runt",
"dropped_overrun",
"dropped_no_small_buffer",
1774 "dropped_no_big_buffer"
1777 static const char myri10ge_gstrings_slice_stats[][
ETH_GSTRING_LEN] = {
1778 "----------- slice ---------",
1779 "tx_pkt_start",
"tx_pkt_done",
"tx_req",
"tx_done",
1780 "rx_small_cnt",
"rx_big_cnt",
1781 "wake_queue",
"stop_queue",
"tx_linearized",
1782 "LRO aggregated",
"LRO flushed",
"LRO avg aggr",
"LRO no_desc",
1785 #define MYRI10GE_NET_STATS_LEN 21
1786 #define MYRI10GE_MAIN_STATS_LEN ARRAY_SIZE(myri10ge_gstrings_main_stats)
1787 #define MYRI10GE_SLICE_STATS_LEN ARRAY_SIZE(myri10ge_gstrings_slice_stats)
1790 myri10ge_get_strings(
struct net_device *netdev,
u32 stringset,
u8 * data)
1795 switch (stringset) {
1797 memcpy(data, *myri10ge_gstrings_main_stats,
1798 sizeof(myri10ge_gstrings_main_stats));
1799 data +=
sizeof(myri10ge_gstrings_main_stats);
1801 memcpy(data, *myri10ge_gstrings_slice_stats,
1802 sizeof(myri10ge_gstrings_slice_stats));
1803 data +=
sizeof(myri10ge_gstrings_slice_stats);
1809 static int myri10ge_get_sset_count(
struct net_device *netdev,
int sset)
1823 myri10ge_get_ethtool_stats(
struct net_device *netdev,
1833 memset(&link_stats, 0,
sizeof(link_stats));
1834 (
void)myri10ge_get_stats(netdev, &link_stats);
1836 data[i] = ((
u64 *)&link_stats)[i];
1840 data[i++] = (
unsigned int)mgp->
pdev->irq;
1843 data[i++] = (
unsigned int)mgp->
read_dma;
1848 #ifdef CONFIG_MYRI10GE_DCA
1849 data[i++] = (
unsigned int)(mgp->
ss[0].dca_tag !=
NULL);
1850 data[i++] = (
unsigned int)(mgp->dca_enabled);
1871 for (slice = 0; slice < mgp->
num_slices; slice++) {
1872 ss = &mgp->
ss[slice];
1874 data[i++] = (
unsigned int)ss->
tx.pkt_start;
1875 data[i++] = (
unsigned int)ss->
tx.pkt_done;
1876 data[i++] = (
unsigned int)ss->
tx.req;
1877 data[i++] = (
unsigned int)ss->
tx.done;
1879 data[i++] = (
unsigned int)ss->
rx_big.cnt;
1880 data[i++] = (
unsigned int)ss->
tx.wake_queue;
1881 data[i++] = (
unsigned int)ss->
tx.stop_queue;
1882 data[i++] = (
unsigned int)ss->
tx.linearized;
1883 data[i++] = ss->
rx_done.lro_mgr.stats.aggregated;
1884 data[i++] = ss->
rx_done.lro_mgr.stats.flushed;
1886 data[i++] = ss->
rx_done.lro_mgr.stats.aggregated /
1887 ss->
rx_done.lro_mgr.stats.flushed;
1890 data[i++] = ss->
rx_done.lro_mgr.stats.no_desc;
1894 static void myri10ge_set_msglevel(
struct net_device *netdev,
u32 value)
1915 size_t hdr_off, pattern_off,
hdr_len;
1920 if ((hdr_off & 3) || hdr_off +
sizeof(*hdr) > mgp->
sram_size) {
1921 dev_err(dev,
"Running firmware has bad header offset (%d)\n",
1928 if (pattern_off >= (hdr_len + hdr_off)) {
1929 dev_info(dev,
"Firmware does not support LED identification\n");
1946 rc = myri10ge_led(mgp, 1);
1950 rc = myri10ge_led(mgp, 0);
1960 static const struct ethtool_ops myri10ge_ethtool_ops = {
1961 .get_settings = myri10ge_get_settings,
1962 .get_drvinfo = myri10ge_get_drvinfo,
1963 .get_coalesce = myri10ge_get_coalesce,
1964 .set_coalesce = myri10ge_set_coalesce,
1965 .get_pauseparam = myri10ge_get_pauseparam,
1966 .set_pauseparam = myri10ge_set_pauseparam,
1967 .get_ringparam = myri10ge_get_ringparam,
1969 .get_strings = myri10ge_get_strings,
1970 .get_sset_count = myri10ge_get_sset_count,
1971 .get_ethtool_stats = myri10ge_get_ethtool_stats,
1972 .set_msglevel = myri10ge_set_msglevel,
1973 .get_msglevel = myri10ge_get_msglevel,
1974 .set_phys_id = myri10ge_phys_id,
1982 int tx_ring_size, rx_ring_size;
1983 int tx_ring_entries, rx_ring_entries;
1988 slice = ss - mgp->
ss;
1991 tx_ring_size = cmd.data0;
1996 rx_ring_size = cmd.data0;
1999 rx_ring_entries = rx_ring_size /
sizeof(
struct mcp_dma_addr);
2000 ss->
tx.mask = tx_ring_entries - 1;
2008 *
sizeof(*ss->
tx.req_list);
2010 if (ss->
tx.req_bytes ==
NULL)
2011 goto abort_with_nothing;
2015 ALIGN((
unsigned long)ss->
tx.req_bytes, 8);
2016 ss->
tx.queue_active = 0;
2018 bytes = rx_ring_entries *
sizeof(*ss->
rx_small.shadow);
2021 goto abort_with_tx_req_bytes;
2023 bytes = rx_ring_entries *
sizeof(*ss->
rx_big.shadow);
2026 goto abort_with_rx_small_shadow;
2030 bytes = tx_ring_entries *
sizeof(*ss->
tx.info);
2033 goto abort_with_rx_big_shadow;
2035 bytes = rx_ring_entries *
sizeof(*ss->
rx_small.info);
2038 goto abort_with_tx_info;
2040 bytes = rx_ring_entries *
sizeof(*ss->
rx_big.info);
2043 goto abort_with_rx_small_info;
2053 ss->
rx_big.watchdog_needed = 0;
2057 myri10ge_alloc_rx_pages(mgp, &ss->
rx_small,
2062 netdev_err(dev,
"slice-%d: alloced only %d small bufs\n",
2064 goto abort_with_rx_small_ring;
2069 netdev_err(dev,
"slice-%d: alloced only %d big bufs\n",
2070 slice, ss->
rx_big.fill_cnt);
2071 goto abort_with_rx_big_ring;
2076 abort_with_rx_big_ring:
2077 for (i = ss->
rx_big.cnt; i < ss->rx_big.fill_cnt; i++) {
2078 int idx = i & ss->
rx_big.mask;
2079 myri10ge_unmap_rx_page(mgp->
pdev, &ss->
rx_big.info[idx],
2084 abort_with_rx_small_ring:
2087 for (i = ss->
rx_small.cnt; i < ss->rx_small.fill_cnt; i++) {
2089 myri10ge_unmap_rx_page(mgp->
pdev, &ss->
rx_small.info[idx],
2096 abort_with_rx_small_info:
2102 abort_with_rx_big_shadow:
2105 abort_with_rx_small_shadow:
2108 abort_with_tx_req_bytes:
2125 if (ss->
tx.req_list ==
NULL)
2128 for (i = ss->
rx_big.cnt; i < ss->rx_big.fill_cnt; i++) {
2129 idx = i & ss->
rx_big.mask;
2130 if (i == ss->
rx_big.fill_cnt - 1)
2132 myri10ge_unmap_rx_page(mgp->
pdev, &ss->
rx_big.info[idx],
2139 for (i = ss->
rx_small.cnt; i < ss->rx_small.fill_cnt; i++) {
2141 if (i == ss->
rx_small.fill_cnt - 1)
2144 myri10ge_unmap_rx_page(mgp->
pdev, &ss->
rx_small.info[idx],
2149 while (tx->done != tx->req) {
2150 idx = tx->done & tx->
mask;
2159 ss->
stats.tx_dropped++;
2162 pci_unmap_single(mgp->
pdev,
2168 pci_unmap_page(mgp->
pdev,
2209 "Error %d setting up MSI-X\n", status);
2214 status = pci_enable_msi(pdev);
2217 "Error %d setting up MSI; falling back to xPIC\n",
2228 "%s:slice-%d", netdev->
name, i);
2234 "slice %d failed to allocate IRQ\n", i);
2247 mgp->
dev->name, &mgp->
ss[0]);
2249 dev_err(&pdev->
dev,
"failed to allocate IRQ\n");
2276 void **ip_hdr,
void **tcpudp_hdr,
2282 u8 *va = skb_frag_address(frag);
2283 unsigned long ll_hlen;
2289 eh = (
struct ethhdr *)va;
2313 iph = (
struct iphdr *)(va + ll_hlen);
2317 if (ip_is_fragment(iph))
2320 *tcpudp_hdr = (
u8 *) (*ip_hdr) + (iph->ihl << 2);
2335 static int myri10ge_get_txrx(
struct myri10ge_priv *mgp,
int slice)
2341 ss = &mgp->
ss[slice];
2343 if (slice == 0 || (mgp->
dev->real_num_tx_queues > 1)) {
2348 (mgp->
sram + cmd.data0);
2354 (mgp->
sram + cmd.data0);
2359 (mgp->
sram + cmd.data0);
2369 static int myri10ge_set_stats(
struct myri10ge_priv *mgp,
int slice)
2375 ss = &mgp->
ss[slice];
2378 cmd.data2 =
sizeof(
struct mcp_irq_data) | (slice << 16);
2387 status = myri10ge_send_cmd(mgp,
2398 static int myri10ge_open(
struct net_device *dev)
2403 int i,
status, big_pow2, slice;
2411 status = myri10ge_reset(mgp);
2413 netdev_err(dev,
"failed reset\n");
2414 goto abort_with_nothing;
2420 if (mgp->
dev->real_num_tx_queues > 1)
2425 netdev_err(dev,
"failed to set number of slices\n");
2426 goto abort_with_nothing;
2433 status |= myri10ge_send_cmd(mgp,
2437 netdev_err(dev,
"failed to setup rss tables\n");
2438 goto abort_with_nothing;
2442 itable = mgp->
sram + cmd.data0;
2447 cmd.data1 = myri10ge_rss_hash;
2451 netdev_err(dev,
"failed to enable slices\n");
2452 goto abort_with_nothing;
2456 status = myri10ge_request_irq(mgp);
2458 goto abort_with_nothing;
2476 if (myri10ge_small_bytes >= 0)
2494 for (slice = 0; slice < mgp->
num_slices; slice++) {
2495 ss = &mgp->
ss[slice];
2497 status = myri10ge_get_txrx(mgp, slice);
2499 netdev_err(dev,
"failed to get ring sizes or locations\n");
2500 goto abort_with_rings;
2502 status = myri10ge_allocate_rings(ss);
2504 goto abort_with_rings;
2509 if (slice == 0 || mgp->
dev->real_num_tx_queues > 1)
2510 status = myri10ge_set_stats(mgp, slice);
2512 netdev_err(dev,
"Couldn't set stats DMA\n");
2513 goto abort_with_rings;
2516 lro_mgr = &ss->
rx_done.lro_mgr;
2524 lro_mgr->
max_aggr = myri10ge_lro_max_pkts;
2530 napi_enable(&(ss)->napi);
2539 cmd.data0 = big_pow2;
2543 netdev_err(dev,
"Couldn't set buffer sizes\n");
2544 goto abort_with_rings;
2554 if (status && status != -
ENOSYS) {
2555 netdev_err(dev,
"Couldn't set TSO mode\n");
2556 goto abort_with_rings;
2564 netdev_err(dev,
"Couldn't bring up link\n");
2565 goto abort_with_rings;
2571 netif_tx_wake_all_queues(dev);
2578 napi_disable(&mgp->
ss[slice].napi);
2581 myri10ge_free_rings(&mgp->
ss[i]);
2583 myri10ge_free_irq(mgp);
2590 static int myri10ge_close(
struct net_device *dev)
2594 int status, old_down_cnt;
2600 if (mgp->
ss[0].tx.req_bytes ==
NULL)
2606 napi_disable(&mgp->
ss[i].napi);
2610 netif_tx_stop_all_queues(dev);
2617 netdev_err(dev,
"Couldn't bring down link\n");
2622 netdev_err(dev,
"never got down irq\n");
2624 netif_tx_disable(dev);
2625 myri10ge_free_irq(mgp);
2627 myri10ge_free_rings(&mgp->
ss[i]);
2640 int idx, starting_slot;
2641 starting_slot = tx->req;
2644 idx = (starting_slot +
cnt) & tx->
mask;
2666 idx = tx->req & tx->
mask;
2668 last_flags = src->
flags;
2674 if ((idx + cnt) < tx->
mask) {
2675 for (i = 0; i < (cnt - 1); i += 2) {
2684 myri10ge_submit_req_backwards(tx, src, cnt);
2694 src->
flags = last_flags;
2724 u16 pseudo_hdr_offset, cksum_offset,
queue;
2725 int cum_len, seglen, boundary, rdma_count;
2728 queue = skb_get_queue_mapping(skb);
2729 ss = &mgp->
ss[queue];
2730 netdev_queue = netdev_get_tx_queue(mgp->
dev, queue);
2735 avail = tx->
mask - 1 - (tx->req - tx->done);
2740 if (skb_is_gso(skb)) {
2741 mss = skb_shinfo(skb)->gso_size;
2745 if ((
unlikely(avail < max_segments))) {
2748 netif_tx_stop_queue(netdev_queue);
2754 pseudo_hdr_offset = 0;
2758 cksum_offset = skb_checksum_start_offset(skb);
2759 pseudo_hdr_offset = cksum_offset + skb->
csum_offset;
2762 if (
unlikely(!mss && (cksum_offset > 255 ||
2763 pseudo_hdr_offset > 127))) {
2767 pseudo_hdr_offset = 0;
2784 cum_len = -(skb_transport_offset(skb) + tcp_hdrlen(skb));
2789 if (skb_is_gso_v6(skb)) {
2790 cksum_offset = tcp_hdrlen(skb);
2793 return myri10ge_sw_tso(skb, dev);
2798 pseudo_hdr_offset =
mss;
2809 ss->
stats.tx_dropped += 1;
2819 len = skb_headlen(skb);
2820 idx = tx->req & tx->
mask;
2826 frag_cnt = skb_shinfo(skb)->nr_frags;
2858 if (
unlikely(count == max_segments))
2859 goto abort_linearize;
2863 seglen = boundary -
low;
2867 cum_len_next = cum_len + seglen;
2869 (req - rdma_count)->rdma_count = rdma_count + 1;
2871 if (
likely(cum_len >= 0)) {
2872 int next_is_first, chop;
2874 chop = (cum_len_next >
mss);
2875 cum_len_next = cum_len_next %
mss;
2876 next_is_first = (cum_len_next == 0);
2878 flags_next |= next_is_first *
2880 rdma_count |= -(chop | next_is_first);
2881 rdma_count += chop & !next_is_first;
2882 }
else if (
likely(cum_len_next >= 0)) {
2901 req->
flags = flags | ((cum_len & 1) * odd_flag);
2905 cum_len = cum_len_next;
2910 if (cksum_offset != 0 && !(mss && skb_is_gso_v6(skb))) {
2911 if (
unlikely(cksum_offset > seglen))
2912 cksum_offset -= seglen;
2917 if (frag_idx == frag_cnt)
2921 idx = (count + tx->req) & tx->
mask;
2922 frag = &skb_shinfo(skb)->frags[frag_idx];
2924 len = skb_frag_size(frag);
2925 bus = skb_frag_dma_map(&mgp->
pdev->dev, frag, 0, len,
2931 (req - rdma_count)->rdma_count = rdma_count;
2938 idx = ((count - 1) + tx->req) & tx->
mask;
2940 myri10ge_submit_req(tx, tx->
req_list, count);
2952 netif_tx_stop_queue(netdev_queue);
2961 last_idx = (idx + 1) & tx->
mask;
2962 idx = tx->req & tx->
mask;
2968 pci_unmap_single(mgp->
pdev,
2973 pci_unmap_page(mgp->
pdev,
2980 idx = (idx + 1) & tx->
mask;
2981 }
while (idx != last_idx);
2982 if (skb_is_gso(skb)) {
2983 netdev_err(mgp->
dev,
"TSO but wanted to linearize?!?!?\n");
2987 if (skb_linearize(skb))
2995 ss->
stats.tx_dropped += 1;
3016 status = myri10ge_xmit(curr, dev);
3032 ss = &mgp->
ss[skb_get_queue_mapping(skb)];
3034 ss->
stats.tx_dropped += 1;
3046 slice_stats = &mgp->
ss[
i].stats;
3057 static void myri10ge_set_multicast_list(
struct net_device *dev)
3062 __be32 data[2] = { 0, 0 };
3077 netdev_err(dev,
"Failed MXGEFW_ENABLE_ALLMULTI, error status: %d\n",
3092 netdev_err(dev,
"Failed MXGEFW_LEAVE_ALL_MULTICAST_GROUPS, error status: %d\n",
3100 cmd.data0 =
ntohl(data[0]);
3101 cmd.data1 =
ntohl(data[1]);
3106 netdev_err(dev,
"Failed MXGEFW_JOIN_MULTICAST_GROUP, error status:%d %pM\n",
3114 netdev_err(dev,
"Failed MXGEFW_DISABLE_ALLMULTI, error status: %d\n",
3125 static int myri10ge_set_mac_address(
struct net_device *dev,
void *addr)
3131 if (!is_valid_ether_addr(sa->
sa_data))
3134 status = myri10ge_update_mac_address(mgp, sa->
sa_data);
3136 netdev_err(dev,
"changing mac address failed with %d\n",
3155 static int myri10ge_change_mtu(
struct net_device *dev,
int new_mtu)
3161 netdev_err(dev,
"new mtu (%d) is not valid\n", new_mtu);
3164 netdev_info(dev,
"changing mtu from %d to %d\n", dev->
mtu, new_mtu);
3168 myri10ge_close(dev);
3191 if (!myri10ge_ecrc_enable || !bridge)
3196 if (myri10ge_ecrc_enable > 1) {
3197 struct pci_dev *prev_bridge, *old_bridge = bridge;
3202 prev_bridge = bridge;
3203 bridge = bridge->
bus->self;
3204 if (!bridge || prev_bridge == bridge) {
3206 "Failed to find root port"
3207 " to force ECRC\n");
3210 }
while (pci_pcie_type(bridge) !=
3214 "Forcing ECRC on non-root port %s"
3215 " (enabling on root port %s)\n",
3216 pci_name(old_bridge), pci_name(bridge));
3219 "Not enabling ECRC on non-root port %s\n",
3229 ret = pci_read_config_dword(bridge, cap +
PCI_ERR_CAP, &err_cap);
3231 dev_err(dev,
"failed reading ext-conf-space of %s\n",
3233 dev_err(dev,
"\t pci=nommconf in use? "
3234 "or buggy/incomplete/absent ACPI MCFG attr?\n");
3241 pci_write_config_dword(bridge, cap +
PCI_ERR_CAP, err_cap);
3242 dev_info(dev,
"Enabled ECRC on upstream bridge %s\n", pci_name(bridge));
3264 static void myri10ge_firmware_probe(
struct myri10ge_priv *mgp)
3277 dev_err(dev,
"Couldn't read max read req size: %d\n", status);
3280 if (status != 4096) {
3281 dev_warn(dev,
"Max Read Request size != 4096 (%d)\n", status);
3288 set_fw_name(mgp, myri10ge_fw_aligned,
false);
3289 status = myri10ge_load_firmware(mgp, 1);
3297 myri10ge_enable_ecrc(mgp);
3308 if (status != -
E2BIG)
3309 dev_warn(dev,
"DMA test failed: %d\n", status);
3311 dev_warn(dev,
"Falling back to ethp! "
3312 "Please install up to date fw\n");
3316 set_fw_name(mgp, myri10ge_fw_unaligned,
false);
3319 static void myri10ge_select_firmware(
struct myri10ge_priv *mgp)
3323 if (myri10ge_force_firmware == 0) {
3328 link_width = (lnk >> 4) & 0x3f;
3333 if (link_width < 8) {
3337 set_fw_name(mgp, myri10ge_fw_aligned,
false);
3339 myri10ge_firmware_probe(mgp);
3342 if (myri10ge_force_firmware == 1) {
3344 "Assuming aligned completions (forced)\n");
3346 set_fw_name(mgp, myri10ge_fw_aligned,
false);
3349 "Assuming unaligned completions (forced)\n");
3351 set_fw_name(mgp, myri10ge_fw_unaligned,
false);
3356 if (myri10ge_fw_name !=
NULL) {
3360 set_fw_name(mgp, fw_name,
true);
3368 set_fw_name(mgp, myri10ge_fw_names[mgp->
board_number],
false);
3372 dev_info(&mgp->
pdev->dev,
"overriding firmware to %s\n",
3376 static void myri10ge_mask_surprise_down(
struct pci_dev *pdev)
3402 mgp = pci_get_drvdata(pdev);
3408 if (netif_running(netdev)) {
3409 netdev_info(netdev,
"closing\n");
3411 myri10ge_close(netdev);
3414 myri10ge_dummy_rdma(mgp, 0);
3421 static int myri10ge_resume(
struct pci_dev *pdev)
3428 mgp = pci_get_drvdata(pdev);
3435 if (vendor == 0xffff) {
3436 netdev_err(mgp->
dev,
"device disappeared!\n");
3444 dev_err(&pdev->
dev,
"failed to enable device\n");
3450 myri10ge_reset(mgp);
3451 myri10ge_dummy_rdma(mgp, 1);
3457 if (netif_running(netdev)) {
3459 status = myri10ge_open(netdev);
3462 goto abort_with_enabled;
3483 pci_write_config_byte(pdev, vs + 0x10, 0x3);
3486 pci_write_config_dword(pdev, vs + 0x18, 0xfffffff0);
3487 pci_read_config_dword(pdev, vs + 0x14, &reboot);
3493 int *busy_slice_cnt,
u32 rx_pause_cnt)
3496 int slice = ss - mgp->
ss;
3498 if (ss->
tx.req != ss->
tx.done &&
3504 netdev_warn(mgp->
dev,
"slice %d: TX paused, "
3505 "check link partner\n", slice);
3507 netdev_warn(mgp->
dev,
3508 "slice %d: TX stuck %d %d %d %d %d %d\n",
3509 slice, ss->
tx.queue_active, ss->
tx.req,
3510 ss->
tx.done, ss->
tx.pkt_start,
3512 (
int)
ntohl(mgp->
ss[slice].fw_stats->
3520 *busy_slice_cnt += 1;
3536 u32 reboot, rx_pause_cnt;
3539 int reset_needed = 0;
3540 int busy_slice_cnt = 0;
3550 reboot = myri10ge_read_reboot(mgp);
3551 netdev_err(mgp->
dev,
"NIC rebooted (0x%x),%s resetting\n",
3552 reboot, myri10ge_reset_recover ?
"" :
" not");
3553 if (myri10ge_reset_recover == 0)
3558 myri10ge_close(mgp->
dev);
3559 myri10ge_reset_recover--;
3577 if (cmd == 0xffff) {
3579 if (vendor == 0xffff) {
3580 netdev_err(mgp->
dev,
"device disappeared!\n");
3586 rx_pause_cnt =
ntohl(mgp->
ss[0].fw_stats->dropped_pause);
3590 myri10ge_check_slice(ss, &reset_needed,
3596 if (!reset_needed) {
3601 netdev_err(mgp->
dev,
"device timeout, resetting\n");
3606 myri10ge_close(mgp->
dev);
3608 status = myri10ge_load_firmware(mgp, 1);
3610 netdev_err(mgp->
dev,
"failed to load firmware\n");
3612 myri10ge_open(mgp->
dev);
3623 static void myri10ge_watchdog_timer(
unsigned long arg)
3627 int i, reset_needed, busy_slice_cnt;
3633 rx_pause_cnt =
ntohl(mgp->
ss[0].fw_stats->dropped_pause);
3635 for (i = 0, reset_needed = 0;
3639 if (ss->
rx_small.watchdog_needed) {
3640 myri10ge_alloc_rx_pages(mgp, &ss->
rx_small,
3644 myri10ge_fill_thresh)
3647 if (ss->
rx_big.watchdog_needed) {
3648 myri10ge_alloc_rx_pages(mgp, &ss->
rx_big,
3651 myri10ge_fill_thresh)
3652 ss->
rx_big.watchdog_needed = 0;
3654 myri10ge_check_slice(ss, &reset_needed, &busy_slice_cnt,
3660 if (busy_slice_cnt == 0) {
3662 if ((cmd & PCI_COMMAND_MASTER) == 0) {
3673 jiffies + myri10ge_watchdog_timeout * HZ);
3739 myri10ge_napi_weight);
3743 myri10ge_free_slices(mgp);
3753 static void myri10ge_probe_slices(
struct myri10ge_priv *mgp)
3765 if (myri10ge_max_slices == 1 || msix_cap == 0 ||
3766 (myri10ge_max_slices == -1 && ncpus < 2))
3775 if (myri10ge_fw_name !=
NULL) {
3776 dev_info(&mgp->
pdev->dev,
"overriding rss firmware to %s\n",
3778 set_fw_name(mgp, myri10ge_fw_name,
false);
3779 }
else if (old_fw == myri10ge_fw_aligned)
3780 set_fw_name(mgp, myri10ge_fw_rss_aligned,
false);
3782 set_fw_name(mgp, myri10ge_fw_rss_unaligned,
false);
3783 status = myri10ge_load_firmware(mgp, 0);
3792 memset(&cmd, 0,
sizeof(cmd));
3805 dev_err(&mgp->
pdev->dev,
"failed MXGEFW_CMD_SET_INTRQ_SIZE\n");
3817 if (!myri10ge_msi) {
3824 if (myri10ge_max_slices == -1)
3825 myri10ge_max_slices =
ncpus;
3870 set_fw_name(mgp, old_fw, old_allocated);
3871 myri10ge_load_firmware(mgp, 0);
3875 .ndo_open = myri10ge_open,
3876 .ndo_stop = myri10ge_close,
3877 .ndo_start_xmit = myri10ge_xmit,
3878 .ndo_get_stats64 = myri10ge_get_stats,
3880 .ndo_change_mtu = myri10ge_change_mtu,
3881 .ndo_fix_features = myri10ge_fix_features,
3882 .ndo_set_rx_mode = myri10ge_set_multicast_list,
3883 .ndo_set_mac_address = myri10ge_set_mac_address,
3892 int status = -
ENXIO;
3894 unsigned hdr_offset, ss_offset;
3903 mgp = netdev_priv(netdev);
3906 mgp->
pause = myri10ge_flow_control;
3913 dev_err(&pdev->
dev,
"pci_enable_device call failed\n");
3915 goto abort_with_netdev;
3926 dev_err(&pdev->
dev,
"Error %d writing PCI_EXP_DEVCTL\n",
3928 goto abort_with_enabled;
3931 myri10ge_mask_surprise_down(pdev);
3938 "64-bit pci address mask was refused, "
3943 dev_err(&pdev->
dev,
"Error %d setting DMA mask\n", status);
3944 goto abort_with_enabled;
3950 goto abort_with_enabled;
3964 dev_err(&pdev->
dev,
"ioremap failed for %ld bytes at 0x%lx\n",
3967 goto abort_with_mtrr;
3976 "invalid sram_size %dB or board span %ldB\n",
3978 goto abort_with_ioremap;
3983 status = myri10ge_read_mac_addr(mgp);
3985 goto abort_with_ioremap;
3990 myri10ge_select_firmware(mgp);
3992 status = myri10ge_load_firmware(mgp, 1);
3994 dev_err(&pdev->
dev,
"failed to load firmware\n");
3995 goto abort_with_ioremap;
3997 myri10ge_probe_slices(mgp);
3998 status = myri10ge_alloc_slices(mgp);
4000 dev_err(&pdev->
dev,
"failed to alloc slice state\n");
4001 goto abort_with_firmware;
4004 netif_set_real_num_rx_queues(netdev, mgp->
num_slices);
4005 status = myri10ge_reset(mgp);
4008 goto abort_with_slices;
4010 #ifdef CONFIG_MYRI10GE_DCA
4011 myri10ge_setup_dca(mgp);
4013 pci_set_drvdata(pdev, mgp);
4016 if ((myri10ge_initial_mtu + ETH_HLEN) < 68)
4017 myri10ge_initial_mtu = 68;
4020 netdev->
mtu = myri10ge_initial_mtu;
4035 status = myri10ge_request_irq(mgp);
4037 goto abort_with_firmware;
4038 myri10ge_free_irq(mgp);
4046 (
unsigned long)mgp);
4052 dev_err(&pdev->
dev,
"register_netdev failed: %d\n", status);
4053 goto abort_with_state;
4056 dev_info(dev,
"%d MSI-X IRQs, tx bndry %d, fw %s, WC %s\n",
4060 dev_info(dev,
"%s IRQ %d, tx bndry %d, fw %s, WC %s\n",
4072 myri10ge_free_slices(mgp);
4074 abort_with_firmware:
4075 myri10ge_dummy_rdma(mgp, 0);
4080 "myri10ge_probe() failed: MAC=%s, SN=%ld\n",
4096 set_fw_name(mgp,
NULL,
false);
4108 static void myri10ge_remove(
struct pci_dev *pdev)
4113 mgp = pci_get_drvdata(pdev);
4121 #ifdef CONFIG_MYRI10GE_DCA
4122 myri10ge_teardown_dca(mgp);
4124 myri10ge_dummy_rdma(mgp, 0);
4135 myri10ge_free_slices(mgp);
4141 set_fw_name(mgp,
NULL,
false);
4144 pci_set_drvdata(pdev,
NULL);
4147 #define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E 0x0008
4148 #define PCI_DEVICE_ID_MYRICOM_MYRI10GE_Z8E_9 0x0009
4161 .probe = myri10ge_probe,
4162 .remove = myri10ge_remove,
4163 .id_table = myri10ge_pci_tbl,
4165 .suspend = myri10ge_suspend,
4166 .resume = myri10ge_resume,
4170 #ifdef CONFIG_MYRI10GE_DCA
4172 myri10ge_notify_dca(
struct notifier_block *nb,
unsigned long event,
void *p)
4176 myri10ge_notify_dca_device);
4190 static __init int myri10ge_init_module(
void)
4195 pr_err(
"Illegal rssh hash type %d, defaulting to source port\n",
4199 #ifdef CONFIG_MYRI10GE_DCA
4205 return pci_register_driver(&myri10ge_driver);
4210 static __exit void myri10ge_cleanup_module(
void)
4212 #ifdef CONFIG_MYRI10GE_DCA