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
This commit is contained in:
sam 2008-06-07 18:38:02 +00:00
parent cbfc222a85
commit 87278ff58a
11 changed files with 42 additions and 27 deletions

View File

@ -169,7 +169,8 @@ static void ath_descdma_cleanup(struct ath_softc *sc,
struct ath_descdma *, ath_bufhead *); struct ath_descdma *, ath_bufhead *);
static int ath_desc_alloc(struct ath_softc *); static int ath_desc_alloc(struct ath_softc *);
static void ath_desc_free(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_free(struct ieee80211_node *);
static void ath_node_getsignal(const struct ieee80211_node *, static void ath_node_getsignal(const struct ieee80211_node *,
int8_t *, int8_t *); int8_t *, int8_t *);
@ -3659,9 +3660,9 @@ ath_desc_free(struct ath_softc *sc)
} }
static struct ieee80211_node * 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; struct ath_softc *sc = ic->ic_ifp->if_softc;
const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space; const size_t space = sizeof(struct ath_node) + sc->sc_rc->arc_space;
struct ath_node *an; struct ath_node *an;

View File

@ -147,7 +147,8 @@ static int iwi_alloc_rx_ring(struct iwi_softc *, struct iwi_rx_ring *,
int); int);
static void iwi_reset_rx_ring(struct iwi_softc *, struct iwi_rx_ring *); 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 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_node_free(struct ieee80211_node *);
static void iwi_media_status(struct ifnet *, struct ifmediareq *); static void iwi_media_status(struct ifnet *, struct ifmediareq *);
static int iwi_newstate(struct ieee80211vap *, enum ieee80211_state, int); static int iwi_newstate(struct ieee80211vap *, enum ieee80211_state, int);
@ -903,14 +904,14 @@ iwi_resume(device_t dev)
} }
static struct ieee80211_node * 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; struct iwi_node *in;
in = malloc(sizeof (struct iwi_node), M_80211_NODE, M_NOWAIT | M_ZERO); in = malloc(sizeof (struct iwi_node), M_80211_NODE, M_NOWAIT | M_ZERO);
if (in == NULL) if (in == NULL)
return NULL; return NULL;
/* XXX assign sta table entry for adhoc */
in->in_station = -1; in->in_station = -1;
return &in->in_node; return &in->in_node;

View File

@ -103,7 +103,8 @@ int iwn_alloc_tx_ring(struct iwn_softc *, struct iwn_tx_ring *,
int); int);
void iwn_reset_tx_ring(struct iwn_softc *, struct iwn_tx_ring *); void iwn_reset_tx_ring(struct iwn_softc *, struct iwn_tx_ring *);
void iwn_free_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); void iwn_newassoc(struct ieee80211_node *, int);
int iwn_media_change(struct ifnet *); int iwn_media_change(struct ifnet *);
int iwn_newstate(struct ieee80211vap *, enum ieee80211_state, int); 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 * 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); return malloc(sizeof (struct iwn_node), M_80211_NODE,M_NOWAIT | M_ZERO);
} }

View File

@ -104,8 +104,8 @@ static void rt2560_reset_rx_ring(struct rt2560_softc *,
struct rt2560_rx_ring *); struct rt2560_rx_ring *);
static void rt2560_free_rx_ring(struct rt2560_softc *, static void rt2560_free_rx_ring(struct rt2560_softc *,
struct rt2560_rx_ring *); struct rt2560_rx_ring *);
static struct ieee80211_node *rt2560_node_alloc( static struct ieee80211_node *rt2560_node_alloc(struct ieee80211vap *,
struct ieee80211_node_table *); const uint8_t [IEEE80211_ADDR_LEN]);
static void rt2560_newassoc(struct ieee80211_node *, int); static void rt2560_newassoc(struct ieee80211_node *, int);
static int rt2560_newstate(struct ieee80211vap *, static int rt2560_newstate(struct ieee80211vap *,
enum ieee80211_state, int); 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 * 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; struct rt2560_node *rn;

View File

@ -101,8 +101,8 @@ static void rt2661_reset_rx_ring(struct rt2661_softc *,
struct rt2661_rx_ring *); struct rt2661_rx_ring *);
static void rt2661_free_rx_ring(struct rt2661_softc *, static void rt2661_free_rx_ring(struct rt2661_softc *,
struct rt2661_rx_ring *); struct rt2661_rx_ring *);
static struct ieee80211_node *rt2661_node_alloc( static struct ieee80211_node *rt2661_node_alloc(struct ieee80211vap *,
struct ieee80211_node_table *); const uint8_t [IEEE80211_ADDR_LEN]);
static void rt2661_newassoc(struct ieee80211_node *, int); static void rt2661_newassoc(struct ieee80211_node *, int);
static int rt2661_newstate(struct ieee80211vap *, static int rt2661_newstate(struct ieee80211vap *,
enum ieee80211_state, int); 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 * 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; struct rt2661_node *rn;

View File

@ -195,7 +195,8 @@ static int rum_prepare_beacon(struct rum_softc *,
struct ieee80211vap *); struct ieee80211vap *);
static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *, static int rum_raw_xmit(struct ieee80211_node *, struct mbuf *,
const struct ieee80211_bpf_params *); 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_newassoc(struct ieee80211_node *, int);
static void rum_scan_start(struct ieee80211com *); static void rum_scan_start(struct ieee80211com *);
static void rum_scan_end(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 */ /* ARGUSED */
static struct ieee80211_node * 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; struct rum_node *rn;

View File

@ -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 void ural_bbp_write(struct ural_softc *, uint8_t, uint8_t);
static uint8_t ural_bbp_read(struct ural_softc *, 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 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_newassoc(struct ieee80211_node *, int);
static void ural_scan_start(struct ieee80211com *); static void ural_scan_start(struct ieee80211com *);
static void ural_scan_end(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 */ /* ARGUSED */
static struct ieee80211_node * 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; struct ural_node *un;

View File

@ -163,7 +163,8 @@ static int zyd_alloc_tx_list(struct zyd_softc *);
static void zyd_free_tx_list(struct zyd_softc *); static void zyd_free_tx_list(struct zyd_softc *);
static int zyd_alloc_rx_list(struct zyd_softc *); static int zyd_alloc_rx_list(struct zyd_softc *);
static void zyd_free_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 void zyd_task(void *);
static int zyd_newstate(struct ieee80211vap *, enum ieee80211_state, int); static int zyd_newstate(struct ieee80211vap *, enum ieee80211_state, int);
static int zyd_cmd(struct zyd_softc *, uint16_t, const void *, 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 */ /* ARGUSED */
static struct ieee80211_node * 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; struct zyd_node *zn;

View File

@ -170,7 +170,8 @@ static int wpi_alloc_tx_ring(struct wpi_softc *, struct wpi_tx_ring *,
int, int); int, int);
static void wpi_reset_tx_ring(struct wpi_softc *, struct wpi_tx_ring *); 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 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 int wpi_newstate(struct ieee80211vap *, enum ieee80211_state, int);
static void wpi_mem_lock(struct wpi_softc *); static void wpi_mem_lock(struct wpi_softc *);
static void wpi_mem_unlock(struct wpi_softc *); static void wpi_mem_unlock(struct wpi_softc *);
@ -1246,7 +1247,8 @@ wpi_resume(device_t dev)
/* ARGSUSED */ /* ARGSUSED */
static struct ieee80211_node * 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; struct wpi_node *wn;

View File

@ -67,7 +67,8 @@ __FBSDID("$FreeBSD$");
static int ieee80211_sta_join1(struct ieee80211_node *); 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_cleanup(struct ieee80211_node *);
static void node_free(struct ieee80211_node *); static void node_free(struct ieee80211_node *);
static void node_age(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 * 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; struct ieee80211_node *ni;
@ -948,7 +949,7 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt,
struct ieee80211_node *ni; struct ieee80211_node *ni;
int hash; int hash;
ni = ic->ic_node_alloc(nt); ni = ic->ic_node_alloc(vap, macaddr);
if (ni == NULL) { if (ni == NULL) {
vap->iv_stats.is_rx_nodealloc++; vap->iv_stats.is_rx_nodealloc++;
return NULL; return NULL;
@ -996,7 +997,7 @@ ieee80211_tmp_node(struct ieee80211vap *vap,
struct ieee80211com *ic = vap->iv_ic; struct ieee80211com *ic = vap->iv_ic;
struct ieee80211_node *ni; struct ieee80211_node *ni;
ni = ic->ic_node_alloc(&ic->ic_sta); ni = ic->ic_node_alloc(vap, macaddr);
if (ni != NULL) { if (ni != NULL) {
IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE, IEEE80211_DPRINTF(vap, IEEE80211_MSG_NODE,
"%s %p<%s>\n", __func__, ni, ether_sprintf(macaddr)); "%s %p<%s>\n", __func__, ni, ether_sprintf(macaddr));

View File

@ -227,7 +227,8 @@ struct ieee80211com {
/* new station association callback/notification */ /* new station association callback/notification */
void (*ic_newassoc)(struct ieee80211_node *, int); void (*ic_newassoc)(struct ieee80211_node *, int);
/* node state management */ /* 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_free)(struct ieee80211_node *);
void (*ic_node_cleanup)(struct ieee80211_node *); void (*ic_node_cleanup)(struct ieee80211_node *);
void (*ic_node_age)(struct ieee80211_node *); void (*ic_node_age)(struct ieee80211_node *);