mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-05-13 16:10:38 +08:00
rtwn_usb: Make sure buffers are cache aligned
This commit is contained in:
parent
4820ccecc9
commit
36b588eb8b
@ -37,6 +37,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/endian.h>
|
#include <sys/endian.h>
|
||||||
#include <sys/linker.h>
|
#include <sys/linker.h>
|
||||||
#include <sys/kdb.h>
|
#include <sys/kdb.h>
|
||||||
|
#ifdef __rtems__
|
||||||
|
#include <machine/rtems-bsd-cache.h>
|
||||||
|
#include <rtems/malloc.h>
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
#include <net/if_var.h>
|
#include <net/if_var.h>
|
||||||
@ -115,7 +119,14 @@ rtwn_usb_alloc_list(struct rtwn_softc *sc, struct rtwn_data data[],
|
|||||||
for (i = 0; i < ndata; i++) {
|
for (i = 0; i < ndata; i++) {
|
||||||
struct rtwn_data *dp = &data[i];
|
struct rtwn_data *dp = &data[i];
|
||||||
dp->m = NULL;
|
dp->m = NULL;
|
||||||
|
#if defined(__rtems__) && defined(CPU_DATA_CACHE_ALIGNMENT)
|
||||||
|
maxsz = maxsz + (CPU_DATA_CACHE_ALIGNMENT - 1) &
|
||||||
|
~(CPU_DATA_CACHE_ALIGNMENT - 1);
|
||||||
|
dp->buf = rtems_heap_allocate_aligned_with_boundary(maxsz,
|
||||||
|
CPU_DATA_CACHE_ALIGNMENT, 0);
|
||||||
|
#else /* __rtems__ */
|
||||||
dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
|
dp->buf = malloc(maxsz, M_USBDEV, M_NOWAIT);
|
||||||
|
#endif /* __rtems__ */
|
||||||
if (dp->buf == NULL) {
|
if (dp->buf == NULL) {
|
||||||
device_printf(sc->sc_dev,
|
device_printf(sc->sc_dev,
|
||||||
"could not allocate buffer\n");
|
"could not allocate buffer\n");
|
||||||
|
@ -64,6 +64,10 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <dev/rtwn/usb/rtwn_usb_reg.h>
|
#include <dev/rtwn/usb/rtwn_usb_reg.h>
|
||||||
#include <dev/rtwn/usb/rtwn_usb_tx.h>
|
#include <dev/rtwn/usb/rtwn_usb_tx.h>
|
||||||
|
|
||||||
|
#ifdef __rtems__
|
||||||
|
#include <machine/rtems-bsd-cache.h>
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
static struct rtwn_data * _rtwn_usb_getbuf(struct rtwn_usb_softc *);
|
static struct rtwn_data * _rtwn_usb_getbuf(struct rtwn_usb_softc *);
|
||||||
static struct rtwn_data * rtwn_usb_getbuf(struct rtwn_usb_softc *);
|
static struct rtwn_data * rtwn_usb_getbuf(struct rtwn_usb_softc *);
|
||||||
static void rtwn_usb_txeof(struct rtwn_usb_softc *,
|
static void rtwn_usb_txeof(struct rtwn_usb_softc *,
|
||||||
@ -170,6 +174,9 @@ tr_setup:
|
|||||||
if (data->ni == NULL && RTWN_CHIP_HAS_BCNQ1(sc))
|
if (data->ni == NULL && RTWN_CHIP_HAS_BCNQ1(sc))
|
||||||
rtwn_switch_bcnq(sc, data->id);
|
rtwn_switch_bcnq(sc, data->id);
|
||||||
usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen);
|
usbd_xfer_set_frame_data(xfer, 0, data->buf, data->buflen);
|
||||||
|
#if defined(__rtems__) && defined(CPU_DATA_CACHE_ALIGNMENT)
|
||||||
|
usbd_xfer_frame_allow_cache_line_blow_up(xfer, 0);
|
||||||
|
#endif /* __rtems__ */
|
||||||
usbd_transfer_submit(xfer);
|
usbd_transfer_submit(xfer);
|
||||||
if (sc->sc_ratectl != RTWN_RATECTL_NET80211)
|
if (sc->sc_ratectl != RTWN_RATECTL_NET80211)
|
||||||
sc->sc_tx_n_active++;
|
sc->sc_tx_n_active++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user