Tue Mar 3 09:16:56 2015 UTC ()
match iwn and init txrate at lowest available bit-rate.
From OpenBSD rev.1.26.


(nonaka)
diff -r1.17 -r1.18 src/sys/dev/pci/if_iwm.c

cvs diff -r1.17 -r1.18 src/sys/dev/pci/if_iwm.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_iwm.c 2015/03/03 09:10:45 1.17
+++ src/sys/dev/pci/if_iwm.c 2015/03/03 09:16:56 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_iwm.c,v 1.17 2015/03/03 09:10:45 nonaka Exp $ */ 1/* $NetBSD: if_iwm.c,v 1.18 2015/03/03 09:16:56 nonaka Exp $ */
2/* OpenBSD: if_iwm.c,v 1.18 2015/02/11 01:12:42 brad Exp */ 2/* OpenBSD: if_iwm.c,v 1.18 2015/02/11 01:12:42 brad Exp */
3 3
4/* 4/*
5 * Copyright (c) 2014 genua mbh <info@genua.de> 5 * Copyright (c) 2014 genua mbh <info@genua.de>
6 * Copyright (c) 2014 Fixup Software Ltd. 6 * Copyright (c) 2014 Fixup Software Ltd.
7 * 7 *
8 * Permission to use, copy, modify, and distribute this software for any 8 * Permission to use, copy, modify, and distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above 9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies. 10 * copyright notice and this permission notice appear in all copies.
11 * 11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
@@ -95,27 +95,27 @@ @@ -95,27 +95,27 @@
95 * purpose with or without fee is hereby granted, provided that the above 95 * purpose with or without fee is hereby granted, provided that the above
96 * copyright notice and this permission notice appear in all copies. 96 * copyright notice and this permission notice appear in all copies.
97 * 97 *
98 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 98 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
99 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 99 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
100 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 100 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
101 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 101 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
102 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 102 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
103 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 103 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
104 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 104 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
105 */ 105 */
106 106
107#include <sys/cdefs.h> 107#include <sys/cdefs.h>
108__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.17 2015/03/03 09:10:45 nonaka Exp $"); 108__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.18 2015/03/03 09:16:56 nonaka Exp $");
109 109
110#include <sys/param.h> 110#include <sys/param.h>
111#include <sys/conf.h> 111#include <sys/conf.h>
112#include <sys/kernel.h> 112#include <sys/kernel.h>
113#include <sys/kmem.h> 113#include <sys/kmem.h>
114#include <sys/mbuf.h> 114#include <sys/mbuf.h>
115#include <sys/mutex.h> 115#include <sys/mutex.h>
116#include <sys/proc.h> 116#include <sys/proc.h>
117#include <sys/socket.h> 117#include <sys/socket.h>
118#include <sys/sockio.h> 118#include <sys/sockio.h>
119#include <sys/systm.h> 119#include <sys/systm.h>
120 120
121#include <sys/cpu.h> 121#include <sys/cpu.h>
@@ -5390,27 +5390,28 @@ iwm_setrates(struct iwm_node *in) @@ -5390,27 +5390,28 @@ iwm_setrates(struct iwm_node *in)
5390 if (IWM_RIDX_IS_CCK(ridx)) 5390 if (IWM_RIDX_IS_CCK(ridx))
5391 tab |= IWM_RATE_MCS_CCK_MSK; 5391 tab |= IWM_RATE_MCS_CCK_MSK;
5392 DPRINTFN(2, ("station rate %d %x\n", i, tab)); 5392 DPRINTFN(2, ("station rate %d %x\n", i, tab));
5393 lq->rs_table[i] = htole32(tab); 5393 lq->rs_table[i] = htole32(tab);
5394 } 5394 }
5395 /* then fill the rest with the lowest possible rate */ 5395 /* then fill the rest with the lowest possible rate */
5396 for (i = nrates; i < __arraycount(lq->rs_table); i++) { 5396 for (i = nrates; i < __arraycount(lq->rs_table); i++) {
5397 KASSERT(tab != 0); 5397 KASSERT(tab != 0);
5398 lq->rs_table[i] = htole32(tab); 5398 lq->rs_table[i] = htole32(tab);
5399 } 5399 }
5400 5400
5401 /* init amrr */ 5401 /* init amrr */
5402 ieee80211_amrr_node_init(&sc->sc_amrr, &in->in_amn); 5402 ieee80211_amrr_node_init(&sc->sc_amrr, &in->in_amn);
5403 ni->ni_txrate = nrates-1; 5403 /* Start at lowest available bit-rate, AMRR will raise. */
 5404 ni->ni_txrate = 0;
5404} 5405}
5405 5406
5406static int 5407static int
5407iwm_media_change(struct ifnet *ifp) 5408iwm_media_change(struct ifnet *ifp)
5408{ 5409{
5409 struct iwm_softc *sc = ifp->if_softc; 5410 struct iwm_softc *sc = ifp->if_softc;
5410 struct ieee80211com *ic = &sc->sc_ic; 5411 struct ieee80211com *ic = &sc->sc_ic;
5411 uint8_t rate, ridx; 5412 uint8_t rate, ridx;
5412 int error; 5413 int error;
5413 5414
5414 error = ieee80211_media_change(ifp); 5415 error = ieee80211_media_change(ifp);
5415 if (error != ENETRESET) 5416 if (error != ENETRESET)
5416 return error; 5417 return error;