Date: Wed, 26 Jul 2017 05:51:31 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321510 - head/sys/dev/iwm Message-ID: <201707260551.v6Q5pVUh005669@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Wed Jul 26 05:51:31 2017 New Revision: 321510 URL: https://svnweb.freebsd.org/changeset/base/321510 Log: [iwm] Add iwm_mvm_send_lq_cmd() from Linux iwlwifi to if_iwm_util.c. Obtained from: dragonflybsd.git 8a5dd7783e407856754093f5b1c9c757c64534b7 Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwm_util.c head/sys/dev/iwm/if_iwm_util.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:40:52 2017 (r321509) +++ head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:51:31 2017 (r321510) @@ -4451,13 +4451,6 @@ iwm_newstate(struct ieee80211vap *vap, enum ieee80211_ 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_ 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; Modified: head/sys/dev/iwm/if_iwm_util.c ============================================================================== --- head/sys/dev/iwm/if_iwm_util.c Wed Jul 26 05:40:52 2017 (r321509) +++ head/sys/dev/iwm/if_iwm_util.c Wed Jul 26 05:51:31 2017 (r321510) @@ -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) { Modified: head/sys/dev/iwm/if_iwm_util.h ============================================================================== --- head/sys/dev/iwm/if_iwm_util.h Wed Jul 26 05:40:52 2017 (r321509) +++ head/sys/dev/iwm/if_iwm_util.h Wed Jul 26 05:51:31 2017 (r321510) @@ -120,6 +120,9 @@ extern int iwm_dma_contig_alloc(bus_dma_tag_t tag, str 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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707260551.v6Q5pVUh005669>