From ee42a35979a58ace9d005ad3082a2d7fa33a42a9 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Tue, 1 Apr 2014 01:58:31 +0200
Subject: [PATCH 2/4] WIP FreeBSD r217511

---
 sys/bus/u4b/wlan/if_rum.c                 | 9 ---------
 sys/dev/netif/ral/rt2661.c                | 9 ---------
 sys/dev/netif/wpi/if_wpi.c                | 9 ---------
 sys/netproto/802_11/wlan/ieee80211_node.c | 4 ++++
 4 files changed, 4 insertions(+), 27 deletions(-)

diff --git a/sys/bus/u4b/wlan/if_rum.c b/sys/bus/u4b/wlan/if_rum.c
index 9441172..1a40f7e 100644
--- a/sys/bus/u4b/wlan/if_rum.c
+++ b/sys/bus/u4b/wlan/if_rum.c
@@ -159,7 +159,6 @@ static void		rum_vap_delete(struct ieee80211vap *);
 static void		rum_tx_free(struct rum_tx_data *, int);
 static void		rum_setup_tx_list(struct rum_softc *);
 static void		rum_unsetup_tx_list(struct rum_softc *);
-static void		rum_newassoc(struct ieee80211_node *, int);
 static int		rum_newstate(struct ieee80211vap *,
 			    enum ieee80211_state, int);
 static void		rum_setup_tx_desc(struct rum_softc *,
@@ -512,7 +511,6 @@ rum_attach(device_t self)
 	ieee80211_init_channels(ic, NULL, &bands);
 
 	ieee80211_ifattach(ic, sc->sc_bssid);
-	ic->ic_newassoc = rum_newassoc;
 	ic->ic_update_promisc = rum_update_promisc;
 	ic->ic_raw_xmit = rum_raw_xmit;
 	ic->ic_scan_start = rum_scan_start;
@@ -701,13 +699,6 @@ rum_unsetup_tx_list(struct rum_softc *sc)
 	}
 }
 
-static void
-rum_newassoc(struct ieee80211_node *ni, int isnew)
-{
-	ieee80211_ratectl_node_deinit(ni);
-	ieee80211_ratectl_node_init(ni);
-}
-
 static int
 rum_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
 {
diff --git a/sys/dev/netif/ral/rt2661.c b/sys/dev/netif/ral/rt2661.c
index cd02843..685f053 100644
--- a/sys/dev/netif/ral/rt2661.c
+++ b/sys/dev/netif/ral/rt2661.c
@@ -98,7 +98,6 @@ 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 void		rt2661_newassoc(struct ieee80211_node *, int);
 static int		rt2661_newstate(struct ieee80211vap *,
 			    enum ieee80211_state, int);
 static uint16_t		rt2661_eeprom_read(struct rt2661_softc *, uint8_t);
@@ -303,7 +302,6 @@ rt2661_attach(device_t dev, int id)
 	ieee80211_init_channels(ic, NULL, &bands);
 
 	ieee80211_ifattach(ic, macaddr);
-	ic->ic_newassoc = rt2661_newassoc;
 #if 0
 	ic->ic_wme.wme_update = rt2661_wme_update;
 #endif
@@ -769,13 +767,6 @@ rt2661_free_rx_ring(struct rt2661_softc *sc, struct rt2661_rx_ring *ring)
 		bus_dma_tag_destroy(ring->data_dmat);
 }
 
-static void
-rt2661_newassoc(struct ieee80211_node *ni, int isnew)
-{
-	ieee80211_ratectl_node_deinit(ni);
-	ieee80211_ratectl_node_init(ni);
-}
-
 static int
 rt2661_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg)
 {
diff --git a/sys/dev/netif/wpi/if_wpi.c b/sys/dev/netif/wpi/if_wpi.c
index 33af5a0..67cb525 100644
--- a/sys/dev/netif/wpi/if_wpi.c
+++ b/sys/dev/netif/wpi/if_wpi.c
@@ -239,7 +239,6 @@ static void	wpi_init_locked(struct wpi_softc *, int);
 static void	wpi_stop(struct wpi_softc *);
 static void	wpi_stop_locked(struct wpi_softc *);
 
-static void	wpi_newassoc(struct ieee80211_node *, int);
 static int	wpi_set_txpower(struct wpi_softc *, struct ieee80211_channel *,
 		    int);
 static void	wpi_calib_timeout_callout(void *);
@@ -676,7 +675,6 @@ wpi_attach(device_t dev)
 	ieee80211_ifattach(ic, macaddr);
 	/* override default methods */
 	ic->ic_node_alloc = wpi_node_alloc;
-	ic->ic_newassoc = wpi_newassoc;
 	ic->ic_raw_xmit = wpi_raw_xmit;
 	ic->ic_wme.wme_update = wpi_wme_update;
 	ic->ic_scan_start = wpi_scan_start;
@@ -3215,13 +3213,6 @@ wpi_stop(struct wpi_softc *sc)
 }
 
 static void
-wpi_newassoc(struct ieee80211_node *ni, int isnew)
-{
-	/* XXX move */
-	ieee80211_ratectl_node_init(ni);
-}
-
-static void
 wpi_calib_timeout_callout(void *arg)
 {
 	struct wpi_softc *sc = arg;
diff --git a/sys/netproto/802_11/wlan/ieee80211_node.c b/sys/netproto/802_11/wlan/ieee80211_node.c
index 814035b..0628e57 100644
--- a/sys/netproto/802_11/wlan/ieee80211_node.c
+++ b/sys/netproto/802_11/wlan/ieee80211_node.c
@@ -1131,6 +1131,8 @@ ieee80211_alloc_node(struct ieee80211_node_table *nt,
 	ni->ni_vap = vap;
 	ni->ni_ic = ic;
 
+	ieee80211_ratectl_node_init(ni);
+
 	IEEE80211_NOTE(vap, IEEE80211_MSG_INACT, ni,
 	    "%s: inact_reload %u", __func__, ni->ni_inact_reload);
 
@@ -1174,6 +1176,8 @@ ieee80211_tmp_node(struct ieee80211vap *vap,
 		ni->ni_txpower = bss->ni_txpower;
 		/* XXX optimize away */
 		ieee80211_psq_init(&ni->ni_psq, "unknown");
+
+		ieee80211_ratectl_node_init(ni);
 	} else {
 		/* XXX msg */
 		vap->iv_stats.is_rx_nodealloc++;
-- 
1.8.4.1

