iwlegacy: use CMD_COPY_PKT on il_send_scan_abort

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: use CMD_COPY_PKT on il_send_add_sta

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: use CMD_COPY_PKT on il_send_remove_station

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: use CMD_COPY_PKT on il3945_send_rxon_assoc

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: get rit of CMD_WANT_SKB

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: treat RX notify specially

RX data is the only notify where we pass RX page to upper layers and
need to allocate new one. Hence treat it specially. This patch also
change argument of all other handlers. This make them simpler a bit
and allow me to verify that we do not free RX page on them.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: rework rx buffers allocation

This big patch removes most of current rx allocation algorithm.

To avoid firmware microcode errors driver has to assure that there is
always free space on RX queue. Current implementation works well, except
situation when system is overloaded, we can not provide buffers to RX
queue fast enough (not even due to allocation errors, but due to
delays, what happens usually on slow boxes).

Patch vastly simplify RX allocation algorithm, based on observation that
we can always reuse allocated pages, except when we have to pass them to
mac80211 (we receive new frame). In the last situation we allocate new
RX buffer and replace it. If there is no memory we just drop the frame,
what assures (once initialized) we always have available buffers in
the RX queue.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: remove il_rx_queue_space

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: remove rxq->lock

We process RX queue only in tasklet and on H/W init/exit code. Since
tasklet guarantee lack of concurrency with himself and we enable it
after init and stop before exit, there is nothing really to protect.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: remove rxq->need_update

We do not need rxq->nead_update, we can use rxq->write_actual for the
same purpose.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: rename il_rx_queue_update_write_ptr

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: rename il_txq_update_write_ptr

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: rearrange il_pass_packet_to_mac80211

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: rename il_need_reclaim

This name is confusing. Additinaly remove N_RX & N_RX_AMPDU since those
command are handled in sparate path on il*_rx_handle.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: properly handle hcmd mapping error

Clear mata flags if we fail to map it. We could have later wrong
meta->source pointer, etc.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: fix some hcmd race conditions

Assue when command timeout we do not copy to invalid address if
CMD_COPY_PKT flag is set.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: remove unused variable from enqueue_hcmd

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: remove some hcmd debugging code

Those are not useful. I.e. huge command is performing only for scan and
we for sure do not exceed IL_MAX_CMD_SIZE.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: some cleanups in enqueue_hcmd and friends

We have host and device commands, it is not always clear which of them
"cmd" variable reference. Patch renames proper variables to dcmd & hcmd
in confusing places and do some other cleanups.

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
iwlegacy: little il4965_irq_tasklet cleanup

Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>