From fc0fe76a279f1655aeefd27710f02458018af0ec Mon Sep 17 00:00:00 2001 From: phk Date: Sun, 22 Apr 2007 14:57:05 +0000 Subject: Don't rename fields with #define. Collapse two semantically identical structs. Add missing vr_ prefix. --- sys/pci/if_vr.c | 28 ++++++++++++++-------------- sys/pci/if_vrreg.h | 17 ++++------------- 2 files changed, 18 insertions(+), 27 deletions(-) (limited to 'sys/pci') diff --git a/sys/pci/if_vr.c b/sys/pci/if_vr.c index 1d0cc0e..688f3b1 100644 --- a/sys/pci/if_vr.c +++ b/sys/pci/if_vr.c @@ -147,7 +147,7 @@ struct vr_softc { struct vr_chain_data vr_cdata; struct callout vr_stat_callout; struct mtx vr_mtx; - int suspended; /* if 1, sleeping/detaching */ + int vr_suspended; /* if 1, sleeping/detaching */ int vr_quirks; #ifdef DEVICE_POLLING int rxcycles; @@ -158,7 +158,7 @@ static int vr_probe(device_t); static int vr_attach(device_t); static int vr_detach(device_t); -static int vr_newbuf(struct vr_chain_onefrag *, struct mbuf *); +static int vr_newbuf(struct vr_chain *, struct mbuf *); static void vr_rxeof(struct vr_softc *); static void vr_rxeoc(struct vr_softc *); @@ -786,7 +786,7 @@ vr_attach(device_t dev) /* Call MI attach routine. */ ether_ifattach(ifp, eaddr); - sc->suspended = 0; + sc->vr_suspended = 0; /* Hook interrupt last to avoid having to lock softc */ error = bus_setup_intr(dev, sc->vr_irq, INTR_TYPE_NET | INTR_MPSAFE, @@ -828,7 +828,7 @@ vr_detach(device_t dev) /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { VR_LOCK(sc); - sc->suspended = 1; + sc->vr_suspended = 1; vr_stop(sc); VR_UNLOCK(sc); callout_drain(&sc->vr_stat_callout); @@ -901,19 +901,18 @@ vr_list_rx_init(struct vr_softc *sc) ld = sc->vr_ldata; for (i = 0; i < VR_RX_LIST_CNT; i++) { - cd->vr_rx_chain[i].vr_ptr = - (struct vr_desc *)&ld->vr_rx_list[i]; + cd->vr_rx_chain[i].vr_ptr = &ld->vr_rx_list[i]; if (vr_newbuf(&cd->vr_rx_chain[i], NULL) == ENOBUFS) return (ENOBUFS); if (i == (VR_RX_LIST_CNT - 1)) { cd->vr_rx_chain[i].vr_nextdesc = &cd->vr_rx_chain[0]; - ld->vr_rx_list[i].vr_next = + ld->vr_rx_list[i].vr_nextphys = vtophys(&ld->vr_rx_list[0]); } else { cd->vr_rx_chain[i].vr_nextdesc = &cd->vr_rx_chain[i + 1]; - ld->vr_rx_list[i].vr_next = + ld->vr_rx_list[i].vr_nextphys = vtophys(&ld->vr_rx_list[i + 1]); } } @@ -931,7 +930,7 @@ vr_list_rx_init(struct vr_softc *sc) * overflow the field and make a mess. */ static int -vr_newbuf(struct vr_chain_onefrag *c, struct mbuf *m) +vr_newbuf(struct vr_chain *c, struct mbuf *m) { struct mbuf *m_new = NULL; @@ -971,7 +970,7 @@ vr_rxeof(struct vr_softc *sc) { struct mbuf *m, *m0; struct ifnet *ifp; - struct vr_chain_onefrag *cur_rx; + struct vr_chain *cur_rx; int total_len = 0; uint32_t rxstat, rxctl; @@ -1265,7 +1264,7 @@ vr_intr(void *arg) VR_LOCK(sc); - if (sc->suspended) { + if (sc->vr_suspended) { /* * Forcibly disable interrupts. * XXX: Mobile VIA based platforms may need @@ -1448,9 +1447,10 @@ vr_start_locked(struct ifnet *ifp) f->vr_ctl = cval; f->vr_status = 0; n_tx = n_tx->vr_nextdesc; - f->vr_next = vtophys(n_tx->vr_ptr); - KASSERT(!(f->vr_next & 0xf), - ("vr_next not 16 byte aligned 0x%x", f->vr_next)); + f->vr_nextphys = vtophys(n_tx->vr_ptr); + KASSERT(!(f->vr_nextphys & 0xf), + ("vr_nextphys not 16 byte aligned 0x%x", + f->vr_nextphys)); } KASSERT(f != NULL, ("if_vr: no packet processed")); diff --git a/sys/pci/if_vrreg.h b/sys/pci/if_vrreg.h index 918de48..944b5cb 100644 --- a/sys/pci/if_vrreg.h +++ b/sys/pci/if_vrreg.h @@ -330,13 +330,10 @@ struct vr_desc { u_int32_t vr_status; u_int32_t vr_ctl; - u_int32_t vr_ptr1; - u_int32_t vr_ptr2; + u_int32_t vr_data; + u_int32_t vr_nextphys; }; -#define vr_data vr_ptr1 -#define vr_next vr_ptr2 - #define VR_RXSTAT_RXERR 0x00000001 #define VR_RXSTAT_CRCERR 0x00000002 @@ -415,17 +412,11 @@ struct vr_chain { struct vr_chain *vr_nextdesc; }; -struct vr_chain_onefrag { - struct vr_desc *vr_ptr; - struct mbuf *vr_mbuf; - struct vr_chain_onefrag *vr_nextdesc; -}; - struct vr_chain_data { - struct vr_chain_onefrag vr_rx_chain[VR_RX_LIST_CNT]; + struct vr_chain vr_rx_chain[VR_RX_LIST_CNT]; struct vr_chain vr_tx_chain[VR_TX_LIST_CNT]; - struct vr_chain_onefrag *vr_rx_head; + struct vr_chain *vr_rx_head; struct vr_chain *vr_tx_cons; struct vr_chain *vr_tx_prod; -- cgit v1.1