Thu Oct 10 22:34:42 2019 UTC ()
magic number police. use ETHER_ADDR_LEN.


(bad)
diff -r1.91 -r1.92 src/sys/dev/pci/if_iwn.c

cvs diff -r1.91 -r1.92 src/sys/dev/pci/if_iwn.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_iwn.c 2019/04/19 19:37:31 1.91
+++ src/sys/dev/pci/if_iwn.c 2019/10/10 22:34:42 1.92
@@ -1,38 +1,38 @@ @@ -1,38 +1,38 @@
1/* $NetBSD: if_iwn.c,v 1.91 2019/04/19 19:37:31 gutteridge Exp $ */ 1/* $NetBSD: if_iwn.c,v 1.92 2019/10/10 22:34:42 bad Exp $ */
2/* $OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $ */ 2/* $OpenBSD: if_iwn.c,v 1.135 2014/09/10 07:22:09 dcoppa Exp $ */
3 3
4/*- 4/*-
5 * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> 5 * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr>
6 * 6 *
7 * Permission to use, copy, modify, and distribute this software for any 7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above 8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies. 9 * copyright notice and this permission notice appear in all copies.
10 * 10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */ 18 */
19 19
20/* 20/*
21 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network 21 * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network
22 * adapters. 22 * adapters.
23 */ 23 */
24#include <sys/cdefs.h> 24#include <sys/cdefs.h>
25__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.91 2019/04/19 19:37:31 gutteridge Exp $"); 25__KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.92 2019/10/10 22:34:42 bad Exp $");
26 26
27#define IWN_USE_RBUF /* Use local storage for RX */ 27#define IWN_USE_RBUF /* Use local storage for RX */
28#undef IWN_HWCRYPTO /* XXX does not even compile yet */ 28#undef IWN_HWCRYPTO /* XXX does not even compile yet */
29 29
30#include <sys/param.h> 30#include <sys/param.h>
31#include <sys/sockio.h> 31#include <sys/sockio.h>
32#include <sys/proc.h> 32#include <sys/proc.h>
33#include <sys/mbuf.h> 33#include <sys/mbuf.h>
34#include <sys/kernel.h> 34#include <sys/kernel.h>
35#include <sys/socket.h> 35#include <sys/socket.h>
36#include <sys/systm.h> 36#include <sys/systm.h>
37#include <sys/malloc.h> 37#include <sys/malloc.h>
38#ifdef notyetMODULE 38#ifdef notyetMODULE
@@ -1558,27 +1558,27 @@ iwn_read_eeprom(struct iwn_softc *sc) @@ -1558,27 +1558,27 @@ iwn_read_eeprom(struct iwn_softc *sc)
1558 if (val & htole16(IWN_EEPROM_SKU_CAP_11N)) 1558 if (val & htole16(IWN_EEPROM_SKU_CAP_11N))
1559 sc->sc_flags |= IWN_FLAG_HAS_11N; 1559 sc->sc_flags |= IWN_FLAG_HAS_11N;
1560 1560
1561 iwn_read_prom_data(sc, IWN_EEPROM_RFCFG, &val, 2); 1561 iwn_read_prom_data(sc, IWN_EEPROM_RFCFG, &val, 2);
1562 sc->rfcfg = le16toh(val); 1562 sc->rfcfg = le16toh(val);
1563 DPRINTF(("radio config=0x%04x\n", sc->rfcfg)); 1563 DPRINTF(("radio config=0x%04x\n", sc->rfcfg));
1564 /* Read Tx/Rx chains from ROM unless it's known to be broken. */ 1564 /* Read Tx/Rx chains from ROM unless it's known to be broken. */
1565 if (sc->txchainmask == 0) 1565 if (sc->txchainmask == 0)
1566 sc->txchainmask = IWN_RFCFG_TXANTMSK(sc->rfcfg); 1566 sc->txchainmask = IWN_RFCFG_TXANTMSK(sc->rfcfg);
1567 if (sc->rxchainmask == 0) 1567 if (sc->rxchainmask == 0)
1568 sc->rxchainmask = IWN_RFCFG_RXANTMSK(sc->rfcfg); 1568 sc->rxchainmask = IWN_RFCFG_RXANTMSK(sc->rfcfg);
1569 1569
1570 /* Read MAC address. */ 1570 /* Read MAC address. */
1571 iwn_read_prom_data(sc, IWN_EEPROM_MAC, ic->ic_myaddr, 6); 1571 iwn_read_prom_data(sc, IWN_EEPROM_MAC, ic->ic_myaddr, ETHER_ADDR_LEN);
1572 1572
1573 /* Read adapter-specific information from EEPROM. */ 1573 /* Read adapter-specific information from EEPROM. */
1574 ops->read_eeprom(sc); 1574 ops->read_eeprom(sc);
1575 1575
1576 iwn_apm_stop(sc); /* Power OFF adapter. */ 1576 iwn_apm_stop(sc); /* Power OFF adapter. */
1577 1577
1578 iwn_eeprom_unlock(sc); 1578 iwn_eeprom_unlock(sc);
1579 return 0; 1579 return 0;
1580} 1580}
1581 1581
1582static void 1582static void
1583iwn4965_read_eeprom(struct iwn_softc *sc) 1583iwn4965_read_eeprom(struct iwn_softc *sc)
1584{ 1584{