diff options
author | Julian Wiedmann | 2019-06-27 17:01:22 +0200 |
---|---|---|
committer | David S. Miller | 2019-06-27 19:18:23 +0200 |
commit | a59d121da2394dcb84a42bf2fe436180ce2afe5c (patch) | |
tree | 08ded311c9d335eeff50d82c699b48a08a6cff98 /drivers/s390/net/qeth_core_main.c | |
parent | net/smc: common release code for non-accepted sockets (diff) | |
download | kernel-qcow2-linux-a59d121da2394dcb84a42bf2fe436180ce2afe5c.tar.gz kernel-qcow2-linux-a59d121da2394dcb84a42bf2fe436180ce2afe5c.tar.xz kernel-qcow2-linux-a59d121da2394dcb84a42bf2fe436180ce2afe5c.zip |
s390/qeth: dynamically allocate simple IPA cmds
This patch reduces the usage of the write channel's static cmd buffers,
by dynamically allocating all simple IPA cmds (eg. STARTLAN, SETVMAC).
It also converts the OSN path.
Doing so requires some changes to how we calculate the cmd length.
Currently when building IPA cmds, we're quite generous in how much data
we send down to the device (basically the size of the biggest cmd we
know). This is no real concern at the moment, since the static cmd
buffers are backed with zeroed pages. But for dynamic allocations, the
exact length matters. So this patch also adds the needed length
calculations to each cmd path.
Commands that have multiple subtypes (eg. SETADP) of differing length
will be converted with follow-up patches.
Signed-off-by: Julian Wiedmann <jwi@linux.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/s390/net/qeth_core_main.c')
-rw-r--r-- | drivers/s390/net/qeth_core_main.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index fe3dfeaf5ceb..84ed772bbfbd 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -756,7 +756,7 @@ static void qeth_cancel_cmd(struct qeth_cmd_buffer *iob, int rc) qeth_release_buffer(iob); } -struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *channel) +static struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *channel) { struct qeth_cmd_buffer *buffer = NULL; unsigned long flags; @@ -766,11 +766,10 @@ struct qeth_cmd_buffer *qeth_get_buffer(struct qeth_channel *channel) spin_unlock_irqrestore(&channel->iob_lock, flags); return buffer; } -EXPORT_SYMBOL_GPL(qeth_get_buffer); -static struct qeth_cmd_buffer *qeth_alloc_cmd(struct qeth_channel *channel, - unsigned int length, - unsigned int ccws, long timeout) +struct qeth_cmd_buffer *qeth_alloc_cmd(struct qeth_channel *channel, + unsigned int length, unsigned int ccws, + long timeout) { struct qeth_cmd_buffer *iob; @@ -795,6 +794,7 @@ static struct qeth_cmd_buffer *qeth_alloc_cmd(struct qeth_channel *channel, iob->length = length; return iob; } +EXPORT_SYMBOL_GPL(qeth_alloc_cmd); void qeth_clear_cmd_buffers(struct qeth_channel *channel) { @@ -2804,6 +2804,25 @@ struct qeth_cmd_buffer *qeth_get_ipacmd_buffer(struct qeth_card *card, } EXPORT_SYMBOL_GPL(qeth_get_ipacmd_buffer); +struct qeth_cmd_buffer *qeth_ipa_alloc_cmd(struct qeth_card *card, + enum qeth_ipa_cmds cmd_code, + enum qeth_prot_versions prot, + unsigned int data_length) +{ + struct qeth_cmd_buffer *iob; + + data_length += offsetof(struct qeth_ipa_cmd, data); + iob = qeth_alloc_cmd(&card->write, IPA_PDU_HEADER_SIZE + data_length, 1, + QETH_IPA_TIMEOUT); + if (!iob) + return NULL; + + qeth_prepare_ipa_cmd(card, iob, data_length); + qeth_fill_ipacmd_header(card, __ipa_cmd(iob), cmd_code, prot); + return iob; +} +EXPORT_SYMBOL_GPL(qeth_ipa_alloc_cmd); + static int qeth_send_ipa_cmd_cb(struct qeth_card *card, struct qeth_reply *reply, unsigned long data) { @@ -2862,7 +2881,7 @@ static int qeth_send_startlan(struct qeth_card *card) QETH_CARD_TEXT(card, 2, "strtlan"); - iob = qeth_get_ipacmd_buffer(card, IPA_CMD_STARTLAN, 0); + iob = qeth_ipa_alloc_cmd(card, IPA_CMD_STARTLAN, QETH_PROT_NONE, 0); if (!iob) return -ENOMEM; return qeth_send_ipa_cmd(card, iob, qeth_send_startlan_cb, NULL); @@ -2971,7 +2990,7 @@ static int qeth_query_ipassists(struct qeth_card *card, struct qeth_cmd_buffer *iob; QETH_CARD_TEXT_(card, 2, "qipassi%i", prot); - iob = qeth_get_ipacmd_buffer(card, IPA_CMD_QIPASSIST, prot); + iob = qeth_ipa_alloc_cmd(card, IPA_CMD_QIPASSIST, prot, 0); if (!iob) return -ENOMEM; rc = qeth_send_ipa_cmd(card, iob, qeth_query_ipassists_cb, NULL); |