wcn36xx: initialize device defaults on start

Set up default configuration for the device when we call start.
The defaults come from dumps from the prima driver for the same
hardware.

This fixes transmit A-MPDU; previously only one MPDU would be
sent per A-MPDU due to missing MAX_MPDUS_IN_AMPDU setting.

Signed-off-by: Bob Copeland <bob@cozybit.com>
---
Changes since v1:
  - remove some possibly inapplicable or unnecessary settings
wcn36xx: let device generate qos seq numbers

wcn36xx currently sends an incorrect sequence number into the BA session
setup firmware command: it should be saving or updating the ssn in the
TX_START ampdu_action callback instead of waiting until TX_OPERATIONAL.
However, we can sidestep the issue by letting the hardware generate the
sequence numbers for QoS frames, as is done in prima, so do that.

Signed-off-by: Bob Copeland <bob@cozybit.com>

---
Changes since v1:
  - use symbolic constant instead of plain 2 (Chun-Yeow Yeoh)
wcn36xx: use !! when assigning int as a boolean

bd->tx_comp is a single bit in a bitfield, so assigning
"info->flags & IEEE80211_TX_CTL_REQ_TX_STATUS" only happens
to work because TX_STATUS is defined to BIT(0); if it were
any other bit this assignment would fail.

Signed-off-by: Bob Copeland <bob@cozybit.com>
Merge pull request #137 from bcopeland/master

tx ampdu fixes
wcn36xx: don't process 'valid' descriptors

The DMA engine will reset the valid bit after a descriptor is
complete; any with the valid bit still set may still be in
use by the hardware, so check that before freeing the descriptor.

Signed-off-by: Bob Copeland <bob@cozybit.com>
wcn36xx: initialize skb_lock

ctl->skb_lock is never initialized, a fact caught by lockdep.

Signed-off-by: Bob Copeland <bob@cozybit.com>
wcn36xx: initialize dxe lock

The dxe lock is missing its initialization, so add it.

Signed-off-by: Bob Copeland <bob@cozybit.com>
Merge pull request #139 from bcopeland/master

Fix missing lock initializations
wcn36xx: don't pad beacons for mesh

Patch "wcn36xx: Pad TIM PVM if needed" has caused a regression in mesh
beaconing.  The field tim_off is always 0 for mesh mode, and thus
pvm_len (referring to the TIM length field) and pad are both incorrectly
calculated.  Thus, msg_body.beacon_length is incorrectly calculated for
mesh mode. Fix this.

Signed-off-by: Jason Mobarak <jam@cozybit.com>
Signed-off-by: Chun-Yeow Yeoh <yeohchunyeow@cozybit.com>
wcn36xx_msm: use KLIB_BUILD instead of KLIB

If not building within the kernel tree, KLIB and KLIB_BUILD can point to
different directories.  Allow for this by conditionally configuring
KLIB, and KLIB_BUILD if they haven't already been setup.
wcn36xx: move set_tx_pdu inside set_tx_data/mgmt

The pdu is part of the buffer descriptor, so it makes
sense that one function would fill both.  Also, passing
the whole skb instead of just the header pointer to the
set_tx_data function paves the way for using its fields
for ampdu setup inside set_tx_data().

Signed-off-by: Bob Copeland <bob@cozybit.com>
wcn36xx: initiate TX BA sessions

Currently, wcn36xx only asks for a TX BA session if it has
already established one for RX.  Thus, two wcn36xx devices cannot
do a-mpdu between themselves since they both wait for the other
to go first.  Fix this by starting a BA session after a few QoS
data frames have been sent to a STA.

Signed-off-by: Bob Copeland <bob@cozybit.com>
Merge pull request #141 from silverjam/ft-wcn36xx_msm-build-fix

wcn36xx_msm: use KLIB_BUILD instead of KLIB
Merge pull request #140 from silverjam/ft-mesh-beacon-fix

wcn36xx: don't pad beacons for mesh
Merge pull request #142 from bcopeland/master

TX ampdu initiation