diff options
author | 2007-05-26 18:11:42 +0000 | |
---|---|---|
committer | 2007-05-26 18:11:42 +0000 | |
commit | bba1f7db9a5ec0751f579ab90ebfda55dd78b4a2 (patch) | |
tree | e31ed59be8df686b7ad37c2c62935335187b4a5e | |
parent | Initial man page for che(4) (diff) | |
download | wireguard-openbsd-bba1f7db9a5ec0751f579ab90ebfda55dd78b4a2.tar.xz wireguard-openbsd-bba1f7db9a5ec0751f579ab90ebfda55dd78b4a2.zip |
tx descriptor fixes
-rw-r--r-- | sys/dev/pci/if_nx.c | 17 | ||||
-rw-r--r-- | sys/dev/pci/if_nxreg.h | 6 |
2 files changed, 12 insertions, 11 deletions
diff --git a/sys/dev/pci/if_nx.c b/sys/dev/pci/if_nx.c index c34a29541a2..fe76ae6bd2d 100644 --- a/sys/dev/pci/if_nx.c +++ b/sys/dev/pci/if_nx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nx.c,v 1.47 2007/05/26 17:13:30 jason Exp $ */ +/* $OpenBSD: if_nx.c,v 1.48 2007/05/26 18:11:42 reyk Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org> @@ -1620,8 +1620,8 @@ nx_start(struct ifnet *ifp) struct nx_buf *nb; struct nx_txdesc *txd; bus_dmamap_t map; - u_int64_t port = nxp->nxp_id; - u_int32_t producer, len; + u_int64_t port = nxp->nxp_id, nsegs, len; + u_int32_t producer; u_int i, idx, tx = 0; if ((ifp->if_flags & IFF_RUNNING) == 0|| @@ -1686,8 +1686,9 @@ nx_start(struct ifnet *ifp) #endif len = 0; + nsegs = map->dm_nsegs; txd->tx_buflength = 0; - for (i = 0; i < map->dm_nsegs; i++) { + for (i = 0; i < nsegs; i++) { len += map->dm_segs[i].ds_len; switch (i) { case 0: @@ -1718,15 +1719,15 @@ nx_start(struct ifnet *ifp) } txd->tx_word0 = ((NX_TXDESC0_OP_TX << NX_TXDESC0_OP_S) & NX_TXDESC0_OP_M) | - ((map->dm_nsegs << NX_TXDESC0_NBUF_S) & NX_TXDESC0_NBUF_M) | + ((nsegs << NX_TXDESC0_NBUF_S) & NX_TXDESC0_NBUF_M) | ((len << NX_TXDESC0_LENGTH_S) & NX_TXDESC0_LENGTH_M); txd->tx_word2 = ((idx << NX_TXDESC2_HANDLE_S) & NX_TXDESC2_HANDLE_M) | ((port << NX_TXDESC2_PORT_S) & NX_TXDESC2_PORT_M) | ((port << NX_TXDESC2_CTXID_S) & NX_TXDESC2_CTXID_M); - DPRINTF(NXDBG_TX, "%s(%s): txd w0:%016x w2:%016x " - "a1:%016x a2:%016x a3:%016x a4:%016x len:%016x\n", + DPRINTF(NXDBG_TX, "%s(%s): txd w0:%016llx w2:%016llx " + "a1:%016llx a2:%016llx a3:%016llx a4:%016llx len:%016llx\n", DEVNAME(nx), __func__, txd->tx_word0, txd->tx_word2, txd->tx_addr1, txd->tx_addr2, txd->tx_addr3, txd->tx_addr4, txd->tx_buflength); @@ -2071,7 +2072,7 @@ nx_init_rings(struct nx_softc *nx) /* Tx buffers */ for (i = 0; i < NX_MAX_TX_DESC; i++) { nb = &rd->rd_txbuf[i]; - if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1, + if (bus_dmamap_create(sc->sc_dmat, MCLBYTES, 4, MCLBYTES, 0, BUS_DMA_NOWAIT, &nb->nb_dmamap) != 0) { printf("%s: unable to create dmamap for tx %d\n", DEVNAME(nx), i); diff --git a/sys/dev/pci/if_nxreg.h b/sys/dev/pci/if_nxreg.h index b61a601f6b1..2a9997ab05b 100644 --- a/sys/dev/pci/if_nxreg.h +++ b/sys/dev/pci/if_nxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_nxreg.h,v 1.26 2007/05/26 01:10:52 reyk Exp $ */ +/* $OpenBSD: if_nxreg.h,v 1.27 2007/05/26 18:11:42 reyk Exp $ */ /* * Copyright (c) 2007 Reyk Floeter <reyk@openbsd.org> @@ -90,9 +90,9 @@ struct nx_txdesc { #define NX_TXDESC0_OP_TX (1<<0) /* raw Ethernet packet */ #define NX_TXDESC0_RES0_S 29 /* Reserved */ #define NX_TXDESC0_RES0_M 0x00000000e0000000ULL -#define NX_TXDESC0_NBUF_S 0 /* number of buffers */ +#define NX_TXDESC0_NBUF_S 32 /* number of buffers */ #define NX_TXDESC0_NBUF_M 0x000000ff00000000ULL -#define NX_TXDESC0_LENGTH_S 8 /* length */ +#define NX_TXDESC0_LENGTH_S 40 /* length */ #define NX_TXDESC0_LENGTH_M 0xffffff0000000000ULL u_int64_t tx_addr2; /* address of buffer 2 */ u_int64_t tx_word2; |