Commit 0ce37ec2 authored by Julian Wiedmann's avatar Julian Wiedmann Committed by David S. Miller

s390/qeth: remove OSN-specific IO code

OSN currently provides a custom code path to submit IPA cmds, without
waiting for the cmd response. Replace it with qeth_send_ipa_cmd(), which
uses the common qeth_send_control_data() IO infrastructure.

By setting a custom iob->callback, we can now provide feedback to the
caller about whether the cmd has been successfully submitted to HW.
Since the callback then immediately wakes up the reply-waiter object, we
maintain the old behaviour of returning early without waiting for the
response.
Signed-off-by: default avatarJulian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1273a800
...@@ -996,6 +996,7 @@ void qeth_setadp_promisc_mode(struct qeth_card *); ...@@ -996,6 +996,7 @@ void qeth_setadp_promisc_mode(struct qeth_card *);
int qeth_setadpparms_change_macaddr(struct qeth_card *); int qeth_setadpparms_change_macaddr(struct qeth_card *);
void qeth_tx_timeout(struct net_device *); void qeth_tx_timeout(struct net_device *);
void qeth_release_buffer(struct qeth_channel *, struct qeth_cmd_buffer *); void qeth_release_buffer(struct qeth_channel *, struct qeth_cmd_buffer *);
void qeth_notify_reply(struct qeth_reply *reply, int reason);
void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob, void qeth_prepare_ipa_cmd(struct qeth_card *card, struct qeth_cmd_buffer *iob,
u16 cmd_length); u16 cmd_length);
struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *channel); struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *channel);
......
...@@ -577,11 +577,12 @@ static void qeth_dequeue_reply(struct qeth_card *card, struct qeth_reply *reply) ...@@ -577,11 +577,12 @@ static void qeth_dequeue_reply(struct qeth_card *card, struct qeth_reply *reply)
spin_unlock_irq(&card->lock); spin_unlock_irq(&card->lock);
} }
static void qeth_notify_reply(struct qeth_reply *reply, int reason) void qeth_notify_reply(struct qeth_reply *reply, int reason)
{ {
reply->rc = reason; reply->rc = reason;
complete(&reply->received); complete(&reply->received);
} }
EXPORT_SYMBOL_GPL(qeth_notify_reply);
static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc, static void qeth_issue_ipa_msg(struct qeth_ipa_cmd *cmd, int rc,
struct qeth_card *card) struct qeth_card *card)
......
...@@ -1033,42 +1033,12 @@ struct qeth_discipline qeth_l2_discipline = { ...@@ -1033,42 +1033,12 @@ struct qeth_discipline qeth_l2_discipline = {
}; };
EXPORT_SYMBOL_GPL(qeth_l2_discipline); EXPORT_SYMBOL_GPL(qeth_l2_discipline);
static int qeth_osn_send_control_data(struct qeth_card *card, int len, static void qeth_osn_assist_cb(struct qeth_card *card,
struct qeth_channel *channel,
struct qeth_cmd_buffer *iob) struct qeth_cmd_buffer *iob)
{ {
struct qeth_channel *channel = iob->channel; qeth_notify_reply(iob->reply, 0);
int rc = 0;
QETH_CARD_TEXT(card, 5, "osndctrd");
wait_event(card->wait_q, qeth_trylock_channel(channel));
iob->finalize(card, iob, len);
QETH_DBF_HEX(CTRL, 2, iob->data, min(len, QETH_DBF_CTRL_LEN));
QETH_CARD_TEXT(card, 6, "osnoirqp");
spin_lock_irq(get_ccwdev_lock(channel->ccwdev));
rc = ccw_device_start_timeout(channel->ccwdev, channel->ccw,
(addr_t) iob, 0, 0, iob->timeout);
spin_unlock_irq(get_ccwdev_lock(channel->ccwdev));
if (rc) {
QETH_DBF_MESSAGE(2, "qeth_osn_send_control_data: "
"ccw_device_start rc = %i\n", rc);
QETH_CARD_TEXT_(card, 2, " err%d", rc);
qeth_release_buffer(channel, iob); qeth_release_buffer(channel, iob);
atomic_set(&channel->irq_pending, 0);
wake_up(&card->wait_q);
}
return rc;
}
static int qeth_osn_send_ipa_cmd(struct qeth_card *card,
struct qeth_cmd_buffer *iob)
{
u16 length;
QETH_CARD_TEXT(card, 4, "osndipa");
memcpy(&length, QETH_IPA_PDU_LEN_TOTAL(iob->data), 2);
return qeth_osn_send_control_data(card, length, iob);
} }
int qeth_osn_assist(struct net_device *dev, void *data, int data_len) int qeth_osn_assist(struct net_device *dev, void *data, int data_len)
...@@ -1090,7 +1060,8 @@ int qeth_osn_assist(struct net_device *dev, void *data, int data_len) ...@@ -1090,7 +1060,8 @@ int qeth_osn_assist(struct net_device *dev, void *data, int data_len)
qeth_prepare_ipa_cmd(card, iob, (u16) data_len); qeth_prepare_ipa_cmd(card, iob, (u16) data_len);
memcpy(__ipa_cmd(iob), data, data_len); memcpy(__ipa_cmd(iob), data, data_len);
return qeth_osn_send_ipa_cmd(card, iob); iob->callback = qeth_osn_assist_cb;
return qeth_send_ipa_cmd(card, iob, NULL, NULL);
} }
EXPORT_SYMBOL(qeth_osn_assist); EXPORT_SYMBOL(qeth_osn_assist);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment