svn commit: r222383 - stable/7/sys/pci
Pyun YongHyeon
yongari at FreeBSD.org
Fri May 27 20:22:20 UTC 2011
Author: yongari
Date: Fri May 27 20:22:19 2011
New Revision: 222383
URL: http://svn.freebsd.org/changeset/base/222383
Log:
MFC r221557-221558,221560-221561,221571:
r221557:
Remove unnecessary htole32/le32toh dance.
r221571:
Remove unneeded use of variable status.
r221558:
Set status word once instead of twice. For 3C90xB/3C90xC, frame
length of status word is ignored. While here move bus_dmamap_sync()
up where DMA map is loaded.
r221560:
Call bus_dmamap_sync() only after TX DPD update.
r221561:
Updating status word should be the last operation of UPD structure
renewal. Disable instruction reordering by adding volatile to
xl_list_onefrag structure.
Modified:
stable/7/sys/pci/if_xl.c
stable/7/sys/pci/if_xlreg.h
Directory Properties:
stable/7/sys/ (props changed)
stable/7/sys/cddl/contrib/opensolaris/ (props changed)
stable/7/sys/contrib/dev/acpica/ (props changed)
stable/7/sys/contrib/pf/ (props changed)
Modified: stable/7/sys/pci/if_xl.c
==============================================================================
--- stable/7/sys/pci/if_xl.c Fri May 27 20:21:12 2011 (r222382)
+++ stable/7/sys/pci/if_xl.c Fri May 27 20:22:19 2011 (r222383)
@@ -1909,8 +1909,8 @@ xl_newbuf(struct xl_softc *sc, struct xl
sc->xl_tmpmap = map;
c->xl_mbuf = m_new;
c->xl_ptr->xl_frag.xl_len = htole32(m_new->m_len | XL_LAST_FRAG);
- c->xl_ptr->xl_status = 0;
c->xl_ptr->xl_frag.xl_addr = htole32(segs->ds_addr);
+ c->xl_ptr->xl_status = 0;
bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREREAD);
return (0);
}
@@ -2505,6 +2505,7 @@ xl_encap(struct xl_softc *sc, struct xl_
*m_head = NULL;
return (EIO);
}
+ bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREWRITE);
total_len = 0;
for (i = 0; i < nseg; i++) {
@@ -2516,10 +2517,7 @@ xl_encap(struct xl_softc *sc, struct xl_
htole32(sc->xl_cdata.xl_tx_segs[i].ds_len);
total_len += sc->xl_cdata.xl_tx_segs[i].ds_len;
}
- c->xl_ptr->xl_frag[nseg - 1].xl_len =
- htole32(sc->xl_cdata.xl_tx_segs[nseg - 1].ds_len | XL_LAST_FRAG);
- c->xl_ptr->xl_status = htole32(total_len);
- c->xl_ptr->xl_next = 0;
+ c->xl_ptr->xl_frag[nseg - 1].xl_len |= htole32(XL_LAST_FRAG);
if (sc->xl_type == XL_TYPE_905B) {
status = XL_TXSTAT_RND_DEFEAT;
@@ -2534,11 +2532,12 @@ xl_encap(struct xl_softc *sc, struct xl_
status |= XL_TXSTAT_UDPCKSUM;
}
#endif
- c->xl_ptr->xl_status = htole32(status);
- }
+ } else
+ status = total_len;
+ c->xl_ptr->xl_status = htole32(status);
+ c->xl_ptr->xl_next = 0;
c->xl_mbuf = *m_head;
- bus_dmamap_sync(sc->xl_mtag, c->xl_map, BUS_DMASYNC_PREWRITE);
return (0);
}
@@ -2570,7 +2569,6 @@ xl_start_locked(struct ifnet *ifp)
struct xl_softc *sc = ifp->if_softc;
struct mbuf *m_head = NULL;
struct xl_chain *prev = NULL, *cur_tx = NULL, *start_tx;
- u_int32_t status;
int error;
XL_LOCK_ASSERT(sc);
@@ -2642,10 +2640,7 @@ xl_start_locked(struct ifnet *ifp)
* get an interrupt once for the whole chain rather than
* once for each packet.
*/
- cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) |
- XL_TXSTAT_DL_INTR);
- bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
- BUS_DMASYNC_PREWRITE);
+ cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR);
/*
* Queue the packets. If the TX channel is clear, update
@@ -2658,14 +2653,15 @@ xl_start_locked(struct ifnet *ifp)
sc->xl_cdata.xl_tx_tail->xl_next = start_tx;
sc->xl_cdata.xl_tx_tail->xl_ptr->xl_next =
htole32(start_tx->xl_phys);
- status = sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status;
- sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status =
- htole32(le32toh(status) & ~XL_TXSTAT_DL_INTR);
+ sc->xl_cdata.xl_tx_tail->xl_ptr->xl_status &=
+ htole32(~XL_TXSTAT_DL_INTR);
sc->xl_cdata.xl_tx_tail = cur_tx;
} else {
sc->xl_cdata.xl_tx_head = start_tx;
sc->xl_cdata.xl_tx_tail = cur_tx;
}
+ bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
+ BUS_DMASYNC_PREWRITE);
if (!CSR_READ_4(sc, XL_DOWNLIST_PTR))
CSR_WRITE_4(sc, XL_DOWNLIST_PTR, start_tx->xl_phys);
@@ -2764,14 +2760,13 @@ xl_start_90xB_locked(struct ifnet *ifp)
* get an interrupt once for the whole chain rather than
* once for each packet.
*/
- cur_tx->xl_ptr->xl_status = htole32(le32toh(cur_tx->xl_ptr->xl_status) |
- XL_TXSTAT_DL_INTR);
- bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
- BUS_DMASYNC_PREWRITE);
+ cur_tx->xl_ptr->xl_status |= htole32(XL_TXSTAT_DL_INTR);
/* Start transmission */
sc->xl_cdata.xl_tx_prod = idx;
start_tx->xl_prev->xl_ptr->xl_next = htole32(start_tx->xl_phys);
+ bus_dmamap_sync(sc->xl_ldata.xl_tx_tag, sc->xl_ldata.xl_tx_dmamap,
+ BUS_DMASYNC_PREWRITE);
/*
* Set a timeout in case the chip goes out to lunch.
Modified: stable/7/sys/pci/if_xlreg.h
==============================================================================
--- stable/7/sys/pci/if_xlreg.h Fri May 27 20:21:12 2011 (r222382)
+++ stable/7/sys/pci/if_xlreg.h Fri May 27 20:22:19 2011 (r222383)
@@ -468,8 +468,8 @@ struct xl_list {
struct xl_list_onefrag {
u_int32_t xl_next; /* final entry has 0 nextptr */
- u_int32_t xl_status;
- struct xl_frag xl_frag;
+ volatile u_int32_t xl_status;
+ volatile struct xl_frag xl_frag;
};
struct xl_list_data {
More information about the svn-src-stable-7
mailing list