Module Name:    src
Committed By:   nonaka
Date:           Mon Jan  9 12:45:49 UTC 2017

Modified Files:
        src/sys/dev/pci: if_iwm.c

Log Message:
Apply OpenBSD if_iwm.c rev.1.148.

> While setting up the basic rate bitmask for iwm's firmware, if the AP does
> not specify basic rates for either the CCK or OFDM set, add just the most
> basic rate to that set (1 Mbit/s in case of CCK, 6 Mbit/s in case of OFDM).
> This behaviour matches what code comments seem to imply.

> The previous code would add all possible basic rates in such cases.
> So if all basic rates were CCK only, the code would add all possible OFDM 
> basic
> rates on top. Then the firmware would send some frames at too high rates, e.g.
> RTS frames would be sent at 24Mbit/s which is a bit risky on noisy channels.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/pci/if_iwm.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/if_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.55 src/sys/dev/pci/if_iwm.c:1.56
--- src/sys/dev/pci/if_iwm.c:1.55	Mon Jan  9 10:42:45 2017
+++ src/sys/dev/pci/if_iwm.c	Mon Jan  9 12:45:49 2017
@@ -1,5 +1,5 @@
-/*	$NetBSD: if_iwm.c,v 1.55 2017/01/09 10:42:45 khorben Exp $	*/
-/*	OpenBSD: if_iwm.c,v 1.147 2016/11/17 14:12:33 stsp Exp	*/
+/*	$NetBSD: if_iwm.c,v 1.56 2017/01/09 12:45:49 nonaka Exp $	*/
+/*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
  * Copyright (c) 2014, 2016 genua gmbh <i...@genua.de>
@@ -107,7 +107,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.55 2017/01/09 10:42:45 khorben Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.56 2017/01/09 12:45:49 nonaka Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -5152,8 +5152,8 @@ iwm_ack_rates(struct iwm_softc *sc, stru
 {
 	struct ieee80211_node *ni = &in->in_ni;
 	struct ieee80211_rateset *rs = &ni->ni_rates;
-	int lowest_present_ofdm = 100;
-	int lowest_present_cck = 100;
+	int lowest_present_ofdm = -1;
+	int lowest_present_cck = -1;
 	uint8_t cck = 0;
 	uint8_t ofdm = 0;
 	int i;
@@ -5164,7 +5164,7 @@ iwm_ack_rates(struct iwm_softc *sc, stru
 			if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
 				continue;
 			cck |= (1 << i);
-			if (lowest_present_cck > i)
+			if (lowest_present_cck == -1 || lowest_present_cck > i)
 				lowest_present_cck = i;
 		}
 	}
@@ -5172,7 +5172,7 @@ iwm_ack_rates(struct iwm_softc *sc, stru
 		if ((iwm_ridx2rate(rs, i) & IEEE80211_RATE_BASIC) == 0)
 			continue;
 		ofdm |= (1 << (i - IWM_FIRST_OFDM_RATE));
-		if (lowest_present_ofdm > i)
+		if (lowest_present_ofdm == -1 || lowest_present_ofdm > i)
 			lowest_present_ofdm = i;
 	}
 

Reply via email to