diff options
author | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-31 00:57:05 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.il.steeleye.com> | 2007-05-31 00:57:05 -0400 |
commit | 5bc65793cbf8da0d35f19ef025dda22887e79e80 (patch) | |
tree | 8291998abd73055de6f487fafa174ee2a5d3afee /drivers/ieee1394 | |
parent | 6edae708bf77e012d855a7e2c7766f211d234f4f (diff) | |
parent | 3f0a6766e0cc5a577805732e5adb50a585c58175 (diff) |
[SCSI] Merge up to linux-2.6 head
Conflicts:
drivers/scsi/jazz_esp.c
Same changes made by both SCSI and SPARC trees: problem with UTF-8
conversion in the copyright.
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r-- | drivers/ieee1394/eth1394.c | 91 | ||||
-rw-r--r-- | drivers/ieee1394/eth1394.h | 4 | ||||
-rw-r--r-- | drivers/ieee1394/raw1394.c | 8 | ||||
-rw-r--r-- | drivers/ieee1394/sbp2.c | 1 |
4 files changed, 76 insertions, 28 deletions
diff --git a/drivers/ieee1394/eth1394.c b/drivers/ieee1394/eth1394.c index 2296d43a2414..5f026b5d7857 100644 --- a/drivers/ieee1394/eth1394.c +++ b/drivers/ieee1394/eth1394.c | |||
@@ -47,6 +47,7 @@ | |||
47 | #include <linux/types.h> | 47 | #include <linux/types.h> |
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/init.h> | 49 | #include <linux/init.h> |
50 | #include <linux/workqueue.h> | ||
50 | 51 | ||
51 | #include <linux/netdevice.h> | 52 | #include <linux/netdevice.h> |
52 | #include <linux/inetdevice.h> | 53 | #include <linux/inetdevice.h> |
@@ -235,6 +236,9 @@ static int ether1394_open(struct net_device *dev) | |||
235 | /* This is called after an "ifdown" */ | 236 | /* This is called after an "ifdown" */ |
236 | static int ether1394_stop(struct net_device *dev) | 237 | static int ether1394_stop(struct net_device *dev) |
237 | { | 238 | { |
239 | /* flush priv->wake */ | ||
240 | flush_scheduled_work(); | ||
241 | |||
238 | netif_stop_queue(dev); | 242 | netif_stop_queue(dev); |
239 | return 0; | 243 | return 0; |
240 | } | 244 | } |
@@ -531,6 +535,37 @@ static void ether1394_init_dev(struct net_device *dev) | |||
531 | } | 535 | } |
532 | 536 | ||
533 | /* | 537 | /* |
538 | * Wake the queue up after commonly encountered transmit failure conditions are | ||
539 | * hopefully over. Currently only tlabel exhaustion is accounted for. | ||
540 | */ | ||
541 | static void ether1394_wake_queue(struct work_struct *work) | ||
542 | { | ||
543 | struct eth1394_priv *priv; | ||
544 | struct hpsb_packet *packet; | ||
545 | |||
546 | priv = container_of(work, struct eth1394_priv, wake); | ||
547 | packet = hpsb_alloc_packet(0); | ||
548 | |||
549 | /* This is really bad, but unjam the queue anyway. */ | ||
550 | if (!packet) | ||
551 | goto out; | ||
552 | |||
553 | packet->host = priv->host; | ||
554 | packet->node_id = priv->wake_node; | ||
555 | /* | ||
556 | * A transaction label is all we really want. If we get one, it almost | ||
557 | * always means we can get a lot more because the ieee1394 core recycled | ||
558 | * a whole batch of tlabels, at last. | ||
559 | */ | ||
560 | if (hpsb_get_tlabel(packet) == 0) | ||
561 | hpsb_free_tlabel(packet); | ||
562 | |||
563 | hpsb_free_packet(packet); | ||
564 | out: | ||
565 | netif_wake_queue(priv->wake_dev); | ||
566 | } | ||
567 | |||
568 | /* | ||
534 | * This function is called every time a card is found. It is generally called | 569 | * This function is called every time a card is found. It is generally called |
535 | * when the module is installed. This is where we add all of our ethernet | 570 | * when the module is installed. This is where we add all of our ethernet |
536 | * devices. One for each host. | 571 | * devices. One for each host. |
@@ -564,16 +599,17 @@ static void ether1394_add_host(struct hpsb_host *host) | |||
564 | } | 599 | } |
565 | 600 | ||
566 | SET_MODULE_OWNER(dev); | 601 | SET_MODULE_OWNER(dev); |
567 | #if 0 | 602 | |
568 | /* FIXME - Is this the correct parent device anyway? */ | 603 | /* This used to be &host->device in Linux 2.6.20 and before. */ |
569 | SET_NETDEV_DEV(dev, &host->device); | 604 | SET_NETDEV_DEV(dev, host->device.parent); |
570 | #endif | ||
571 | 605 | ||
572 | priv = netdev_priv(dev); | 606 | priv = netdev_priv(dev); |
573 | INIT_LIST_HEAD(&priv->ip_node_list); | 607 | INIT_LIST_HEAD(&priv->ip_node_list); |
574 | spin_lock_init(&priv->lock); | 608 | spin_lock_init(&priv->lock); |
575 | priv->host = host; | 609 | priv->host = host; |
576 | priv->local_fifo = fifo_addr; | 610 | priv->local_fifo = fifo_addr; |
611 | INIT_WORK(&priv->wake, ether1394_wake_queue); | ||
612 | priv->wake_dev = dev; | ||
577 | 613 | ||
578 | hi = hpsb_create_hostinfo(ð1394_highlevel, host, sizeof(*hi)); | 614 | hi = hpsb_create_hostinfo(ð1394_highlevel, host, sizeof(*hi)); |
579 | if (hi == NULL) { | 615 | if (hi == NULL) { |
@@ -1390,22 +1426,17 @@ static int ether1394_prep_write_packet(struct hpsb_packet *p, | |||
1390 | u64 addr, void *data, int tx_len) | 1426 | u64 addr, void *data, int tx_len) |
1391 | { | 1427 | { |
1392 | p->node_id = node; | 1428 | p->node_id = node; |
1393 | p->data = NULL; | ||
1394 | 1429 | ||
1395 | p->tcode = TCODE_WRITEB; | 1430 | if (hpsb_get_tlabel(p)) |
1396 | p->header[1] = host->node_id << 16 | addr >> 32; | 1431 | return -EAGAIN; |
1397 | p->header[2] = addr & 0xffffffff; | ||
1398 | 1432 | ||
1433 | p->tcode = TCODE_WRITEB; | ||
1399 | p->header_size = 16; | 1434 | p->header_size = 16; |
1400 | p->expect_response = 1; | 1435 | p->expect_response = 1; |
1401 | |||
1402 | if (hpsb_get_tlabel(p)) { | ||
1403 | ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n"); | ||
1404 | return -1; | ||
1405 | } | ||
1406 | p->header[0] = | 1436 | p->header[0] = |
1407 | p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4; | 1437 | p->node_id << 16 | p->tlabel << 10 | 1 << 8 | TCODE_WRITEB << 4; |
1408 | 1438 | p->header[1] = host->node_id << 16 | addr >> 32; | |
1439 | p->header[2] = addr & 0xffffffff; | ||
1409 | p->header[3] = tx_len << 16; | 1440 | p->header[3] = tx_len << 16; |
1410 | p->data_size = (tx_len + 3) & ~3; | 1441 | p->data_size = (tx_len + 3) & ~3; |
1411 | p->data = data; | 1442 | p->data = data; |
@@ -1451,7 +1482,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) | |||
1451 | 1482 | ||
1452 | packet = ether1394_alloc_common_packet(priv->host); | 1483 | packet = ether1394_alloc_common_packet(priv->host); |
1453 | if (!packet) | 1484 | if (!packet) |
1454 | return -1; | 1485 | return -ENOMEM; |
1455 | 1486 | ||
1456 | if (ptask->tx_type == ETH1394_GASP) { | 1487 | if (ptask->tx_type == ETH1394_GASP) { |
1457 | int length = tx_len + 2 * sizeof(quadlet_t); | 1488 | int length = tx_len + 2 * sizeof(quadlet_t); |
@@ -1462,7 +1493,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) | |||
1462 | ptask->addr, ptask->skb->data, | 1493 | ptask->addr, ptask->skb->data, |
1463 | tx_len)) { | 1494 | tx_len)) { |
1464 | hpsb_free_packet(packet); | 1495 | hpsb_free_packet(packet); |
1465 | return -1; | 1496 | return -EAGAIN; |
1466 | } | 1497 | } |
1467 | 1498 | ||
1468 | ptask->packet = packet; | 1499 | ptask->packet = packet; |
@@ -1471,7 +1502,7 @@ static int ether1394_send_packet(struct packet_task *ptask, unsigned int tx_len) | |||
1471 | 1502 | ||
1472 | if (hpsb_send_packet(packet) < 0) { | 1503 | if (hpsb_send_packet(packet) < 0) { |
1473 | ether1394_free_packet(packet); | 1504 | ether1394_free_packet(packet); |
1474 | return -1; | 1505 | return -EIO; |
1475 | } | 1506 | } |
1476 | 1507 | ||
1477 | return 0; | 1508 | return 0; |
@@ -1514,13 +1545,18 @@ static void ether1394_complete_cb(void *__ptask) | |||
1514 | 1545 | ||
1515 | ptask->outstanding_pkts--; | 1546 | ptask->outstanding_pkts--; |
1516 | if (ptask->outstanding_pkts > 0 && !fail) { | 1547 | if (ptask->outstanding_pkts > 0 && !fail) { |
1517 | int tx_len; | 1548 | int tx_len, err; |
1518 | 1549 | ||
1519 | /* Add the encapsulation header to the fragment */ | 1550 | /* Add the encapsulation header to the fragment */ |
1520 | tx_len = ether1394_encapsulate(ptask->skb, ptask->max_payload, | 1551 | tx_len = ether1394_encapsulate(ptask->skb, ptask->max_payload, |
1521 | &ptask->hdr); | 1552 | &ptask->hdr); |
1522 | if (ether1394_send_packet(ptask, tx_len)) | 1553 | err = ether1394_send_packet(ptask, tx_len); |
1554 | if (err) { | ||
1555 | if (err == -EAGAIN) | ||
1556 | ETH1394_PRINT_G(KERN_ERR, "Out of tlabels\n"); | ||
1557 | |||
1523 | ether1394_dg_complete(ptask, 1); | 1558 | ether1394_dg_complete(ptask, 1); |
1559 | } | ||
1524 | } else { | 1560 | } else { |
1525 | ether1394_dg_complete(ptask, fail); | 1561 | ether1394_dg_complete(ptask, fail); |
1526 | } | 1562 | } |
@@ -1633,10 +1669,18 @@ static int ether1394_tx(struct sk_buff *skb, struct net_device *dev) | |||
1633 | /* Add the encapsulation header to the fragment */ | 1669 | /* Add the encapsulation header to the fragment */ |
1634 | tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr); | 1670 | tx_len = ether1394_encapsulate(skb, max_payload, &ptask->hdr); |
1635 | dev->trans_start = jiffies; | 1671 | dev->trans_start = jiffies; |
1636 | if (ether1394_send_packet(ptask, tx_len)) | 1672 | if (ether1394_send_packet(ptask, tx_len)) { |
1637 | goto fail; | 1673 | if (dest_node == (LOCAL_BUS | ALL_NODES)) |
1674 | goto fail; | ||
1675 | |||
1676 | /* Most failures of ether1394_send_packet are recoverable. */ | ||
1677 | netif_stop_queue(dev); | ||
1678 | priv->wake_node = dest_node; | ||
1679 | schedule_work(&priv->wake); | ||
1680 | kmem_cache_free(packet_task_cache, ptask); | ||
1681 | return NETDEV_TX_BUSY; | ||
1682 | } | ||
1638 | 1683 | ||
1639 | netif_wake_queue(dev); | ||
1640 | return NETDEV_TX_OK; | 1684 | return NETDEV_TX_OK; |
1641 | fail: | 1685 | fail: |
1642 | if (ptask) | 1686 | if (ptask) |
@@ -1650,9 +1694,6 @@ fail: | |||
1650 | priv->stats.tx_errors++; | 1694 | priv->stats.tx_errors++; |
1651 | spin_unlock_irqrestore(&priv->lock, flags); | 1695 | spin_unlock_irqrestore(&priv->lock, flags); |
1652 | 1696 | ||
1653 | if (netif_queue_stopped(dev)) | ||
1654 | netif_wake_queue(dev); | ||
1655 | |||
1656 | /* | 1697 | /* |
1657 | * FIXME: According to a patch from 2003-02-26, "returning non-zero | 1698 | * FIXME: According to a patch from 2003-02-26, "returning non-zero |
1658 | * causes serious problems" here, allegedly. Before that patch, | 1699 | * causes serious problems" here, allegedly. Before that patch, |
diff --git a/drivers/ieee1394/eth1394.h b/drivers/ieee1394/eth1394.h index a3439ee7cb4e..4f3e2dd46f00 100644 --- a/drivers/ieee1394/eth1394.h +++ b/drivers/ieee1394/eth1394.h | |||
@@ -66,6 +66,10 @@ struct eth1394_priv { | |||
66 | int bc_dgl; /* Outgoing broadcast datagram label */ | 66 | int bc_dgl; /* Outgoing broadcast datagram label */ |
67 | struct list_head ip_node_list; /* List of IP capable nodes */ | 67 | struct list_head ip_node_list; /* List of IP capable nodes */ |
68 | struct unit_directory *ud_list[ALL_NODES]; /* Cached unit dir list */ | 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 | ||
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c index d382500f4210..f1d05eeb9f51 100644 --- a/drivers/ieee1394/raw1394.c +++ b/drivers/ieee1394/raw1394.c | |||
@@ -936,6 +936,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
936 | struct hpsb_packet *packet; | 936 | struct hpsb_packet *packet; |
937 | int header_length = req->req.misc & 0xffff; | 937 | int header_length = req->req.misc & 0xffff; |
938 | int expect_response = req->req.misc >> 16; | 938 | int expect_response = req->req.misc >> 16; |
939 | size_t data_size; | ||
939 | 940 | ||
940 | if (header_length > req->req.length || header_length < 12 || | 941 | if (header_length > req->req.length || header_length < 12 || |
941 | header_length > FIELD_SIZEOF(struct hpsb_packet, header)) { | 942 | header_length > FIELD_SIZEOF(struct hpsb_packet, header)) { |
@@ -945,7 +946,8 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
945 | return sizeof(struct raw1394_request); | 946 | return sizeof(struct raw1394_request); |
946 | } | 947 | } |
947 | 948 | ||
948 | packet = hpsb_alloc_packet(req->req.length - header_length); | 949 | data_size = req->req.length - header_length; |
950 | packet = hpsb_alloc_packet(data_size); | ||
949 | req->packet = packet; | 951 | req->packet = packet; |
950 | if (!packet) | 952 | if (!packet) |
951 | return -ENOMEM; | 953 | return -ENOMEM; |
@@ -960,7 +962,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
960 | 962 | ||
961 | if (copy_from_user | 963 | if (copy_from_user |
962 | (packet->data, int2ptr(req->req.sendb) + header_length, | 964 | (packet->data, int2ptr(req->req.sendb) + header_length, |
963 | packet->data_size)) { | 965 | data_size)) { |
964 | req->req.error = RAW1394_ERROR_MEMFAULT; | 966 | req->req.error = RAW1394_ERROR_MEMFAULT; |
965 | req->req.length = 0; | 967 | req->req.length = 0; |
966 | queue_complete_req(req); | 968 | queue_complete_req(req); |
@@ -974,7 +976,7 @@ static int handle_async_send(struct file_info *fi, struct pending_request *req) | |||
974 | packet->host = fi->host; | 976 | packet->host = fi->host; |
975 | packet->expect_response = expect_response; | 977 | packet->expect_response = expect_response; |
976 | packet->header_size = header_length; | 978 | packet->header_size = header_length; |
977 | packet->data_size = req->req.length - header_length; | 979 | packet->data_size = data_size; |
978 | 980 | ||
979 | req->req.length = 0; | 981 | req->req.length = 0; |
980 | hpsb_set_packet_complete_task(packet, | 982 | hpsb_set_packet_complete_task(packet, |
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index d0db6f8b5206..ce86ff226a28 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #include <linux/stringify.h> | 70 | #include <linux/stringify.h> |
71 | #include <linux/types.h> | 71 | #include <linux/types.h> |
72 | #include <linux/wait.h> | 72 | #include <linux/wait.h> |
73 | #include <linux/workqueue.h> | ||
73 | 74 | ||
74 | #include <asm/byteorder.h> | 75 | #include <asm/byteorder.h> |
75 | #include <asm/errno.h> | 76 | #include <asm/errno.h> |