diff options
author | Frank Blaschka <frank.blaschka@de.ibm.com> | 2009-01-04 20:35:44 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-01-04 20:35:44 -0500 |
commit | 5b54e16f1a54cee8e590cb039b5c067914ae5081 (patch) | |
tree | 562397665ca7a4864e9c0e563b99d7ebdf0e8d7e /drivers/s390/net | |
parent | fc9c24603c4b93d84160e14c0a98a754d4328d15 (diff) |
qeth: do not spin for SETIP ip assist command
The ip assist hw command for setting an IP address last unacceptable
long so we can not spin while we waiting for the irq. Since we can
ensure process context for all occurrences of this command we can use
wait.
Signed-off-by: Frank Blaschka <frank.blaschka@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net')
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index ffe6960cb30a..4a2ac0c8cef9 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c | |||
@@ -1685,6 +1685,7 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
1685 | unsigned long flags; | 1685 | unsigned long flags; |
1686 | struct qeth_reply *reply = NULL; | 1686 | struct qeth_reply *reply = NULL; |
1687 | unsigned long timeout; | 1687 | unsigned long timeout; |
1688 | struct qeth_ipa_cmd *cmd; | ||
1688 | 1689 | ||
1689 | QETH_DBF_TEXT(TRACE, 2, "sendctl"); | 1690 | QETH_DBF_TEXT(TRACE, 2, "sendctl"); |
1690 | 1691 | ||
@@ -1731,17 +1732,34 @@ int qeth_send_control_data(struct qeth_card *card, int len, | |||
1731 | wake_up(&card->wait_q); | 1732 | wake_up(&card->wait_q); |
1732 | return rc; | 1733 | return rc; |
1733 | } | 1734 | } |
1734 | while (!atomic_read(&reply->received)) { | 1735 | |
1735 | if (time_after(jiffies, timeout)) { | 1736 | /* we have only one long running ipassist, since we can ensure |
1736 | spin_lock_irqsave(&reply->card->lock, flags); | 1737 | process context of this command we can sleep */ |
1737 | list_del_init(&reply->list); | 1738 | cmd = (struct qeth_ipa_cmd *)(iob->data+IPA_PDU_HEADER_SIZE); |
1738 | spin_unlock_irqrestore(&reply->card->lock, flags); | 1739 | if ((cmd->hdr.command == IPA_CMD_SETIP) && |
1739 | reply->rc = -ETIME; | 1740 | (cmd->hdr.prot_version == QETH_PROT_IPV4)) { |
1740 | atomic_inc(&reply->received); | 1741 | if (!wait_event_timeout(reply->wait_q, |
1741 | wake_up(&reply->wait_q); | 1742 | atomic_read(&reply->received), timeout)) |
1742 | } | 1743 | goto time_err; |
1743 | cpu_relax(); | 1744 | } else { |
1744 | }; | 1745 | while (!atomic_read(&reply->received)) { |
1746 | if (time_after(jiffies, timeout)) | ||
1747 | goto time_err; | ||
1748 | cpu_relax(); | ||
1749 | }; | ||
1750 | } | ||
1751 | |||
1752 | rc = reply->rc; | ||
1753 | qeth_put_reply(reply); | ||
1754 | return rc; | ||
1755 | |||
1756 | time_err: | ||
1757 | spin_lock_irqsave(&reply->card->lock, flags); | ||
1758 | list_del_init(&reply->list); | ||
1759 | spin_unlock_irqrestore(&reply->card->lock, flags); | ||
1760 | reply->rc = -ETIME; | ||
1761 | atomic_inc(&reply->received); | ||
1762 | wake_up(&reply->wait_q); | ||
1745 | rc = reply->rc; | 1763 | rc = reply->rc; |
1746 | qeth_put_reply(reply); | 1764 | qeth_put_reply(reply); |
1747 | return rc; | 1765 | return rc; |