diff options
author | Brad Smith <brad@cvs.openbsd.org> | 2006-11-24 04:27:18 +0000 |
---|---|---|
committer | Brad Smith <brad@cvs.openbsd.org> | 2006-11-24 04:27:18 +0000 |
commit | ad0d6f5adecd7ce94b4de18105811deade80da81 (patch) | |
tree | 9a8a1f75fbd27f25e8bfa72aab1ec5b827079dd2 /sys | |
parent | 2c91dcd27f0e92b8ba5e95f59629303593de23c7 (diff) |
replace a magic number (reserved TX descs?) with macro
From tsutsui@NetBSD
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/ic/re.c | 11 | ||||
-rw-r--r-- | sys/dev/ic/rtl81x9reg.h | 4 |
2 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index e28edcbc429..ca9880ae424 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.53 2006/11/18 15:54:29 brad Exp $ */ +/* $OpenBSD: re.c,v 1.54 2006/11/24 04:27:17 brad Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -869,9 +869,8 @@ re_attach(struct rl_softc *sc) for (i = 0; i < RL_TX_QLEN; i++) { error = bus_dmamap_create(sc->sc_dmat, RL_JUMBO_FRAMELEN, - RL_TX_DESC_CNT(sc) - 4, RL_TDESC_CMD_FRAGLEN, - 0, 0, - &sc->rl_ldata.rl_txq[i].txq_dmamap); + RL_TX_DESC_CNT(sc) - RL_NTXDESC_RSVD, RL_TDESC_CMD_FRAGLEN, + 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); @@ -1503,7 +1502,7 @@ re_encap(struct rl_softc *sc, struct mbuf *m, int *idx) u_int32_t cmdstat, rl_flags = 0; struct rl_txq *txq; - if (sc->rl_ldata.rl_tx_free <= 4) + if (sc->rl_ldata.rl_tx_free <= RL_NTXDESC_RSVD) return (EFBIG); #ifdef RE_CSUM_OFFLOAD @@ -1541,7 +1540,7 @@ re_encap(struct rl_softc *sc, struct mbuf *m, int *idx) return (error); } - if (map->dm_nsegs > sc->rl_ldata.rl_tx_free - 4) { + if (map->dm_nsegs > sc->rl_ldata.rl_tx_free - RL_NTXDESC_RSVD) { error = EFBIG; goto fail_unload; } diff --git a/sys/dev/ic/rtl81x9reg.h b/sys/dev/ic/rtl81x9reg.h index 6653ec463e6..9c9390b91cc 100644 --- a/sys/dev/ic/rtl81x9reg.h +++ b/sys/dev/ic/rtl81x9reg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rtl81x9reg.h,v 1.32 2006/11/18 15:54:29 brad Exp $ */ +/* $OpenBSD: rtl81x9reg.h,v 1.33 2006/11/24 04:27:17 brad Exp $ */ /* * Copyright (c) 1997, 1998 @@ -587,6 +587,8 @@ struct rl_stats { #define RL_TX_QLEN 64 +#define RL_NTXDESC_RSVD 4 + #define RL_RX_LIST_SZ (RL_RX_DESC_CNT * sizeof(struct rl_desc)) #define RL_RING_ALIGN 256 #define RL_PKTSZ(x) ((x)/* >> 3*/) |