Deleted Added
full compact
if_wi.c (109593) if_wi.c (109623)
1/* $NetBSD: wi.c,v 1.109 2003/01/09 08:52:19 dyoung Exp $ */
2
3/*
4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 99 unchanged lines hidden (view full) ---

108#include <dev/wi/if_wireg.h>
109
110#define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)
111#define IFQ_POLL(ifq, m) IF_POLL((ifq), (m))
112#define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m))
113
114#if !defined(lint)
115static const char rcsid[] =
1/* $NetBSD: wi.c,v 1.109 2003/01/09 08:52:19 dyoung Exp $ */
2
3/*
4 * Copyright (c) 1997, 1998, 1999
5 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions

--- 99 unchanged lines hidden (view full) ---

108#include <dev/wi/if_wireg.h>
109
110#define IF_POLL(ifq, m) ((m) = (ifq)->ifq_head)
111#define IFQ_POLL(ifq, m) IF_POLL((ifq), (m))
112#define IFQ_DEQUEUE(ifq, m) IF_DEQUEUE((ifq), (m))
113
114#if !defined(lint)
115static const char rcsid[] =
116 "$FreeBSD: head/sys/dev/wi/if_wi.c 109593 2003-01-20 21:06:58Z sam $";
116 "$FreeBSD: head/sys/dev/wi/if_wi.c 109623 2003-01-21 08:56:16Z alfred $";
117#endif
118
119static void wi_start(struct ifnet *);
120static int wi_reset(struct wi_softc *);
121static void wi_watchdog(struct ifnet *);
122static int wi_ioctl(struct ifnet *, u_long, caddr_t);
123static int wi_media_change(struct ifnet *);
124static void wi_media_status(struct ifnet *, struct ifmediareq *);

--- 785 unchanged lines hidden (view full) ---

910 m_copydata(m0, 0, sizeof(struct ieee80211_frame),
911 (caddr_t)&frmhdr.wi_whdr);
912 m_adj(m0, sizeof(struct ieee80211_frame));
913 frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len);
914#if NBPFILTER > 0
915 if (sc->sc_drvbpf) {
916 struct mbuf *mb;
917
117#endif
118
119static void wi_start(struct ifnet *);
120static int wi_reset(struct wi_softc *);
121static void wi_watchdog(struct ifnet *);
122static int wi_ioctl(struct ifnet *, u_long, caddr_t);
123static int wi_media_change(struct ifnet *);
124static void wi_media_status(struct ifnet *, struct ifmediareq *);

--- 785 unchanged lines hidden (view full) ---

910 m_copydata(m0, 0, sizeof(struct ieee80211_frame),
911 (caddr_t)&frmhdr.wi_whdr);
912 m_adj(m0, sizeof(struct ieee80211_frame));
913 frmhdr.wi_dat_len = htole16(m0->m_pkthdr.len);
914#if NBPFILTER > 0
915 if (sc->sc_drvbpf) {
916 struct mbuf *mb;
917
918 MGETHDR(mb, M_DONTWAIT, m0->m_type);
918 MGETHDR(mb, M_NOWAIT, m0->m_type);
919 if (mb != NULL) {
919 if (mb != NULL) {
920 (void) m_dup_pkthdr(mb, m0, M_DONTWAIT);
920 (void) m_dup_pkthdr(mb, m0, M_NOWAIT);
921 mb->m_next = m0;
922 mb->m_data = (caddr_t)&frmhdr;
923 mb->m_len = sizeof(frmhdr);
924 mb->m_pkthdr.len += mb->m_len;
925 bpf_mtap(sc->sc_drvbpf, mb);
926 m_free(mb);
927 }
928 }

--- 410 unchanged lines hidden (view full) ---

1339 }
1340 rssi = frmhdr.wi_rx_signal;
1341 rstamp = (le16toh(frmhdr.wi_rx_tstamp0) << 16) |
1342 le16toh(frmhdr.wi_rx_tstamp1);
1343
1344 len = le16toh(frmhdr.wi_dat_len);
1345 off = ALIGN(sizeof(struct ieee80211_frame));
1346
921 mb->m_next = m0;
922 mb->m_data = (caddr_t)&frmhdr;
923 mb->m_len = sizeof(frmhdr);
924 mb->m_pkthdr.len += mb->m_len;
925 bpf_mtap(sc->sc_drvbpf, mb);
926 m_free(mb);
927 }
928 }

--- 410 unchanged lines hidden (view full) ---

1339 }
1340 rssi = frmhdr.wi_rx_signal;
1341 rstamp = (le16toh(frmhdr.wi_rx_tstamp0) << 16) |
1342 le16toh(frmhdr.wi_rx_tstamp1);
1343
1344 len = le16toh(frmhdr.wi_dat_len);
1345 off = ALIGN(sizeof(struct ieee80211_frame));
1346
1347 MGETHDR(m, M_DONTWAIT, MT_DATA);
1347 MGETHDR(m, M_NOWAIT, MT_DATA);
1348 if (m == NULL) {
1349 CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
1350 ifp->if_ierrors++;
1351 DPRINTF(("wi_rx_intr: MGET failed\n"));
1352 return;
1353 }
1354 if (off + len > MHLEN) {
1348 if (m == NULL) {
1349 CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
1350 ifp->if_ierrors++;
1351 DPRINTF(("wi_rx_intr: MGET failed\n"));
1352 return;
1353 }
1354 if (off + len > MHLEN) {
1355 MCLGET(m, M_DONTWAIT);
1355 MCLGET(m, M_NOWAIT);
1356 if ((m->m_flags & M_EXT) == 0) {
1357 CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
1358 m_freem(m);
1359 ifp->if_ierrors++;
1360 DPRINTF(("wi_rx_intr: MCLGET failed\n"));
1361 return;
1362 }
1363 }

--- 6 unchanged lines hidden (view full) ---

1370 m->m_pkthdr.rcvif = ifp;
1371
1372 CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
1373
1374#if NBPFILTER > 0
1375 if (sc->sc_drvbpf) {
1376 struct mbuf *mb;
1377
1356 if ((m->m_flags & M_EXT) == 0) {
1357 CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
1358 m_freem(m);
1359 ifp->if_ierrors++;
1360 DPRINTF(("wi_rx_intr: MCLGET failed\n"));
1361 return;
1362 }
1363 }

--- 6 unchanged lines hidden (view full) ---

1370 m->m_pkthdr.rcvif = ifp;
1371
1372 CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_RX);
1373
1374#if NBPFILTER > 0
1375 if (sc->sc_drvbpf) {
1376 struct mbuf *mb;
1377
1378 MGETHDR(mb, M_DONTWAIT, m->m_type);
1378 MGETHDR(mb, M_NOWAIT, m->m_type);
1379 if (mb != NULL) {
1379 if (mb != NULL) {
1380 (void) m_dup_pkthdr(mb, m, M_DONTWAIT);
1380 (void) m_dup_pkthdr(mb, m, M_NOWAIT);
1381 mb->m_next = m;
1382 mb->m_data = (caddr_t)&frmhdr;
1383 mb->m_len = sizeof(frmhdr);
1384 mb->m_pkthdr.len += mb->m_len;
1385 bpf_mtap(sc->sc_drvbpf, mb);
1386 m_free(mb);
1387 }
1388 }

--- 1554 unchanged lines hidden ---
1381 mb->m_next = m;
1382 mb->m_data = (caddr_t)&frmhdr;
1383 mb->m_len = sizeof(frmhdr);
1384 mb->m_pkthdr.len += mb->m_len;
1385 bpf_mtap(sc->sc_drvbpf, mb);
1386 m_free(mb);
1387 }
1388 }

--- 1554 unchanged lines hidden ---