Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
firewire: fix return code
firewire: prefix modules with firewire- instead of fw-
firewire: Add missing byteswapping for receive DMA programs.
ieee1394: raw1394: Fix async send
ieee1394: eth1394: bring back a parent device
ieee1394: eth1394: handle tlabel exhaustion
ieee1394: eth1394: remove bogus netif_wake_queue
ieee1394: sbp2: include workqueue.h

+94 -43
+7 -7
drivers/firewire/Kconfig
··· 18 18 your IEEE 1394 adapter. 19 19 20 20 To compile this driver as a module, say M here: the module will be 21 - called fw-core. 21 + called firewire-core. 22 22 23 23 This is the "JUJU" FireWire stack, an alternative implementation 24 24 designed for robustness and simplicity. You can build either this ··· 34 34 is the only chipset in use, so say Y here. 35 35 36 36 To compile this driver as a module, say M here: The module will be 37 - called fw-ohci. 37 + called firewire-ohci. 38 38 39 39 If you also build ohci1394 of the classic IEEE 1394 driver stack, 40 - blacklist either ohci1394 or fw-ohci to let hotplug load the desired 41 - driver. 40 + blacklist either ohci1394 or firewire-ohci to let hotplug load the 41 + desired driver. 42 42 43 43 config FIREWIRE_SBP2 44 44 tristate "Support for storage devices (SBP-2 protocol driver)" ··· 50 50 like scanners. 51 51 52 52 To compile this driver as a module, say M here: The module will be 53 - called fw-sbp2. 53 + called firewire-sbp2. 54 54 55 55 You should also enable support for disks, CD-ROMs, etc. in the SCSI 56 56 configuration section. 57 57 58 58 If you also build sbp2 of the classic IEEE 1394 driver stack, 59 - blacklist either sbp2 or fw-sbp2 to let hotplug load the desired 60 - driver. 59 + blacklist either sbp2 or firewire-sbp2 to let hotplug load the 60 + desired driver. 61 61
+7 -5
drivers/firewire/Makefile
··· 2 2 # Makefile for the Linux IEEE 1394 implementation 3 3 # 4 4 5 - fw-core-y += fw-card.o fw-topology.o fw-transaction.o fw-iso.o \ 6 - fw-device.o fw-cdev.o 5 + firewire-core-y += fw-card.o fw-topology.o fw-transaction.o fw-iso.o \ 6 + fw-device.o fw-cdev.o 7 + firewire-ohci-y += fw-ohci.o 8 + firewire-sbp2-y += fw-sbp2.o 7 9 8 - obj-$(CONFIG_FIREWIRE) += fw-core.o 9 - obj-$(CONFIG_FIREWIRE_OHCI) += fw-ohci.o 10 - obj-$(CONFIG_FIREWIRE_SBP2) += fw-sbp2.o 10 + obj-$(CONFIG_FIREWIRE) += firewire-core.o 11 + obj-$(CONFIG_FIREWIRE_OHCI) += firewire-ohci.o 12 + obj-$(CONFIG_FIREWIRE_SBP2) += firewire-sbp2.o
+1 -1
drivers/firewire/fw-cdev.c
··· 365 365 response->response.data, response->response.length); 366 366 } 367 367 368 - static ssize_t ioctl_send_request(struct client *client, void *buffer) 368 + static int ioctl_send_request(struct client *client, void *buffer) 369 369 { 370 370 struct fw_device *device = client->device; 371 371 struct fw_cdev_send_request *request = buffer;
+3 -2
drivers/firewire/fw-ohci.c
··· 268 268 269 269 dma_sync_single_for_device(dev, ab_bus, PAGE_SIZE, DMA_BIDIRECTIONAL); 270 270 271 - ctx->last_buffer->descriptor.branch_address = ab_bus | 1; 271 + ctx->last_buffer->descriptor.branch_address = cpu_to_le32(ab_bus | 1); 272 272 ctx->last_buffer->next = ab; 273 273 ctx->last_buffer = ab; 274 274 ··· 417 417 ctx->current_buffer = ab.next; 418 418 ctx->pointer = ctx->current_buffer->data; 419 419 420 - reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), ab.descriptor.branch_address); 420 + reg_write(ctx->ohci, COMMAND_PTR(ctx->regs), 421 + le32_to_cpu(ab.descriptor.branch_address)); 421 422 reg_write(ctx->ohci, CONTROL_SET(ctx->regs), CONTEXT_RUN); 422 423 flush_writes(ctx->ohci); 423 424
+66 -25
drivers/ieee1394/eth1394.c
··· 47 47 #include <linux/types.h> 48 48 #include <linux/delay.h> 49 49 #include <linux/init.h> 50 + #include <linux/workqueue.h> 50 51 51 52 #include <linux/netdevice.h> 52 53 #include <linux/inetdevice.h> ··· 236 235 /* This is called after an "ifdown" */ 237 236 static int ether1394_stop(struct net_device *dev) 238 237 { 238 + /* flush priv->wake */ 239 + flush_scheduled_work(); 240 + 239 241 netif_stop_queue(dev); 240 242 return 0; 241 243 } ··· 535 531 } 536 532 537 533 /* 534 + * Wake the queue up after commonly encountered transmit failure conditions are 535 + * hopefully over. Currently only tlabel exhaustion is accounted for. 536 + */ 537 + static void ether1394_wake_queue(struct work_struct *work) 538 + { 539 + struct eth1394_priv *priv; 540 + struct hpsb_packet *packet; 541 + 542 + priv = container_of(work, struct eth1394_priv, wake); 543 + packet = hpsb_alloc_packet(0); 544 + 545 + /* This is really bad, but unjam the queue anyway. */ 546 + if (!packet) 547 + goto out; 548 + 549 + packet->host = priv->host; 550 + packet->node_id = priv->wake_node; 551 + /* 552 + * A transaction label is all we really want. If we get one, it almost 553 + * always means we can get a lot more because the ieee1394 core recycled 554 + * a whole batch of tlabels, at last. 555 + */ 556 + if (hpsb_get_tlabel(packet) == 0) 557 + hpsb_free_tlabel(packet); 558 + 559 + hpsb_free_packet(packet); 560 + out: 561 + netif_wake_queue(priv->wake_dev); 562 + } 563 + 564 + /* 538 565 * This function is called every time a card is found. It is generally called 539 566 * when the module is installed. This is where we add all of our ethernet 540 567 * devices. One for each host. ··· 599 564 } 600 565 601 566 SET_MODULE_OWNER(dev); 602 - #if 0 603 - /* FIXME - Is this the correct parent device anyway? */ 604 - SET_NETDEV_DEV(dev, &host->device); 605 - #endif 567 + 568 + /* This used to be &host->device in Linux 2.6.20 and before. */ 569 + SET_NETDEV_DEV(dev, host->device.parent); 606 570 607 571 priv = netdev_priv(dev); 608 572 INIT_LIST_HEAD(&priv->ip_node_list); 609 573 spin_lock_init(&priv->lock); 610 574 priv->host = host; 611 575 priv->local_fifo = fifo_addr; 576 + INIT_WORK(&priv->wake, ether1394_wake_queue); 577 + priv->wake_dev = dev; 612 578 613 579 hi = hpsb_create_hostinfo(&eth1394_highlevel, host, sizeof(*hi)); 614 580 if (hi == NULL) { ··· 1426 1390 u64 addr, void *data, int tx_len) 1427 1391 { 1428 1392 p->node_id = node; 1429 - p->data = NULL; 1393 + 1394 + if (hpsb_get_tlabel(p)) 1395 + return -EAGAIN; 1430 1396 1431 1397 p->tcode = TCODE_WRITEB; 1432 - p->header[1] = host->node_id << 16 | addr >> 32; 1433 - p->header[2] = addr & 0xffffffff; 1434 - 1435 1398 p->header_size = 16; 1436 1399 p->expect_response = 1; 1437 - 1438 - if (hpsb_get_tlabel(p)) { 1439 - ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n"); 1440 - return -1; 1441 - } 1442 1400 p->header[0] = 1443 1401 p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4; 1444 - 1402 + p->header[1] = host->node_id << 16 | addr >> 32; 1403 + p->header[2] = addr & 0xffffffff; 1445 1404 p->header[3] = tx_len << 16; 1446 1405 p->data_size = (tx_len + 3) & ~3; 1447 1406 p->data = data; ··· 1482 1451 1483 1452 packet = ether1394_alloc_common_packet(priv->host); 1484 1453 if (!packet) 1485 - return -1; 1454 + return -ENOMEM; 1486 1455 1487 1456 if (ptask->tx_type == ETH1394_GASP) { 1488 1457 int length = tx_len + 2 * sizeof(quadlet_t); ··· 1493 1462 ptask->addr, ptask->skb->data, 1494 1463 tx_len)) { 1495 1464 hpsb_free_packet(packet); 1496 - return -1; 1465 + return -EAGAIN; 1497 1466 } 1498 1467 1499 1468 ptask->packet = packet; ··· 1502 1471 1503 1472 if (hpsb_send_packet(packet) < 0) { 1504 1473 ether1394_free_packet(packet); 1505 - return -1; 1474 + return -EIO; 1506 1475 } 1507 1476 1508 1477 return 0; ··· 1545 1514 1546 1515 ptask->outstanding_pkts--; 1547 1516 if (ptask->outstanding_pkts > 0 && !fail) { 1548 - int tx_len; 1517 + int tx_len, err; 1549 1518 1550 1519 /* Add the encapsulation header to the fragment */ 1551 1520 tx_len = ether1394_encapsulate(ptask->skb, ptask->max_payload, 1552 1521 &ptask->hdr); 1553 - if (ether1394_send_packet(ptask, tx_len)) 1522 + err = ether1394_send_packet(ptask, tx_len); 1523 + if (err) { 1524 + if (err == -EAGAIN) 1525 + ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n"); 1526 + 1554 1527 ether1394_dg_complete(ptask, 1); 1528 + } 1555 1529 } else { 1556 1530 ether1394_dg_complete(ptask, fail); 1557 1531 } ··· 1669 1633 /* Add the encapsulation header to the fragment */ 1670 1634 tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr); 1671 1635 dev->trans_start = jiffies; 1672 - if (ether1394_send_packet(ptask, tx_len)) 1673 - goto fail; 1636 + if (ether1394_send_packet(ptask, tx_len)) { 1637 + if (dest_node == (LOCAL_BUS | ALL_NODES)) 1638 + goto fail; 1674 1639 1675 - netif_wake_queue(dev); 1640 + /* Most failures of ether1394_send_packet are recoverable. */ 1641 + netif_stop_queue(dev); 1642 + priv->wake_node = dest_node; 1643 + schedule_work(&priv->wake); 1644 + kmem_cache_free(packet_task_cache, ptask); 1645 + return NETDEV_TX_BUSY; 1646 + } 1647 + 1676 1648 return NETDEV_TX_OK; 1677 1649 fail: 1678 1650 if (ptask) ··· 1693 1649 priv->stats.tx_dropped++; 1694 1650 priv->stats.tx_errors++; 1695 1651 spin_unlock_irqrestore(&priv->lock, flags); 1696 - 1697 - if (netif_queue_stopped(dev)) 1698 - netif_wake_queue(dev); 1699 1652 1700 1653 /* 1701 1654 * FIXME: According to a patch from 2003-02-26, "returning non-zero
+4
drivers/ieee1394/eth1394.h
··· 66 66 int bc_dgl; /* Outgoing broadcast datagram label */ 67 67 struct list_head ip_node_list; /* List of IP capable nodes */ 68 68 struct unit_directory *ud_list[ALL_NODES]; /* Cached unit dir list */ 69 + 70 + struct work_struct wake; /* Wake up after xmit failure */ 71 + struct net_device *wake_dev; /* Stupid backlink for .wake */ 72 + nodeid_t wake_node; /* Destination of failed xmit */ 69 73 }; 70 74 71 75
+5 -3
drivers/ieee1394/raw1394.c
··· 936 936 struct hpsb_packet *packet; 937 937 int header_length = req->req.misc & 0xffff; 938 938 int expect_response = req->req.misc >> 16; 939 + size_t data_size; 939 940 940 941 if (header_length > req->req.length || header_length < 12 || 941 942 header_length > FIELD_SIZEOF(struct hpsb_packet, header)) { ··· 946 945 return sizeof(struct raw1394_request); 947 946 } 948 947 949 - packet = hpsb_alloc_packet(req->req.length - header_length); 948 + data_size = req->req.length - header_length; 949 + packet = hpsb_alloc_packet(data_size); 950 950 req->packet = packet; 951 951 if (!packet) 952 952 return -ENOMEM; ··· 962 960 963 961 if (copy_from_user 964 962 (packet->data, int2ptr(req->req.sendb) + header_length, 965 - packet->data_size)) { 963 + data_size)) { 966 964 req->req.error = RAW1394_ERROR_MEMFAULT; 967 965 req->req.length = 0; 968 966 queue_complete_req(req); ··· 976 974 packet->host = fi->host; 977 975 packet->expect_response = expect_response; 978 976 packet->header_size = header_length; 979 - packet->data_size = req->req.length - header_length; 977 + packet->data_size = data_size; 980 978 981 979 req->req.length = 0; 982 980 hpsb_set_packet_complete_task(packet,
+1
drivers/ieee1394/sbp2.c
··· 70 70 #include <linux/stringify.h> 71 71 #include <linux/types.h> 72 72 #include <linux/wait.h> 73 + #include <linux/workqueue.h> 73 74 74 75 #include <asm/byteorder.h> 75 76 #include <asm/errno.h>