This is preparation for further changes, replacing CMD_WANT_SKB and reply_patch from command to make RX memory management simpler. Signed-off-by: Stanislaw Gruszka <sgruszka@xxxxxxxxxx> --- drivers/net/wireless/iwlegacy/common.c | 8 +++++--- drivers/net/wireless/iwlegacy/common.h | 16 +++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/net/wireless/iwlegacy/common.c b/drivers/net/wireless/iwlegacy/common.c index 4f42174..31b9623 100644 --- a/drivers/net/wireless/iwlegacy/common.c +++ b/drivers/net/wireless/iwlegacy/common.c @@ -372,14 +372,14 @@ il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd) goto out; cancel: - if (cmd->flags & CMD_WANT_SKB) { + if (cmd->flags & (CMD_WANT_SKB | CMD_COPY_PKT)) { /* * Cancel the CMD_WANT_SKB flag for the cmd in the * TX cmd queue. Otherwise in case the cmd comes * in later, it will possibly set an invalid * address (cmd->meta.source). */ - il->txq[il->cmd_queue].meta[cmd_idx].flags &= ~CMD_WANT_SKB; + il->txq[il->cmd_queue].meta[cmd_idx].flags &= ~(CMD_WANT_SKB | CMD_COPY_PKT); } fail: if (cmd->reply_page) { @@ -3172,7 +3172,7 @@ il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd) memset(out_meta, 0, sizeof(*out_meta)); /* re-initialize to NULL */ out_meta->flags = cmd->flags | CMD_MAPPED; - if (cmd->flags & CMD_WANT_SKB) + if (cmd->flags & (CMD_WANT_SKB | CMD_COPY_PKT)) out_meta->source = cmd; if (cmd->flags & CMD_ASYNC) out_meta->callback = cmd->callback; @@ -3319,6 +3319,8 @@ il_tx_cmd_complete(struct il_priv *il, struct il_rx_buf *rxb) if (meta->flags & CMD_WANT_SKB) { meta->source->reply_page = (unsigned long)rxb_addr(rxb); rxb->page = NULL; + } else if (meta->flags & CMD_COPY_PKT) { + memcpy(meta->source->pkt_ptr, pkt, sizeof(*pkt)); } else if (meta->callback) meta->callback(il, cmd, pkt); diff --git a/drivers/net/wireless/iwlegacy/common.h b/drivers/net/wireless/iwlegacy/common.h index dfb13c7..51f0100 100644 --- a/drivers/net/wireless/iwlegacy/common.h +++ b/drivers/net/wireless/iwlegacy/common.h @@ -542,13 +542,14 @@ struct il_frame { }; enum { - CMD_SYNC = 0, - CMD_SIZE_NORMAL = 0, - CMD_NO_SKB = 0, - CMD_SIZE_HUGE = (1 << 0), - CMD_ASYNC = (1 << 1), - CMD_WANT_SKB = (1 << 2), - CMD_MAPPED = (1 << 3), + CMD_SYNC = 0, + CMD_SIZE_NORMAL = 0, + CMD_NO_SKB = 0, + CMD_SIZE_HUGE = (1 << 0), + CMD_ASYNC = (1 << 1), + CMD_WANT_SKB = (1 << 2), + CMD_MAPPED = (1 << 3), + CMD_COPY_PKT = (1 << 4), }; #define DEF_CMD_PAYLOAD_SIZE 320 @@ -577,6 +578,7 @@ struct il_device_cmd { struct il_host_cmd { const void *data; unsigned long reply_page; + struct il_rx_pkt *pkt_ptr; void (*callback) (struct il_priv *il, struct il_device_cmd *cmd, struct il_rx_pkt *pkt); u32 flags; -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html