From 87278ff58a1872ef2002ec481db68eebce6f5884 Mon Sep 17 00:00:00 2001 From: sam Date: Sat, 7 Jun 2008 18:38:02 +0000 Subject: [PATCH] Change the calling convention for ic_node_alloc to deal with some longstanding issues: o pass the vap since it's now the "coin of the realm" and required to do things like set initial tx parameters in private node state for use prior to association o pass the mac address as cards that maintain outboard station tables require this to create an entry (e.g. in ibss mode) o remove the node table reference, we only have one node table and it's unlikely this will change so this is not needed to find the com structure --- sys/dev/ath/if_ath.c | 7 ++++--- sys/dev/iwi/if_iwi.c | 7 ++++--- sys/dev/iwn/if_iwn.c | 5 +++-- sys/dev/ral/rt2560.c | 7 ++++--- sys/dev/ral/rt2661.c | 7 ++++--- sys/dev/usb/if_rum.c | 6 ++++-- sys/dev/usb/if_ural.c | 6 ++++-- sys/dev/usb/if_zyd.c | 6 ++++-- sys/dev/wpi/if_wpi.c | 6 ++++-- sys/net80211/ieee80211_node.c | 9 +++++---- sys/net80211/ieee80211_var.h | 3 ++- 11 files changed, 42 insertions(+), 27 deletions(-) diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c index 7318284f8a62..87c9d6151d3b 100644 --- a/sys/dev/ath/if_ath.c +++ b/sys/dev/ath/if_ath.c @@ -169,7 +169,8 @@ static void ath_descdma_cleanup(struct ath_softc *sc, struct ath_descdma *, ath_bufhead *); static int ath_desc_alloc(struct ath_softc *); static void ath_desc_free(struct ath_softc *); -static struct ieee80211_node *ath_node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *ath_node_alloc(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); static void ath_node_free(struct ieee80211_node *); static void ath_node_getsignal(const struct ieee80211_node *, int8_t *, int8_t *); @@ -3659,9 +3660,9 @@ ath_desc_free(struct ath_softc *sc) } static struct ieee80211_node * -ath_node_alloc(struct ieee80211_node_table *nt) +ath_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) { - struct ieee80211com *ic = nt->nt_ic; + struct ieee80211com *ic = vap->iv_ic; struct ath_softc *sc = ic->ic_ifp->if_softc; const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space; struct ath_node *an; diff --git a/sys/dev/iwi/if_iwi.c b/sys/dev/iwi/if_iwi.c index 4f81c1b48e4d..81e0220f2a59 100644 --- a/sys/dev/iwi/if_iwi.c +++ b/sys/dev/iwi/if_iwi.c @@ -147,7 +147,8 @@ static int iwi_alloc_rx_ring(struct iwi_softc *, struct iwi_rx_ring *, int); static void iwi_reset_rx_ring(struct iwi_softc *, struct iwi_rx_ring *); static void iwi_free_rx_ring(struct iwi_softc *, struct iwi_rx_ring *); -static struct ieee80211_node *iwi_node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *iwi_node_alloc(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); static void iwi_node_free(struct ieee80211_node *); static void iwi_media_status(struct ifnet *, struct ifmediareq *); static int iwi_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -903,14 +904,14 @@ iwi_resume(device_t dev) } static struct ieee80211_node * -iwi_node_alloc(struct ieee80211_node_table *nt) +iwi_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) { struct iwi_node *in; in = malloc(sizeof (struct iwi_node), M_80211_NODE, M_NOWAIT | M_ZERO); if (in == NULL) return NULL; - + /* XXX assign sta table entry for adhoc */ in->in_station = -1; return &in->in_node; diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index ee7bda581596..332c2ce6b043 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -103,7 +103,8 @@ int iwn_alloc_tx_ring(struct iwn_softc *, struct iwn_tx_ring *, int); void iwn_reset_tx_ring(struct iwn_softc *, struct iwn_tx_ring *); void iwn_free_tx_ring(struct iwn_softc *, struct iwn_tx_ring *); -struct ieee80211_node *iwn_node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *iwn_node_alloc(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); void iwn_newassoc(struct ieee80211_node *, int); int iwn_media_change(struct ifnet *); int iwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -941,7 +942,7 @@ iwn_free_tx_ring(struct iwn_softc *sc, struct iwn_tx_ring *ring) } struct ieee80211_node * -iwn_node_alloc(struct ieee80211_node_table *ic) +iwn_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) { return malloc(sizeof (struct iwn_node), M_80211_NODE,M_NOWAIT | M_ZERO); } diff --git a/sys/dev/ral/rt2560.c b/sys/dev/ral/rt2560.c index d012b8f9dd14..013a0e209fd7 100644 --- a/sys/dev/ral/rt2560.c +++ b/sys/dev/ral/rt2560.c @@ -104,8 +104,8 @@ static void rt2560_reset_rx_ring(struct rt2560_softc *, struct rt2560_rx_ring *); static void rt2560_free_rx_ring(struct rt2560_softc *, struct rt2560_rx_ring *); -static struct ieee80211_node *rt2560_node_alloc( - struct ieee80211_node_table *); +static struct ieee80211_node *rt2560_node_alloc(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); static void rt2560_newassoc(struct ieee80211_node *, int); static int rt2560_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -767,7 +767,8 @@ rt2560_free_rx_ring(struct rt2560_softc *sc, struct rt2560_rx_ring *ring) } static struct ieee80211_node * -rt2560_node_alloc(struct ieee80211_node_table *nt) +rt2560_node_alloc(struct ieee80211vap *vap, + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct rt2560_node *rn; diff --git a/sys/dev/ral/rt2661.c b/sys/dev/ral/rt2661.c index cc89d165f2fc..ae31d5e8a13e 100644 --- a/sys/dev/ral/rt2661.c +++ b/sys/dev/ral/rt2661.c @@ -101,8 +101,8 @@ static void rt2661_reset_rx_ring(struct rt2661_softc *, struct rt2661_rx_ring *); static void rt2661_free_rx_ring(struct rt2661_softc *, struct rt2661_rx_ring *); -static struct ieee80211_node *rt2661_node_alloc( - struct ieee80211_node_table *); +static struct ieee80211_node *rt2661_node_alloc(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); static void rt2661_newassoc(struct ieee80211_node *, int); static int rt2661_newstate(struct ieee80211vap *, enum ieee80211_state, int); @@ -776,7 +776,8 @@ rt2661_free_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring) } static struct ieee80211_node * -rt2661_node_alloc(struct ieee80211_node_table *nt) +rt2661_node_alloc(struct ieee80211vap *vap, + const uint8_t mac[IEEE80211_ADDR_LEN]) { struct rt2661_node *rn; diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 3c68d49b54db..2f26991926b8 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -195,7 +195,8 @@ static int rum_prepare_beacon(struct rum_softc *, struct ieee80211vap *); static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, const struct ieee80211_bpf_params *); -static struct ieee80211_node *rum_node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *rum_node_alloc(struct ieee80211vap *, + const uint8_t mac[IEEE80211_ADDR_LEN]); static void rum_newassoc(struct ieee80211_node *, int); static void rum_scan_start(struct ieee80211com *); static void rum_scan_end(struct ieee80211com *); @@ -2394,7 +2395,8 @@ rum_amrr_update(usbd_xfer_handle xfer, usbd_private_handle priv, /* ARGUSED */ static struct ieee80211_node * -rum_node_alloc(struct ieee80211_node_table *nt __unused) +rum_node_alloc(struct ieee80211vap *vap __unused, + const uint8_t mac[IEEE80211_ADDR_LEN] __unused) { struct rum_node *rn; diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index b072fa0acc9e..1205dd1cf6e7 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -156,7 +156,8 @@ static void ural_write_multi(struct ural_softc *, uint16_t, void *, static void ural_bbp_write(struct ural_softc *, uint8_t, uint8_t); static uint8_t ural_bbp_read(struct ural_softc *, uint8_t); static void ural_rf_write(struct ural_softc *, uint8_t, uint32_t); -static struct ieee80211_node *ural_node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *ural_node_alloc(struct ieee80211vap *, + const uint8_t mac[IEEE80211_ADDR_LEN]); static void ural_newassoc(struct ieee80211_node *, int); static void ural_scan_start(struct ieee80211com *); static void ural_scan_end(struct ieee80211com *); @@ -1759,7 +1760,8 @@ ural_rf_write(struct ural_softc *sc, uint8_t reg, uint32_t val) /* ARGUSED */ static struct ieee80211_node * -ural_node_alloc(struct ieee80211_node_table *nt __unused) +ural_node_alloc(struct ieee80211vap *vap __unused, + const uint8_t mac[IEEE80211_ADDR_LEN] __unused) { struct ural_node *un; diff --git a/sys/dev/usb/if_zyd.c b/sys/dev/usb/if_zyd.c index 70629697e342..ecd7df766d15 100644 --- a/sys/dev/usb/if_zyd.c +++ b/sys/dev/usb/if_zyd.c @@ -163,7 +163,8 @@ static int zyd_alloc_tx_list(struct zyd_softc *); static void zyd_free_tx_list(struct zyd_softc *); static int zyd_alloc_rx_list(struct zyd_softc *); static void zyd_free_rx_list(struct zyd_softc *); -static struct ieee80211_node *zyd_node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *zyd_node_alloc(struct ieee80211vap *, + const uint8_t mac[IEEE80211_ADDR_LEN]); static void zyd_task(void *); static int zyd_newstate(struct ieee80211vap *, enum ieee80211_state, int); static int zyd_cmd(struct zyd_softc *, uint16_t, const void *, int, @@ -698,7 +699,8 @@ zyd_free_rx_list(struct zyd_softc *sc) /* ARGUSED */ static struct ieee80211_node * -zyd_node_alloc(struct ieee80211_node_table *nt __unused) +zyd_node_alloc(struct ieee80211vap *vap __unused, + const uint8_t mac[IEEE80211_ADDR_LEN] __unused) { struct zyd_node *zn; diff --git a/sys/dev/wpi/if_wpi.c b/sys/dev/wpi/if_wpi.c index 959e20c3aa4b..8257e87749de 100644 --- a/sys/dev/wpi/if_wpi.c +++ b/sys/dev/wpi/if_wpi.c @@ -170,7 +170,8 @@ static int wpi_alloc_tx_ring(struct wpi_softc *, struct wpi_tx_ring *, int, int); static void wpi_reset_tx_ring(struct wpi_softc *, struct wpi_tx_ring *); static void wpi_free_tx_ring(struct wpi_softc *, struct wpi_tx_ring *); -static struct ieee80211_node *wpi_node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *wpi_node_alloc(struct ieee80211vap *, + const uint8_t mac[IEEE80211_ADDR_LEN]); static int wpi_newstate(struct ieee80211vap *, enum ieee80211_state, int); static void wpi_mem_lock(struct wpi_softc *); static void wpi_mem_unlock(struct wpi_softc *); @@ -1246,7 +1247,8 @@ wpi_resume(device_t dev) /* ARGSUSED */ static struct ieee80211_node * -wpi_node_alloc(struct ieee80211_node_table *ic) +wpi_node_alloc(struct ieee80211vap *vap __unused, + const uint8_t mac[IEEE80211_ADDR_LEN] __unused) { struct wpi_node *wn; diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index c6aadb2be34a..61cdeab04f54 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -67,7 +67,8 @@ __FBSDID("$FreeBSD$"); static int ieee80211_sta_join1(struct ieee80211_node *); -static struct ieee80211_node *node_alloc(struct ieee80211_node_table *); +static struct ieee80211_node *node_alloc(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); static void node_cleanup(struct ieee80211_node *); static void node_free(struct ieee80211_node *); static void node_age(struct ieee80211_node *); @@ -723,7 +724,7 @@ ieee80211_node_deauth(struct ieee80211_node *ni, int reason) } static struct ieee80211_node * -node_alloc(struct ieee80211_node_table *nt) +node_alloc(struct ieee80211vap *vap, const uint8_t macaddr[IEEE80211_ADDR_LEN]) { struct ieee80211_node *ni; @@ -948,7 +949,7 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt, struct ieee80211_node *ni; int hash; - ni = ic->ic_node_alloc(nt); + ni = ic->ic_node_alloc(vap, macaddr); if (ni == NULL) { vap->iv_stats.is_rx_nodealloc++; return NULL; @@ -996,7 +997,7 @@ ieee80211_tmp_node(struct ieee80211vap *vap, struct ieee80211com *ic = vap->iv_ic; struct ieee80211_node *ni; - ni = ic->ic_node_alloc(&ic->ic_sta); + ni = ic->ic_node_alloc(vap, macaddr); if (ni != NULL) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, "%s %p<%s>\n", __func__, ni, ether_sprintf(macaddr)); diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index 9b362f6f0714..f92b10f3a6cd 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -227,7 +227,8 @@ struct ieee80211com { /* new station association callback/notification */ void (*ic_newassoc)(struct ieee80211_node *, int); /* node state management */ - struct ieee80211_node* (*ic_node_alloc)(struct ieee80211_node_table *); + struct ieee80211_node* (*ic_node_alloc)(struct ieee80211vap *, + const uint8_t [IEEE80211_ADDR_LEN]); void (*ic_node_free)(struct ieee80211_node *); void (*ic_node_cleanup)(struct ieee80211_node *); void (*ic_node_age)(struct ieee80211_node *);