diff options
author | 2016-11-16 01:27:45 +0000 | |
---|---|---|
committer | 2016-11-16 01:27:45 +0000 | |
commit | 12f8f327cb40bc1dc6649b75dd79a7dfff883bec (patch) | |
tree | 52337ad97bfae83a9d58be2eb7807a7557c2594f | |
parent | serialise posts to the txstart register. (diff) | |
download | wireguard-openbsd-12f8f327cb40bc1dc6649b75dd79a7dfff883bec.tar.xz wireguard-openbsd-12f8f327cb40bc1dc6649b75dd79a7dfff883bec.zip |
move toward having the a tx packet descriptor per tx ring entry.
previously you could have 64 packets on a ring with up to 1024
descriptors. this mismatch makes the accounting for free space
complicated and allows for a data race with OACTIVE being set.
it will also let us push more packets.
-rw-r--r-- | sys/dev/ic/re.c | 12 | ||||
-rw-r--r-- | sys/dev/ic/rtl81x9reg.h | 5 |
2 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 92e674ec2f4..5103c053e83 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.194 2016/11/16 01:15:37 dlg Exp $ */ +/* $OpenBSD: re.c,v 1.195 2016/11/16 01:27:45 dlg Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -659,7 +659,6 @@ re_attach(struct rl_softc *sc, const char *intrstr) int error = 0, i; const struct re_revision *rr; const char *re_name = NULL; - int ntxsegs; sc->sc_hwrev = CSR_READ_4(sc, RL_TXCFG) & RL_TXCFG_HWREV; @@ -877,13 +876,13 @@ re_attach(struct rl_softc *sc, const char *intrstr) sc->rl_txstart = RL_TXSTART; sc->rl_ldata.rl_tx_desc_cnt = RL_8139_TX_DESC_CNT; sc->rl_ldata.rl_rx_desc_cnt = RL_8139_RX_DESC_CNT; - ntxsegs = RL_8139_NTXSEGS; + sc->rl_ldata.rl_tx_ndescs = RL_8139_NTXSEGS; } else { sc->rl_rxlenmask = RL_RDESC_STAT_GFRAGLEN; sc->rl_txstart = RL_GTXSTART; sc->rl_ldata.rl_tx_desc_cnt = RL_8169_TX_DESC_CNT; sc->rl_ldata.rl_rx_desc_cnt = RL_8169_RX_DESC_CNT; - ntxsegs = RL_8169_NTXSEGS; + sc->rl_ldata.rl_tx_ndescs = RL_8169_NTXSEGS; } bcopy(eaddr, (char *)&sc->sc_arpcom.ac_enaddr, ETHER_ADDR_LEN); @@ -946,8 +945,9 @@ re_attach(struct rl_softc *sc, const char *intrstr) /* Create DMA maps for TX buffers */ for (i = 0; i < RL_TX_QLEN; i++) { error = bus_dmamap_create(sc->sc_dmat, - RL_JUMBO_FRAMELEN, ntxsegs, RL_JUMBO_FRAMELEN, - 0, 0, &sc->rl_ldata.rl_txq[i].txq_dmamap); + RL_JUMBO_FRAMELEN, sc->rl_ldata.rl_tx_ndescs, + RL_JUMBO_FRAMELEN, 0, 0, + &sc->rl_ldata.rl_txq[i].txq_dmamap); if (error) { printf("%s: can't create DMA map for TX\n", sc->sc_dev.dv_xname); diff --git a/sys/dev/ic/rtl81x9reg.h b/sys/dev/ic/rtl81x9reg.h index d7cd063003e..8fc4a9a851d 100644 --- a/sys/dev/ic/rtl81x9reg.h +++ b/sys/dev/ic/rtl81x9reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9reg.h,v 1.99 2016/11/16 01:15:37 dlg Exp $ */ +/* $OpenBSD: rtl81x9reg.h,v 1.100 2016/11/16 01:27:45 dlg Exp $ */ /* * Copyright (c) 1997, 1998 @@ -833,7 +833,7 @@ struct rl_txq { }; struct rl_list_data { - struct rl_txq rl_txq[RL_TX_QLEN]; + struct rl_txq rl_txq[RL_TX_DESC_CNT]; int rl_txq_considx; int rl_txq_prodidx; @@ -842,6 +842,7 @@ struct rl_list_data { int rl_tx_free; /* # of free descriptors */ int rl_tx_nextfree; /* next descriptor to use */ int rl_tx_desc_cnt; /* # of descriptors */ + int rl_tx_ndescs; /* descs per tx packet */ bus_dma_segment_t rl_tx_listseg; int rl_tx_listnseg; |