FreeBSD Bugzilla – Attachment 154343 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]
Allocate 'data' field in wpi_buf structure as static array
patch-wpi34.diff (text/plain), 6.78 KB, created by
Andriy Voskoboinyk
on 2015-03-15 12:20:23 UTC
(
hide
)
Description:
Allocate 'data' field in wpi_buf structure as static array
Filename:
MIME Type:
Creator:
Andriy Voskoboinyk
Created:
2015-03-15 12:20:23 UTC
Size:
6.78 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) >@@ -586,7 +586,6 @@ > const uint8_t mac[IEEE80211_ADDR_LEN]) > { > struct wpi_vap *wvp; >- struct wpi_buf *bcn; > struct ieee80211vap *vap; > > if (!TAILQ_EMPTY(&ic->ic_vaps)) /* only one at a time */ >@@ -599,9 +598,6 @@ > vap = &wvp->vap; > ieee80211_vap_setup(ic, vap, name, unit, opmode, flags, bssid, mac); > >- bcn = &wvp->wv_bcbuf; >- bcn->data = NULL; >- > /* Override with driver methods. */ > wvp->newstate = vap->iv_newstate; > vap->iv_key_alloc = wpi_key_alloc; >@@ -622,13 +618,10 @@ > wpi_vap_delete(struct ieee80211vap *vap) > { > struct wpi_vap *wvp = WPI_VAP(vap); >- struct wpi_buf *bcn = &wvp->wv_bcbuf; > > ieee80211_ratectl_deinit(vap); > ieee80211_vap_detach(vap); > >- if (bcn->data != NULL) >- free(bcn->data, M_DEVBUF); > free(wvp, M_80211_VAP); > } > >@@ -2322,6 +2315,8 @@ > > WPI_TXQ_LOCK(sc); > >+ KASSERT(buf->size <= sizeof(buf->data), ("buffer overflow")); >+ > DPRINTF(sc, WPI_DEBUG_TRACE, TRACE_STR_BEGIN, __func__); > > if (sc->txq_active == 0) { >@@ -2454,8 +2449,8 @@ > struct ieee80211_channel *chan; > struct ieee80211_frame *wh; > struct ieee80211_key *k = NULL; >- struct wpi_cmd_data tx; > struct wpi_buf tx_data; >+ struct wpi_cmd_data *tx = (struct wpi_cmd_data *)&tx_data.data; > uint32_t flags; > uint16_t qos; > uint8_t tid, type; >@@ -2548,7 +2543,7 @@ > flags |= WPI_TX_FULL_TXOP; > } > >- memset(&tx, 0, sizeof (struct wpi_cmd_data)); >+ memset(tx, 0, sizeof (struct wpi_cmd_data)); > if (type == IEEE80211_FC0_TYPE_MGT) { > uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; > >@@ -2557,13 +2552,13 @@ > flags |= WPI_TX_INSERT_TSTAMP; > if (subtype == IEEE80211_FC0_SUBTYPE_ASSOC_REQ || > subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ) >- tx.timeout = htole16(3); >+ tx->timeout = htole16(3); > else >- tx.timeout = htole16(2); >+ tx->timeout = htole16(2); > } > > if (ismcast || type != IEEE80211_FC0_TYPE_DATA) >- tx.id = WPI_ID_BROADCAST; >+ tx->id = WPI_ID_BROADCAST; > else { > if (wn->id == WPI_ID_UNDEFINED) { > device_printf(sc->sc_dev, >@@ -2572,16 +2567,16 @@ > goto fail; > } > >- tx.id = wn->id; >+ tx->id = wn->id; > } > > if (type != IEEE80211_FC0_TYPE_MGT) >- tx.data_ntries = tp->maxretry; >+ tx->data_ntries = tp->maxretry; > > if (k != NULL && !swcrypt) { > switch (k->wk_cipher->ic_cipher) { > case IEEE80211_CIPHER_AES_CCM: >- tx.security = WPI_CIPHER_CCMP; >+ tx->security = WPI_CIPHER_CCMP; > break; > > default: >@@ -2588,22 +2583,21 @@ > break; > } > >- memcpy(tx.key, k->wk_key, k->wk_keylen); >+ memcpy(tx->key, k->wk_key, k->wk_keylen); > } > >- tx.len = htole16(totlen); >- tx.flags = htole32(flags); >- tx.plcp = rate2plcp(rate); >- tx.tid = tid; >- tx.lifetime = htole32(WPI_LIFETIME_INFINITE); >- tx.ofdm_mask = 0xff; >- tx.cck_mask = 0x0f; >- tx.rts_ntries = 7; >+ tx->len = htole16(totlen); >+ tx->flags = htole32(flags); >+ tx->plcp = rate2plcp(rate); >+ tx->tid = tid; >+ tx->lifetime = htole32(WPI_LIFETIME_INFINITE); >+ tx->ofdm_mask = 0xff; >+ tx->cck_mask = 0x0f; >+ tx->rts_ntries = 7; > >- tx_data.data = &tx; > tx_data.ni = ni; > tx_data.m = m; >- tx_data.size = sizeof(tx); >+ tx_data.size = sizeof(struct wpi_cmd_data); > tx_data.code = WPI_CMD_TX_DATA; > tx_data.ac = ac; > >@@ -2619,8 +2613,8 @@ > { > struct ieee80211vap *vap = ni->ni_vap; > struct ieee80211_frame *wh; >- struct wpi_cmd_data tx; > struct wpi_buf tx_data; >+ struct wpi_cmd_data *tx = (struct wpi_cmd_data *)&tx_data.data; > uint32_t flags; > uint8_t type; > int ac, rate, totlen; >@@ -2653,7 +2647,7 @@ > ieee80211_radiotap_tx(vap, m); > } > >- memset(&tx, 0, sizeof (struct wpi_cmd_data)); >+ memset(tx, 0, sizeof (struct wpi_cmd_data)); > if (type == IEEE80211_FC0_TYPE_MGT) { > uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK; > >@@ -2662,23 +2656,22 @@ > flags |= WPI_TX_INSERT_TSTAMP; > if (subtype == IEEE80211_FC0_SUBTYPE_ASSOC_REQ || > subtype == IEEE80211_FC0_SUBTYPE_REASSOC_REQ) >- tx.timeout = htole16(3); >+ tx->timeout = htole16(3); > else >- tx.timeout = htole16(2); >+ tx->timeout = htole16(2); > } > >- tx.len = htole16(totlen); >- tx.flags = htole32(flags); >- tx.plcp = rate2plcp(rate); >- tx.id = WPI_ID_BROADCAST; >- tx.lifetime = htole32(WPI_LIFETIME_INFINITE); >- tx.rts_ntries = params->ibp_try1; >- tx.data_ntries = params->ibp_try0; >+ tx->len = htole16(totlen); >+ tx->flags = htole32(flags); >+ tx->plcp = rate2plcp(rate); >+ tx->id = WPI_ID_BROADCAST; >+ tx->lifetime = htole32(WPI_LIFETIME_INFINITE); >+ tx->rts_ntries = params->ibp_try1; >+ tx->data_ntries = params->ibp_try0; > >- tx_data.data = &tx; > tx_data.ni = ni; > tx_data.m = m; >- tx_data.size = sizeof(tx); >+ tx_data.size = sizeof(struct wpi_cmd_data); > tx_data.code = WPI_CMD_TX_DATA; > tx_data.ac = ac; > >@@ -3933,13 +3926,11 @@ > static int > wpi_setup_beacon(struct wpi_softc *sc, struct ieee80211_node *ni) > { >- struct ifnet *ifp = sc->sc_ifp; >- struct ieee80211com *ic = ifp->if_l2com; >- struct ieee80211vap *vap = ni->ni_vap; >- struct wpi_vap *wvp = WPI_VAP(vap); >+ struct ieee80211com *ic = sc->sc_ifp->if_l2com; >+ struct wpi_vap *wvp = WPI_VAP(ni->ni_vap); > struct wpi_buf *bcn = &wvp->wv_bcbuf; > struct ieee80211_beacon_offsets bo; >- struct wpi_cmd_beacon *cmd; >+ struct wpi_cmd_beacon *cmd = (struct wpi_cmd_beacon *)&bcn->data; > struct mbuf *m; > int totlen; > >@@ -3956,31 +3947,17 @@ > } > totlen = m->m_pkthdr.len; > >- if (bcn->data == NULL) { >- cmd = malloc(sizeof(struct wpi_cmd_beacon), M_DEVBUF, >- M_NOWAIT | M_ZERO); >+ cmd->id = WPI_ID_BROADCAST; >+ cmd->ofdm_mask = 0xff; >+ cmd->cck_mask = 0x0f; >+ cmd->lifetime = htole32(WPI_LIFETIME_INFINITE); >+ cmd->flags = htole32(WPI_TX_AUTO_SEQ | WPI_TX_INSERT_TSTAMP); > >- if (cmd == NULL) { >- device_printf(sc->sc_dev, >- "could not allocate buffer for beacon command\n"); >- m_freem(m); >- return ENOMEM; >- } >+ bcn->ni = NULL; >+ bcn->code = WPI_CMD_SET_BEACON; >+ bcn->ac = 4; >+ bcn->size = sizeof(struct wpi_cmd_beacon); > >- cmd->id = WPI_ID_BROADCAST; >- cmd->ofdm_mask = 0xff; >- cmd->cck_mask = 0x0f; >- cmd->lifetime = htole32(WPI_LIFETIME_INFINITE); >- cmd->flags = htole32(WPI_TX_AUTO_SEQ | WPI_TX_INSERT_TSTAMP); >- >- bcn->data = cmd; >- bcn->ni = NULL; >- bcn->code = WPI_CMD_SET_BEACON; >- bcn->ac = 4; >- bcn->size = sizeof(struct wpi_cmd_beacon); >- } else >- cmd = bcn->data; >- > cmd->len = htole16(totlen); > cmd->plcp = (ic->ic_curmode == IEEE80211_MODE_11A) ? > wpi_ridx_to_plcp[WPI_RIDX_OFDM6] : wpi_ridx_to_plcp[WPI_RIDX_CCK1]; >Index: sys/dev/wpi/if_wpivar.h >=================================================================== >--- sys/dev/wpi/if_wpivar.h (revision 279775) >+++ sys/dev/wpi/if_wpivar.h (working copy) >@@ -112,7 +112,7 @@ > }; > > struct wpi_buf { >- void *data; >+ uint8_t data[56]; /* sizeof(struct wpi_cmd_beacon) */ > struct ieee80211_node *ni; > struct mbuf *m; > size_t size;
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