From 76db6bfa8cb42f8204b09720755170c4516f77a7 Mon Sep 17 00:00:00 2001 From: dyoung Date: Sun, 2 Nov 2003 01:55:40 +0000 Subject: [PATCH] Use ieee80211_find_rxnode to attribute Rx packets to the write ieee80211_node. This reduces code duplication. It will help us support passive scanning and rate adaptation. --- sys/dev/ic/ath.c | 11 +++-------- sys/dev/ic/atw.c | 11 +++-------- sys/dev/ic/awi.c | 13 +++---------- sys/dev/ic/wi.c | 11 +++-------- 4 files changed, 12 insertions(+), 34 deletions(-) diff --git a/sys/dev/ic/ath.c b/sys/dev/ic/ath.c index 1cab1049b947..b63383c4df50 100644 --- a/sys/dev/ic/ath.c +++ b/sys/dev/ic/ath.c @@ -1,4 +1,4 @@ -/* $NetBSD: ath.c,v 1.13 2003/10/21 01:00:57 yamt Exp $ */ +/* $NetBSD: ath.c,v 1.14 2003/11/02 01:55:40 dyoung Exp $ */ /*- * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting @@ -41,7 +41,7 @@ __FBSDID("$FreeBSD: src/sys/dev/ath/if_ath.c,v 1.14 2003/09/05 22:22:49 sam Exp $"); #endif #ifdef __NetBSD__ -__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.13 2003/10/21 01:00:57 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ath.c,v 1.14 2003/11/02 01:55:40 dyoung Exp $"); #endif /* @@ -2114,12 +2114,7 @@ ath_rx_proc(void *arg, int npending) * something so we fall back to ic_bss when this frame * is from an unknown sender. */ - if (ic->ic_opmode != IEEE80211_M_STA) { - ni = ieee80211_find_node(ic, wh->i_addr2); - if (ni == NULL) - ni = ieee80211_ref_node(ic->ic_bss); - } else - ni = ieee80211_ref_node(ic->ic_bss); + ni = ieee80211_find_rxnode(ic, wh); ATH_NODE(ni)->an_rx_antenna = ds->ds_rxstat.rs_antenna; /* * Send frame up for processing. diff --git a/sys/dev/ic/atw.c b/sys/dev/ic/atw.c index 03e41a1230e0..c8b223c32053 100644 --- a/sys/dev/ic/atw.c +++ b/sys/dev/ic/atw.c @@ -1,4 +1,4 @@ -/* $NetBSD: atw.c,v 1.7 2003/10/25 21:32:44 christos Exp $ */ +/* $NetBSD: atw.c,v 1.8 2003/11/02 01:55:40 dyoung Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.7 2003/10/25 21:32:44 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.8 2003/11/02 01:55:40 dyoung Exp $"); #include "bpfilter.h" @@ -3065,12 +3065,7 @@ atw_rxintr(sc) #endif /* NPBFILTER > 0 */ wh = mtod(m, struct ieee80211_frame *); - if (ic->ic_opmode != IEEE80211_M_STA) { - ni = ieee80211_find_node(ic, wh->i_addr2); - if (ni == NULL) - ni = ieee80211_ref_node(ic->ic_bss); - } else - ni = ieee80211_ref_node(ic->ic_bss); + ni = ieee80211_find_rxnode(ic, wh); ieee80211_input(ifp, m, ni, rssi, 0); /* * The frame may have caused the node to be marked for diff --git a/sys/dev/ic/awi.c b/sys/dev/ic/awi.c index 3e031b7d8140..47a5d3c511ab 100644 --- a/sys/dev/ic/awi.c +++ b/sys/dev/ic/awi.c @@ -1,4 +1,4 @@ -/* $NetBSD: awi.c,v 1.56 2003/10/30 01:58:17 simonb Exp $ */ +/* $NetBSD: awi.c,v 1.57 2003/11/02 01:55:40 dyoung Exp $ */ /*- * Copyright (c) 1999,2000,2001 The NetBSD Foundation, Inc. @@ -85,7 +85,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.56 2003/10/30 01:58:17 simonb Exp $"); +__KERNEL_RCSID(0, "$NetBSD: awi.c,v 1.57 2003/11/02 01:55:40 dyoung Exp $"); #include "opt_inet.h" #include "bpfilter.h" @@ -1085,14 +1085,7 @@ awi_rx_int(struct awi_softc *sc) goto rx_next; } wh = mtod(m, struct ieee80211_frame *); - if (ic->ic_opmode != IEEE80211_M_STA) { - ni = ieee80211_find_node(ic, - wh->i_addr2); - if (ni == NULL) - ni = ieee80211_ref_node( - ic->ic_bss); - } else - ni = ieee80211_ref_node(ic->ic_bss); + ni = ieee80211_find_rxnode(ic, wh); ieee80211_input(ifp, m, ni, rssi, rstamp); /* * The frame may have caused the diff --git a/sys/dev/ic/wi.c b/sys/dev/ic/wi.c index 82bce3fbbe05..747ae20ce768 100644 --- a/sys/dev/ic/wi.c +++ b/sys/dev/ic/wi.c @@ -1,4 +1,4 @@ -/* $NetBSD: wi.c,v 1.142 2003/11/02 01:39:22 dyoung Exp $ */ +/* $NetBSD: wi.c,v 1.143 2003/11/02 01:55:40 dyoung Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.142 2003/11/02 01:39:22 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wi.c,v 1.143 2003/11/02 01:55:40 dyoung Exp $"); #define WI_HERMES_AUTOINC_WAR /* Work around data write autoinc bug. */ #define WI_HERMES_STATS_WAR /* Work around stats counter bug. */ @@ -1307,12 +1307,7 @@ wi_rx_intr(struct wi_softc *sc) if (ic->ic_opmode == IEEE80211_M_IBSS && dir == IEEE80211_FC1_DIR_NODS) wi_sync_bssid(sc, wh->i_addr3); - if (ic->ic_opmode != IEEE80211_M_STA) { - ni = ieee80211_find_node(ic, wh->i_addr2); - if (ni == NULL) - ni = ieee80211_ref_node(ic->ic_bss); - } else - ni = ieee80211_ref_node(ic->ic_bss); + ni = ieee80211_find_rxnode(ic, wh); ieee80211_input(ifp, m, ni, rssi, rstamp);