[iwm] Add iwm_mvm_send_lq_cmd() from Linux iwlwifi to if_iwm_util.c.

Obtained from:	dragonflybsd.git 8a5dd7783e407856754093f5b1c9c757c64534b7
This commit is contained in:
Adrian Chadd 2017-07-26 05:51:31 +00:00
parent 1ecccab8fe
commit f55c604bdf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=321510
3 changed files with 31 additions and 11 deletions

View file

@ -4451,13 +4451,6 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
break;
case IEEE80211_S_RUN:
{
struct iwm_host_cmd cmd = {
.id = IWM_LQ_CMD,
.len = { sizeof(in->in_lq), },
.flags = IWM_CMD_SYNC,
};
in = IWM_NODE(vap->iv_bss);
/* Update the association state, now we have it all */
/* (eg associd comes in at this point */
@ -4482,15 +4475,13 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
iwm_mvm_update_quotas(sc, ivp);
iwm_setrates(sc, in);
cmd.data[0] = &in->in_lq;
if ((error = iwm_send_cmd(sc, &cmd)) != 0) {
if ((error = iwm_mvm_send_lq_cmd(sc, &in->in_lq, TRUE)) != 0) {
device_printf(sc->sc_dev,
"%s: IWM_LQ_CMD failed\n", __func__);
"%s: IWM_LQ_CMD failed: %d\n", __func__, error);
}
iwm_mvm_led_enable(sc);
break;
}
default:
break;

View file

@ -489,6 +489,32 @@ iwm_dma_contig_free(struct iwm_dma_info *dma)
}
}
/**
* iwm_mvm_send_lq_cmd() - Send link quality command
* @init: This command is sent as part of station initialization right
* after station has been added.
*
* The link quality command is sent as the last step of station creation.
* This is the special case in which init is set and we call a callback in
* this case to clear the state indicating that station creation is in
* progress.
*/
int
iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq, boolean_t init)
{
struct iwm_host_cmd cmd = {
.id = IWM_LQ_CMD,
.len = { sizeof(struct iwm_lq_cmd), },
.flags = init ? 0 : IWM_CMD_ASYNC,
.data = { lq, },
};
if (lq->sta_id == IWM_MVM_STATION_COUNT)
return EINVAL;
return iwm_send_cmd(sc, &cmd);
}
boolean_t
iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc)
{

View file

@ -120,6 +120,9 @@ extern int iwm_dma_contig_alloc(bus_dma_tag_t tag, struct iwm_dma_info *dma,
bus_size_t size, bus_size_t alignment);
extern void iwm_dma_contig_free(struct iwm_dma_info *);
extern int iwm_mvm_send_lq_cmd(struct iwm_softc *sc, struct iwm_lq_cmd *lq,
boolean_t init);
extern boolean_t iwm_mvm_rx_diversity_allowed(struct iwm_softc *sc);
extern uint8_t iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx);