summaryrefslogtreecommitdiffstats
path: root/sys/dev/hme/if_hmevar.h
diff options
context:
space:
mode:
authormarius <marius@FreeBSD.org>2008-04-24 23:12:03 +0000
committermarius <marius@FreeBSD.org>2008-04-24 23:12:03 +0000
commit3cd35a205135ce8a15349a035286650c3452cafd (patch)
tree53ea4245317386a46ac689fac9db6c8187c8f03c /sys/dev/hme/if_hmevar.h
parent986c42e575c1d83ac001deb087007faacc0a1438 (diff)
downloadFreeBSD-src-3cd35a205135ce8a15349a035286650c3452cafd.zip
FreeBSD-src-3cd35a205135ce8a15349a035286650c3452cafd.tar.gz
o Disable HMEDEBUG by default.
o Add CTASSERTs ensuring that HME_NRXDESC and HME_NTXDESC are set to legal values. o Use appropriate maxsize, nsegments and maxsegsize parameters when creating DMA tags and correct some comments related to them. o The FreeBSD bus_dmamap_sync(9) supports ored together flags for quite some time now so collapse calls accordingly. o Add missing BUS_DMASYNC_PREREAD when syncing the control DMA maps in hme_rint() and hme_start_locked(). o Keep state of the link state and use it to enable or disable the MAC in hme_mii_statchg() accordingly as well as to return early from hme_start_locked() in case the link is down. o Introduce a sc_flags and use it to replace individual members like sc_pci. o Add bus_barrier(9) calls to hme_mac_bitflip(), hme_mii_readreg(), hme_mii_writereg() and hme_stop() to ensure the respective bit has been written before we starting polling on it and for the right bits to change. o Rather just returning in case hme_mac_bitflip() fails and leaving us in an undefined state report the problem and move on; chances are the requested configuration will become active shortly after. o Don't call hme_start_locked() in hme_init_locked() unconditionally but only after calls to hme_init_locked() when it's appropriate, i.e. in hme_watchdog(). o Add a KASSERT which asserts nsegs is valid also to hme_load_txmbuf(). o In hme_load_txmbuf(): - use a maximum of the newly introduced HME_NTXSEGS segments instead of the incorrect HME_NTXQ, which reflects the maximum TX queue length, for loading the mbufs and put the DMA segments back onto the stack instead of the softc as 16 should be ok there. - use the common errno(2) return values instead of homegrown ones, - given that hme_load_txmbuf() is allowed to fail resulting in a packet drop for quite some time now implement the functionality of hme_txcksum() by means of m_pullup(9), which de-obfuscates the code and allows to always retrieve the correct length of the IP header, [1] - also add a KASSERT which asserts nsegs is valid, - take advantage of m_collapse(9) instead of m_defrag(9) for performance reasons. o Don't bother to check whether the interface is running or whether its queue is empty before calling hme_start_locked() in hme_tint(), the former will check these anyway. o In hme_intr() call hme_rint() before hme_tint() as gem_tint() may take quite a while to return when it calls hme_start_locked(). o Get rid of sc_debug and just check if_flags for IFF_DEBUG directly. o Add a shadow sc_ifflags so we don't reset the chip when unnecessary. o Handle IFF_ALLMULTI correctly. [2] o Use PCIR_BAR instead of a homegrown macro. o Replace sc_enaddr[6] with sc_enaddr[ETHER_ADDR_LEN]. o Use the maximum of 256 TX descriptors for better performance as using all of them has no additional static cost rather than using just half of them. Reported by: rwatson [2] Suggested by: yongari [1] Reviewed by: yongari MFC after: 1 month
Diffstat (limited to 'sys/dev/hme/if_hmevar.h')
-rw-r--r--sys/dev/hme/if_hmevar.h22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/dev/hme/if_hmevar.h b/sys/dev/hme/if_hmevar.h
index 70c9d78..d49e675 100644
--- a/sys/dev/hme/if_hmevar.h
+++ b/sys/dev/hme/if_hmevar.h
@@ -49,11 +49,12 @@
* for them. TX queue elements (the number of which is fixed by HME_NTXQ) hold
* the software state for a transmit job; each has a dmamap allocated for it.
* There may be multiple descriptors allocated to a single queue element.
- * HME_NTXQ is completely arbitrary.
+ * HME_NTXQ and HME_NTXSEGS are completely arbitrary.
*/
-#define HME_NRXDESC 128
-#define HME_NTXDESC 128
-#define HME_NTXQ (HME_NTXDESC / 2)
+#define HME_NRXDESC 128
+#define HME_NTXDESC 256
+#define HME_NTXQ 64
+#define HME_NTXSEGS 16
/* Maximum size of a mapped RX buffer. */
#define HME_BUFSZ 1600
@@ -80,9 +81,6 @@ struct hme_txdesc {
STAILQ_HEAD(hme_txdq, hme_txdesc);
-/* Value for htx_flags */
-#define HTXF_MAPPED 1
-
struct hme_ring {
/* Ring Descriptors */
caddr_t rb_membase; /* Packet buffer: CPU address */
@@ -100,7 +98,6 @@ struct hme_ring {
/* Descriptors */
struct hme_rxdesc rb_rxdesc[HME_NRXDESC];
struct hme_txdesc rb_txdesc[HME_NTXQ];
- bus_dma_segment_t rb_txsegs[HME_NTXQ];
struct hme_txdq rb_txfreeq;
struct hme_txdq rb_txbusyq;
@@ -114,7 +111,7 @@ struct hme_softc {
device_t sc_dev;
device_t sc_miibus;
struct mii_data *sc_mii; /* MII media control */
- u_char sc_enaddr[6];
+ u_char sc_enaddr[ETHER_ADDR_LEN];
struct callout sc_tick_ch; /* tick callout */
int sc_wdog_timer; /* watchdog timer */
@@ -137,13 +134,16 @@ struct hme_softc {
int sc_burst; /* DVMA burst size in effect */
int sc_phys[2]; /* MII instance -> PHY map */
- int sc_pci; /* XXXXX -- PCI buses are LE. */
+ u_int sc_flags;
+#define HME_LINK (1 << 0) /* link is up */
+#define HME_PCI (1 << 1) /* PCI busses are little-endian */
+
+ int sc_ifflags;
int sc_csum_features;
/* Ring descriptor */
struct hme_ring sc_rb;
- int sc_debug;
struct mtx sc_lock;
};
OpenPOWER on IntegriCloud