Use uint8_t pointers for TX/RX buffers to avoid extra pointer casts.

This commit is contained in:
tsutsui 2009-09-18 14:09:42 +00:00
parent d7e3eba588
commit 01a44458f7
4 changed files with 19 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: be.c,v 1.70 2009/09/18 14:00:44 tsutsui Exp $ */
/* $NetBSD: be.c,v 1.71 2009/09/18 14:09:42 tsutsui Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.70 2009/09/18 14:00:44 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: be.c,v 1.71 2009/09/18 14:09:42 tsutsui Exp $");
#include "opt_ddb.h"
#include "opt_inet.h"
@ -483,7 +483,7 @@ be_put(struct be_softc *sc, int idx, struct mbuf *m)
int len, tlen = 0, boff = 0;
void *bp;
bp = (char *)sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * BE_PKT_BUF_SZ;
bp = sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * BE_PKT_BUF_SZ;
for (; m; m = n) {
len = m->m_len;
@ -514,7 +514,7 @@ be_get(struct be_softc *sc, int idx, int totlen)
int len, pad, boff = 0;
void *bp;
bp = (char *)sc->sc_rb.rb_rxbuf + (idx % sc->sc_rb.rb_nrbuf) * BE_PKT_BUF_SZ;
bp = sc->sc_rb.rb_rxbuf + (idx % sc->sc_rb.rb_nrbuf) * BE_PKT_BUF_SZ;
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: qe.c,v 1.53 2009/09/18 12:23:16 tsutsui Exp $ */
/* $NetBSD: qe.c,v 1.54 2009/09/18 14:09:42 tsutsui Exp $ */
/*-
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.53 2009/09/18 12:23:16 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: qe.c,v 1.54 2009/09/18 14:09:42 tsutsui Exp $");
#define QEDEBUG
@ -334,7 +334,7 @@ qe_get(struct qe_softc *sc, int idx, int totlen)
int len, pad, boff = 0;
void *bp;
bp = (char *)sc->sc_rb.rb_rxbuf + (idx % sc->sc_rb.rb_nrbuf) * QE_PKT_BUF_SZ;
bp = sc->sc_rb.rb_rxbuf + (idx % sc->sc_rb.rb_nrbuf) * QE_PKT_BUF_SZ;
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL)
@ -383,7 +383,7 @@ qe_put(struct qe_softc *sc, int idx, struct mbuf *m)
int len, tlen = 0, boff = 0;
void *bp;
bp = (char *)sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * QE_PKT_BUF_SZ;
bp = sc->sc_rb.rb_txbuf + (idx % sc->sc_rb.rb_ntbuf) * QE_PKT_BUF_SZ;
for (; m; m = n) {
len = m->m_len;

View File

@ -1,4 +1,4 @@
/* $NetBSD: qec.c,v 1.47 2009/09/18 12:59:47 tsutsui Exp $ */
/* $NetBSD: qec.c,v 1.48 2009/09/18 14:09:42 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: qec.c,v 1.47 2009/09/18 12:59:47 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: qec.c,v 1.48 2009/09/18 14:09:42 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -300,10 +300,10 @@ qec_meminit(struct qec_ring *qr, unsigned int pktbufsz)
{
bus_addr_t txbufdma, rxbufdma;
bus_addr_t dma;
void *p;
uint8_t *p;
unsigned int ntbuf, nrbuf, i;
p = qr->rb_membase;
p = qr->rb_membase;
dma = qr->rb_dmabase;
ntbuf = qr->rb_ntbuf;
@ -314,7 +314,7 @@ qec_meminit(struct qec_ring *qr, unsigned int pktbufsz)
*/
qr->rb_txd = (struct qec_xd *)p;
qr->rb_txddma = dma;
p = (char *)p + QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd);
p += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd);
dma += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd);
/*
@ -322,7 +322,7 @@ qec_meminit(struct qec_ring *qr, unsigned int pktbufsz)
*/
qr->rb_rxd = (struct qec_xd *)p;
qr->rb_rxddma = dma;
p = (char *)p + QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd);
p += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd);
dma += QEC_XD_RING_MAXSIZE * sizeof(struct qec_xd);
@ -331,7 +331,7 @@ qec_meminit(struct qec_ring *qr, unsigned int pktbufsz)
*/
qr->rb_txbuf = p;
txbufdma = dma;
p = (char *)p + ntbuf * pktbufsz;
p += ntbuf * pktbufsz;
dma += ntbuf * pktbufsz;
/*
@ -339,7 +339,7 @@ qec_meminit(struct qec_ring *qr, unsigned int pktbufsz)
*/
qr->rb_rxbuf = p;
rxbufdma = dma;
p = (char *)p + nrbuf * pktbufsz;
p += nrbuf * pktbufsz;
dma += nrbuf * pktbufsz;
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: qecvar.h,v 1.12 2009/09/17 16:28:12 tsutsui Exp $ */
/* $NetBSD: qecvar.h,v 1.13 2009/09/18 14:09:42 tsutsui Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -53,8 +53,8 @@ struct qec_ring {
bus_addr_t rb_txddma; /* DMA address of same */
struct qec_xd *rb_rxd; /* Receive descriptors */
bus_addr_t rb_rxddma; /* DMA address of same */
void * rb_txbuf; /* Transmit buffers */
void * rb_rxbuf; /* Receive buffers */
uint8_t *rb_txbuf; /* Transmit buffers */
uint8_t *rb_rxbuf; /* Receive buffers */
int rb_ntbuf; /* # of transmit buffers */
int rb_nrbuf; /* # of receive buffers */