svn commit: r321510 - head/sys/dev/iwm

Adrian Chadd adrian at FreeBSD.org
Wed Jul 26 05:51:32 UTC 2017


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);


More information about the svn-src-all mailing list