FreeBSD Bugzilla – Attachment 154032 Details for
Bug 197143
[wpi] [patch]: sync with iwn / OpenBSD wpi
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Replace kernel unit number allocator with local set of functions
patch-wpi21.diff (text/plain), 3.73 KB, created by
Andriy Voskoboinyk
on 2015-03-08 18:51:21 UTC
(
hide
)
Description:
Replace kernel unit number allocator with local set of functions
Filename:
MIME Type:
Creator:
Andriy Voskoboinyk
Created:
2015-03-08 18:51:21 UTC
Size:
3.73 KB
patch
obsolete
>Index: sys/dev/wpi/if_wpi.c >=================================================================== >--- sys/dev/wpi/if_wpi.c (revision 279775) >+++ sys/dev/wpi/if_wpi.c (working copy) >@@ -169,6 +169,7 @@ > struct ieee80211_regdomain *, int, > struct ieee80211_channel[]); > static int wpi_read_eeprom_group(struct wpi_softc *, int); >+static int wpi_add_node_entry_adhoc(struct wpi_softc *); > static void wpi_node_free(struct ieee80211_node *); > static struct ieee80211_node *wpi_node_alloc(struct ieee80211vap *, > const uint8_t mac[IEEE80211_ADDR_LEN]); >@@ -384,8 +385,6 @@ > > WPI_LOCK_INIT(sc); > >- sc->sc_unr = new_unrhdr(WPI_ID_IBSS_MIN, WPI_ID_IBSS_MAX, &sc->sc_mtx); >- > /* Allocate DMA memory for firmware transfers. */ > if ((error = wpi_alloc_fwmem(sc)) != 0) { > device_printf(dev, >@@ -679,8 +678,6 @@ > if (ifp != NULL) > if_free(ifp); > >- delete_unrhdr(sc->sc_unr); >- > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_END, __func__); > WPI_LOCK_DESTROY(sc); > return 0; >@@ -1514,6 +1511,42 @@ > return 0; > } > >+static int >+wpi_add_node_entry_adhoc(struct wpi_softc *sc) >+{ >+ int newid = WPI_ID_IBSS_MIN; >+ >+ for (; newid <= WPI_ID_IBSS_MAX; newid++) { >+ if ((sc->nodesmsk & (1 << newid)) == 0) { >+ sc->nodesmsk |= 1 << newid; >+ return newid; >+ } >+ } >+ >+ return WPI_ID_UNDEFINED; >+} >+ >+static __inline int >+wpi_check_node_entry(struct wpi_softc *sc, uint8_t id) >+{ >+ if (id == WPI_ID_UNDEFINED) >+ return 0; >+ >+ return (sc->nodesmsk >> id) & 1; >+} >+ >+static __inline void >+wpi_clear_node_table(struct wpi_softc *sc) >+{ >+ sc->nodesmsk = 0; >+} >+ >+static __inline void >+wpi_del_node_entry(struct wpi_softc *sc, uint8_t id) >+{ >+ sc->nodesmsk &= ~(1 << id); >+} >+ > static struct ieee80211_node * > wpi_node_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN]) > { >@@ -1538,11 +1571,11 @@ > struct wpi_node *wn = WPI_NODE(ni); > > if (wn->id >= WPI_ID_IBSS_MIN && wn->id <= WPI_ID_IBSS_MAX) { >- free_unr(sc->sc_unr, wn->id); >- > WPI_LOCK(sc); >- if (sc->rxon.filter & htole32(WPI_FILTER_BSS)) >+ if (wpi_check_node_entry(sc, wn->id)) { >+ wpi_del_node_entry(sc, wn->id); > wpi_del_node(sc, ni); >+ } > WPI_UNLOCK(sc); > } > >@@ -2050,6 +2083,7 @@ > le32toh(*status)); > > if (le32toh(*status) & 1) { >+ wpi_clear_node_table(sc); > ieee80211_runtask(ic, &sc->sc_radiooff_task); > return; > } >@@ -3001,6 +3035,7 @@ > wpi_add_ibss_node(struct wpi_softc *sc, struct ieee80211_node *ni) > { > struct wpi_node *wn = WPI_NODE(ni); >+ int error; > > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_DOING, __func__); > >@@ -3007,12 +3042,18 @@ > if (wn->id != WPI_ID_UNDEFINED) > return EINVAL; > >- wn->id = alloc_unrl(sc->sc_unr); >+ if ((wn->id = wpi_add_node_entry_adhoc(sc)) == WPI_ID_UNDEFINED) { >+ device_printf(sc->sc_dev, "%s: h/w table is full\n", __func__); >+ return ENOMEM; >+ } > >- if (wn->id == (uint8_t)-1) >- return ENOBUFS; >+ if ((error = wpi_add_node(sc, ni)) != 0) { >+ wpi_del_node_entry(sc, wn->id); >+ wn->id = WPI_ID_UNDEFINED; >+ return error; >+ } > >- return wpi_add_node(sc, ni); >+ return 0; > } > > static void >@@ -3404,6 +3445,8 @@ > } else { > error = wpi_cmd(sc, WPI_CMD_RXON, &sc->rxon, > sizeof (struct wpi_rxon), async); >+ >+ wpi_clear_node_table(sc); > } > if (error != 0) { > device_printf(sc->sc_dev, "RXON command failed, error %d\n", >Index: sys/dev/wpi/if_wpivar.h >=================================================================== >--- sys/dev/wpi/if_wpivar.h (revision 279775) >+++ sys/dev/wpi/if_wpivar.h (working copy) >@@ -151,7 +151,6 @@ > int sc_debug; > > struct mtx sc_mtx; >- struct unrhdr *sc_unr; > > /* Flags indicating the current state the driver > * expects the hardware to be in >@@ -189,6 +188,7 @@ > struct wpi_rxon rxon; > int temp; > uint32_t qfullmsk; >+ uint32_t nodesmsk; > > int sc_tx_timer; > int sc_scan_timer;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 197143
:
152282
|
152662
|
152977
|
153911
|
153977
|
153983
|
153985
|
153999
|
154000
|
154002
|
154006
|
154007
|
154009
|
154010
|
154011
|
154013
|
154015
|
154016
|
154017
|
154019
|
154020
|
154021
|
154022
|
154024
|
154026
|
154030
| 154032 |
154033
|
154328
|
154329
|
154330
|
154332
|
154334
|
154335
|
154336
|
154337
|
154338
|
154340
|
154341
|
154343
|
154346
|
154347
|
154348
|
154349
|
154350
|
154351
|
154352
|
154353
|
154354
|
154355
|
154356
|
154357
|
154358
|
154359
|
154360
|
154361
|
154362
|
154363
|
154364
|
154365
|
154366
|
154368
|
154369
|
154370
|
154371
|
154372
|
154373
|
154374
|
154375
|
154378
|
154379
|
154380
|
154381
|
154382
|
154383
|
154384
|
155332
|
155333
|
156164
|
156165
|
156166
|
156167
|
156168
|
156169
|
156170
|
156171
|
156172
|
156173
|
156174
|
156175
|
156176
|
156177
|
156178
|
156179
|
156180
|
156181
|
156182
|
156183
|
156184
|
156185
|
156186
|
156187
|
156188
|
156189
|
156190
|
156191
|
156192
|
156193
|
156194
|
156195