xref: /dflybsd-src/sys/dev/netif/iwm/if_iwm_phy_ctxt.c (revision 6acbba79fd1a245dc4f49a6e542db4c015d39b8e)
124a8d46aSMatthew Dillon /*	$OpenBSD: if_iwm.c,v 1.39 2015/03/23 00:35:19 jsg Exp $	*/
224a8d46aSMatthew Dillon 
324a8d46aSMatthew Dillon /*
424a8d46aSMatthew Dillon  * Copyright (c) 2014 genua mbh <info@genua.de>
524a8d46aSMatthew Dillon  * Copyright (c) 2014 Fixup Software Ltd.
624a8d46aSMatthew Dillon  *
724a8d46aSMatthew Dillon  * Permission to use, copy, modify, and distribute this software for any
824a8d46aSMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
924a8d46aSMatthew Dillon  * copyright notice and this permission notice appear in all copies.
1024a8d46aSMatthew Dillon  *
1124a8d46aSMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1224a8d46aSMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1324a8d46aSMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1424a8d46aSMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1524a8d46aSMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1624a8d46aSMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1724a8d46aSMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1824a8d46aSMatthew Dillon  */
1924a8d46aSMatthew Dillon 
2024a8d46aSMatthew Dillon /*-
2124a8d46aSMatthew Dillon  * Based on BSD-licensed source modules in the Linux iwlwifi driver,
2224a8d46aSMatthew Dillon  * which were used as the reference documentation for this implementation.
2324a8d46aSMatthew Dillon  *
2424a8d46aSMatthew Dillon  * Driver version we are currently based off of is
2524a8d46aSMatthew Dillon  * Linux 3.14.3 (tag id a2df521e42b1d9a23f620ac79dbfe8655a8391dd)
2624a8d46aSMatthew Dillon  *
2724a8d46aSMatthew Dillon  ***********************************************************************
2824a8d46aSMatthew Dillon  *
2924a8d46aSMatthew Dillon  * This file is provided under a dual BSD/GPLv2 license.  When using or
3024a8d46aSMatthew Dillon  * redistributing this file, you may do so under either license.
3124a8d46aSMatthew Dillon  *
3224a8d46aSMatthew Dillon  * GPL LICENSE SUMMARY
3324a8d46aSMatthew Dillon  *
3424a8d46aSMatthew Dillon  * Copyright(c) 2007 - 2013 Intel Corporation. All rights reserved.
3524a8d46aSMatthew Dillon  *
3624a8d46aSMatthew Dillon  * This program is free software; you can redistribute it and/or modify
3724a8d46aSMatthew Dillon  * it under the terms of version 2 of the GNU General Public License as
3824a8d46aSMatthew Dillon  * published by the Free Software Foundation.
3924a8d46aSMatthew Dillon  *
4024a8d46aSMatthew Dillon  * This program is distributed in the hope that it will be useful, but
4124a8d46aSMatthew Dillon  * WITHOUT ANY WARRANTY; without even the implied warranty of
4224a8d46aSMatthew Dillon  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
4324a8d46aSMatthew Dillon  * General Public License for more details.
4424a8d46aSMatthew Dillon  *
4524a8d46aSMatthew Dillon  * You should have received a copy of the GNU General Public License
4624a8d46aSMatthew Dillon  * along with this program; if not, write to the Free Software
4724a8d46aSMatthew Dillon  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
4824a8d46aSMatthew Dillon  * USA
4924a8d46aSMatthew Dillon  *
5024a8d46aSMatthew Dillon  * The full GNU General Public License is included in this distribution
5124a8d46aSMatthew Dillon  * in the file called COPYING.
5224a8d46aSMatthew Dillon  *
5324a8d46aSMatthew Dillon  * Contact Information:
5424a8d46aSMatthew Dillon  *  Intel Linux Wireless <ilw@linux.intel.com>
5524a8d46aSMatthew Dillon  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
5624a8d46aSMatthew Dillon  *
5724a8d46aSMatthew Dillon  *
5824a8d46aSMatthew Dillon  * BSD LICENSE
5924a8d46aSMatthew Dillon  *
6024a8d46aSMatthew Dillon  * Copyright(c) 2005 - 2013 Intel Corporation. All rights reserved.
6124a8d46aSMatthew Dillon  * All rights reserved.
6224a8d46aSMatthew Dillon  *
6324a8d46aSMatthew Dillon  * Redistribution and use in source and binary forms, with or without
6424a8d46aSMatthew Dillon  * modification, are permitted provided that the following conditions
6524a8d46aSMatthew Dillon  * are met:
6624a8d46aSMatthew Dillon  *
6724a8d46aSMatthew Dillon  *  * Redistributions of source code must retain the above copyright
6824a8d46aSMatthew Dillon  *    notice, this list of conditions and the following disclaimer.
6924a8d46aSMatthew Dillon  *  * Redistributions in binary form must reproduce the above copyright
7024a8d46aSMatthew Dillon  *    notice, this list of conditions and the following disclaimer in
7124a8d46aSMatthew Dillon  *    the documentation and/or other materials provided with the
7224a8d46aSMatthew Dillon  *    distribution.
7324a8d46aSMatthew Dillon  *  * Neither the name Intel Corporation nor the names of its
7424a8d46aSMatthew Dillon  *    contributors may be used to endorse or promote products derived
7524a8d46aSMatthew Dillon  *    from this software without specific prior written permission.
7624a8d46aSMatthew Dillon  *
7724a8d46aSMatthew Dillon  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
7824a8d46aSMatthew Dillon  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7924a8d46aSMatthew Dillon  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8024a8d46aSMatthew Dillon  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8124a8d46aSMatthew Dillon  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8224a8d46aSMatthew Dillon  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
8324a8d46aSMatthew Dillon  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
8424a8d46aSMatthew Dillon  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
8524a8d46aSMatthew Dillon  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
8624a8d46aSMatthew Dillon  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
8724a8d46aSMatthew Dillon  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8824a8d46aSMatthew Dillon  */
8924a8d46aSMatthew Dillon 
9024a8d46aSMatthew Dillon /*-
9124a8d46aSMatthew Dillon  * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
9224a8d46aSMatthew Dillon  *
9324a8d46aSMatthew Dillon  * Permission to use, copy, modify, and distribute this software for any
9424a8d46aSMatthew Dillon  * purpose with or without fee is hereby granted, provided that the above
9524a8d46aSMatthew Dillon  * copyright notice and this permission notice appear in all copies.
9624a8d46aSMatthew Dillon  *
9724a8d46aSMatthew Dillon  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9824a8d46aSMatthew Dillon  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9924a8d46aSMatthew Dillon  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10024a8d46aSMatthew Dillon  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
10124a8d46aSMatthew Dillon  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
10224a8d46aSMatthew Dillon  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
10324a8d46aSMatthew Dillon  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
10424a8d46aSMatthew Dillon  */
10524a8d46aSMatthew Dillon #include <sys/param.h>
10624a8d46aSMatthew Dillon #include <sys/bus.h>
107*6acbba79SMatthew Dillon #include <sys/conf.h>
10824a8d46aSMatthew Dillon #include <sys/endian.h>
10924a8d46aSMatthew Dillon #include <sys/firmware.h>
11024a8d46aSMatthew Dillon #include <sys/kernel.h>
11124a8d46aSMatthew Dillon #include <sys/malloc.h>
11224a8d46aSMatthew Dillon #include <sys/mbuf.h>
11324a8d46aSMatthew Dillon #include <sys/rman.h>
11424a8d46aSMatthew Dillon #include <sys/sysctl.h>
11524a8d46aSMatthew Dillon #include <sys/linker.h>
11624a8d46aSMatthew Dillon 
11724a8d46aSMatthew Dillon #include <machine/endian.h>
11824a8d46aSMatthew Dillon 
11945bc40b1SMatthew Dillon #include <bus/pci/pcivar.h>
12045bc40b1SMatthew Dillon #include <bus/pci/pcireg.h>
12124a8d46aSMatthew Dillon 
12224a8d46aSMatthew Dillon #include <net/bpf.h>
12324a8d46aSMatthew Dillon 
12424a8d46aSMatthew Dillon #include <net/if.h>
12524a8d46aSMatthew Dillon #include <net/if_var.h>
12624a8d46aSMatthew Dillon #include <net/if_arp.h>
12724a8d46aSMatthew Dillon #include <net/if_dl.h>
12824a8d46aSMatthew Dillon #include <net/if_media.h>
12924a8d46aSMatthew Dillon #include <net/if_types.h>
13024a8d46aSMatthew Dillon 
13124a8d46aSMatthew Dillon #include <netinet/in.h>
13224a8d46aSMatthew Dillon #include <netinet/in_systm.h>
13324a8d46aSMatthew Dillon #include <netinet/if_ether.h>
13424a8d46aSMatthew Dillon #include <netinet/ip.h>
13524a8d46aSMatthew Dillon 
13645bc40b1SMatthew Dillon #include <netproto/802_11/ieee80211_var.h>
13745bc40b1SMatthew Dillon #include <netproto/802_11/ieee80211_regdomain.h>
13845bc40b1SMatthew Dillon #include <netproto/802_11/ieee80211_ratectl.h>
13945bc40b1SMatthew Dillon #include <netproto/802_11/ieee80211_radiotap.h>
14024a8d46aSMatthew Dillon 
14145bc40b1SMatthew Dillon #include "if_iwmreg.h"
14245bc40b1SMatthew Dillon #include "if_iwmvar.h"
14345bc40b1SMatthew Dillon #include "if_iwm_debug.h"
14445bc40b1SMatthew Dillon #include "if_iwm_util.h"
14545bc40b1SMatthew Dillon #include "if_iwm_phy_ctxt.h"
14624a8d46aSMatthew Dillon 
14724a8d46aSMatthew Dillon /*
148*6acbba79SMatthew Dillon  * BEGIN iwlwifi/mvm/phy-ctxt.c
149*6acbba79SMatthew Dillon  */
150*6acbba79SMatthew Dillon 
151*6acbba79SMatthew Dillon /*
15224a8d46aSMatthew Dillon  * Construct the generic fields of the PHY context command
15324a8d46aSMatthew Dillon  */
15424a8d46aSMatthew Dillon static void
iwm_phy_ctxt_cmd_hdr(struct iwm_softc * sc,struct iwm_phy_ctxt * ctxt,struct iwm_phy_context_cmd * cmd,uint32_t action,uint32_t apply_time)155*6acbba79SMatthew Dillon iwm_phy_ctxt_cmd_hdr(struct iwm_softc *sc, struct iwm_phy_ctxt *ctxt,
15624a8d46aSMatthew Dillon 	struct iwm_phy_context_cmd *cmd, uint32_t action, uint32_t apply_time)
15724a8d46aSMatthew Dillon {
15824a8d46aSMatthew Dillon 	memset(cmd, 0, sizeof(struct iwm_phy_context_cmd));
15924a8d46aSMatthew Dillon 
16024a8d46aSMatthew Dillon 	IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_CMD,
16124a8d46aSMatthew Dillon 	    "%s: id=%d, colour=%d, action=%d, apply_time=%d\n",
16224a8d46aSMatthew Dillon 	    __func__,
16324a8d46aSMatthew Dillon 	    ctxt->id,
16424a8d46aSMatthew Dillon 	    ctxt->color,
16524a8d46aSMatthew Dillon 	    action,
16624a8d46aSMatthew Dillon 	    apply_time);
16724a8d46aSMatthew Dillon 
16824a8d46aSMatthew Dillon 	cmd->id_and_color = htole32(IWM_FW_CMD_ID_AND_COLOR(ctxt->id,
16924a8d46aSMatthew Dillon 	    ctxt->color));
17024a8d46aSMatthew Dillon 	cmd->action = htole32(action);
17124a8d46aSMatthew Dillon 	cmd->apply_time = htole32(apply_time);
17224a8d46aSMatthew Dillon }
17324a8d46aSMatthew Dillon 
17424a8d46aSMatthew Dillon /*
17524a8d46aSMatthew Dillon  * Add the phy configuration to the PHY context command
17624a8d46aSMatthew Dillon  */
17724a8d46aSMatthew Dillon static void
iwm_phy_ctxt_cmd_data(struct iwm_softc * sc,struct iwm_phy_context_cmd * cmd,struct ieee80211_channel * chan,uint8_t chains_static,uint8_t chains_dynamic)178*6acbba79SMatthew Dillon iwm_phy_ctxt_cmd_data(struct iwm_softc *sc,
17924a8d46aSMatthew Dillon 	struct iwm_phy_context_cmd *cmd, struct ieee80211_channel *chan,
18024a8d46aSMatthew Dillon 	uint8_t chains_static, uint8_t chains_dynamic)
18124a8d46aSMatthew Dillon {
18277de6c2dSImre Vadász 	struct ieee80211com *ic = &sc->sc_ic;
18324a8d46aSMatthew Dillon 	uint8_t active_cnt, idle_cnt;
18424a8d46aSMatthew Dillon 
18524a8d46aSMatthew Dillon 	IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_CMD,
18624a8d46aSMatthew Dillon 	    "%s: 2ghz=%d, channel=%d, chains static=0x%x, dynamic=0x%x, "
18724a8d46aSMatthew Dillon 	    "rx_ant=0x%x, tx_ant=0x%x\n",
18824a8d46aSMatthew Dillon 	    __func__,
18924a8d46aSMatthew Dillon 	    !! IEEE80211_IS_CHAN_2GHZ(chan),
19024a8d46aSMatthew Dillon 	    ieee80211_chan2ieee(ic, chan),
19124a8d46aSMatthew Dillon 	    chains_static,
19224a8d46aSMatthew Dillon 	    chains_dynamic,
193*6acbba79SMatthew Dillon 	    iwm_get_valid_rx_ant(sc),
194*6acbba79SMatthew Dillon 	    iwm_get_valid_tx_ant(sc));
19524a8d46aSMatthew Dillon 
19624a8d46aSMatthew Dillon 
19724a8d46aSMatthew Dillon 	cmd->ci.band = IEEE80211_IS_CHAN_2GHZ(chan) ?
19824a8d46aSMatthew Dillon 	    IWM_PHY_BAND_24 : IWM_PHY_BAND_5;
19924a8d46aSMatthew Dillon 
20024a8d46aSMatthew Dillon 	cmd->ci.channel = ieee80211_chan2ieee(ic, chan);
20124a8d46aSMatthew Dillon 	cmd->ci.width = IWM_PHY_VHT_CHANNEL_MODE20;
20224a8d46aSMatthew Dillon 	cmd->ci.ctrl_pos = IWM_PHY_VHT_CTRL_POS_1_BELOW;
20324a8d46aSMatthew Dillon 
20424a8d46aSMatthew Dillon 	/* Set rx the chains */
20524a8d46aSMatthew Dillon 	idle_cnt = chains_static;
20624a8d46aSMatthew Dillon 	active_cnt = chains_dynamic;
20724a8d46aSMatthew Dillon 
2083b7fc5aaSImre Vadász 	/* In scenarios where we only ever use a single-stream rates,
2093b7fc5aaSImre Vadász 	 * i.e. legacy 11b/g/a associations, single-stream APs or even
2103b7fc5aaSImre Vadász 	 * static SMPS, enable both chains to get diversity, improving
2113b7fc5aaSImre Vadász 	 * the case where we're far enough from the AP that attenuation
2123b7fc5aaSImre Vadász 	 * between the two antennas is sufficiently different to impact
2133b7fc5aaSImre Vadász 	 * performance.
2143b7fc5aaSImre Vadász 	 */
215*6acbba79SMatthew Dillon 	if (active_cnt == 1 && iwm_rx_diversity_allowed(sc)) {
2163b7fc5aaSImre Vadász 		idle_cnt = 2;
2173b7fc5aaSImre Vadász 		active_cnt = 2;
2183b7fc5aaSImre Vadász 	}
2193b7fc5aaSImre Vadász 
220*6acbba79SMatthew Dillon 	cmd->rxchain_info = htole32(iwm_get_valid_rx_ant(sc) <<
22124a8d46aSMatthew Dillon 					IWM_PHY_RX_CHAIN_VALID_POS);
22224a8d46aSMatthew Dillon 	cmd->rxchain_info |= htole32(idle_cnt << IWM_PHY_RX_CHAIN_CNT_POS);
22324a8d46aSMatthew Dillon 	cmd->rxchain_info |= htole32(active_cnt <<
22424a8d46aSMatthew Dillon 	    IWM_PHY_RX_CHAIN_MIMO_CNT_POS);
22524a8d46aSMatthew Dillon 
226*6acbba79SMatthew Dillon 	cmd->txchain_info = htole32(iwm_get_valid_tx_ant(sc));
22724a8d46aSMatthew Dillon }
22824a8d46aSMatthew Dillon 
22924a8d46aSMatthew Dillon /*
23024a8d46aSMatthew Dillon  * Send a command
23124a8d46aSMatthew Dillon  * only if something in the configuration changed: in case that this is the
23224a8d46aSMatthew Dillon  * first time that the phy configuration is applied or in case that the phy
23324a8d46aSMatthew Dillon  * configuration changed from the previous apply.
23424a8d46aSMatthew Dillon  */
23524a8d46aSMatthew Dillon static int
iwm_phy_ctxt_apply(struct iwm_softc * sc,struct iwm_phy_ctxt * ctxt,uint8_t chains_static,uint8_t chains_dynamic,uint32_t action,uint32_t apply_time)236*6acbba79SMatthew Dillon iwm_phy_ctxt_apply(struct iwm_softc *sc,
237*6acbba79SMatthew Dillon 	struct iwm_phy_ctxt *ctxt,
23824a8d46aSMatthew Dillon 	uint8_t chains_static, uint8_t chains_dynamic,
23924a8d46aSMatthew Dillon 	uint32_t action, uint32_t apply_time)
24024a8d46aSMatthew Dillon {
24124a8d46aSMatthew Dillon 	struct iwm_phy_context_cmd cmd;
24224a8d46aSMatthew Dillon 	int ret;
24324a8d46aSMatthew Dillon 
24424a8d46aSMatthew Dillon 	IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_CMD,
24524a8d46aSMatthew Dillon 	    "%s: called; channel=%p\n",
24624a8d46aSMatthew Dillon 	    __func__,
24724a8d46aSMatthew Dillon 	    ctxt->channel);
24824a8d46aSMatthew Dillon 
24924a8d46aSMatthew Dillon 	/* Set the command header fields */
250*6acbba79SMatthew Dillon 	iwm_phy_ctxt_cmd_hdr(sc, ctxt, &cmd, action, apply_time);
25124a8d46aSMatthew Dillon 
25224a8d46aSMatthew Dillon 	/* Set the command data */
253*6acbba79SMatthew Dillon 	iwm_phy_ctxt_cmd_data(sc, &cmd, ctxt->channel,
25424a8d46aSMatthew Dillon 	    chains_static, chains_dynamic);
25524a8d46aSMatthew Dillon 
256*6acbba79SMatthew Dillon 	ret = iwm_send_cmd_pdu(sc, IWM_PHY_CONTEXT_CMD, IWM_CMD_SYNC,
25724a8d46aSMatthew Dillon 	    sizeof(struct iwm_phy_context_cmd), &cmd);
25824a8d46aSMatthew Dillon 	if (ret) {
25924a8d46aSMatthew Dillon 		device_printf(sc->sc_dev,
26024a8d46aSMatthew Dillon 		    "PHY ctxt cmd error. ret=%d\n", ret);
26124a8d46aSMatthew Dillon 	}
26224a8d46aSMatthew Dillon 	return ret;
26324a8d46aSMatthew Dillon }
26424a8d46aSMatthew Dillon 
26524a8d46aSMatthew Dillon /*
26624a8d46aSMatthew Dillon  * Send a command to add a PHY context based on the current HW configuration.
26724a8d46aSMatthew Dillon  */
26824a8d46aSMatthew Dillon int
iwm_phy_ctxt_add(struct iwm_softc * sc,struct iwm_phy_ctxt * ctxt,struct ieee80211_channel * chan,uint8_t chains_static,uint8_t chains_dynamic)269*6acbba79SMatthew Dillon iwm_phy_ctxt_add(struct iwm_softc *sc, struct iwm_phy_ctxt *ctxt,
27024a8d46aSMatthew Dillon 	struct ieee80211_channel *chan,
27124a8d46aSMatthew Dillon 	uint8_t chains_static, uint8_t chains_dynamic)
27224a8d46aSMatthew Dillon {
27324a8d46aSMatthew Dillon 	ctxt->channel = chan;
27424a8d46aSMatthew Dillon 
27524a8d46aSMatthew Dillon 	IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_CMD,
27624a8d46aSMatthew Dillon 	    "%s: called; channel=%d\n",
27724a8d46aSMatthew Dillon 	    __func__,
27877de6c2dSImre Vadász 	    ieee80211_chan2ieee(&sc->sc_ic, chan));
27924a8d46aSMatthew Dillon 
280*6acbba79SMatthew Dillon 	return iwm_phy_ctxt_apply(sc, ctxt,
28124a8d46aSMatthew Dillon 	    chains_static, chains_dynamic, IWM_FW_CTXT_ACTION_ADD, 0);
28224a8d46aSMatthew Dillon }
28324a8d46aSMatthew Dillon 
28424a8d46aSMatthew Dillon /*
28524a8d46aSMatthew Dillon  * Send a command to modify the PHY context based on the current HW
28624a8d46aSMatthew Dillon  * configuration. Note that the function does not check that the configuration
28724a8d46aSMatthew Dillon  * changed.
28824a8d46aSMatthew Dillon  */
28924a8d46aSMatthew Dillon int
iwm_phy_ctxt_changed(struct iwm_softc * sc,struct iwm_phy_ctxt * ctxt,struct ieee80211_channel * chan,uint8_t chains_static,uint8_t chains_dynamic)290*6acbba79SMatthew Dillon iwm_phy_ctxt_changed(struct iwm_softc *sc,
291*6acbba79SMatthew Dillon 	struct iwm_phy_ctxt *ctxt, struct ieee80211_channel *chan,
29224a8d46aSMatthew Dillon 	uint8_t chains_static, uint8_t chains_dynamic)
29324a8d46aSMatthew Dillon {
29424a8d46aSMatthew Dillon 	ctxt->channel = chan;
29524a8d46aSMatthew Dillon 
29624a8d46aSMatthew Dillon 	IWM_DPRINTF(sc, IWM_DEBUG_RESET | IWM_DEBUG_CMD,
29724a8d46aSMatthew Dillon 	    "%s: called; channel=%d\n",
29824a8d46aSMatthew Dillon 	    __func__,
29977de6c2dSImre Vadász 	    ieee80211_chan2ieee(&sc->sc_ic, chan));
30024a8d46aSMatthew Dillon 
301*6acbba79SMatthew Dillon 	return iwm_phy_ctxt_apply(sc, ctxt,
30224a8d46aSMatthew Dillon 	    chains_static, chains_dynamic, IWM_FW_CTXT_ACTION_MODIFY, 0);
30324a8d46aSMatthew Dillon }
304*6acbba79SMatthew Dillon 
305*6acbba79SMatthew Dillon /*
306*6acbba79SMatthew Dillon  * END iwlwifi/mvm/phy-ctxt.c
307*6acbba79SMatthew Dillon  */
308