summaryrefslogtreecommitdiffstats
path: root/sys/dev/cxgb
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2008-11-23 07:30:07 +0000
committerkmacy <kmacy@FreeBSD.org>2008-11-23 07:30:07 +0000
commit70a61d9b8a30f8ae702fc97e2d7668c9d7df305f (patch)
treef023dbbf2790a1bd99de5c3a0d1ea7b68f71c49e /sys/dev/cxgb
parent34152f170baa29ac7695b220d7ee77e30eb1997f (diff)
downloadFreeBSD-src-70a61d9b8a30f8ae702fc97e2d7668c9d7df305f.zip
FreeBSD-src-70a61d9b8a30f8ae702fc97e2d7668c9d7df305f.tar.gz
Add backward compatibility ifdefs for non-multiq kernels
Diffstat (limited to 'sys/dev/cxgb')
-rw-r--r--sys/dev/cxgb/cxgb_config.h4
-rw-r--r--sys/dev/cxgb/cxgb_main.c3
-rw-r--r--sys/dev/cxgb/cxgb_osdep.h24
3 files changed, 29 insertions, 2 deletions
diff --git a/sys/dev/cxgb/cxgb_config.h b/sys/dev/cxgb/cxgb_config.h
index 8b111f6..79af94c 100644
--- a/sys/dev/cxgb/cxgb_config.h
+++ b/sys/dev/cxgb/cxgb_config.h
@@ -33,6 +33,8 @@ $FreeBSD$
#define _CXGB_CONFIG_H_
#define CONFIG_CHELSIO_T3_CORE
-#define IFNET_MULTIQUEUE
+#if __FreeBSD_version > 800053
+#define IFNET_MULTIQUEUE
+#endif
#endif
diff --git a/sys/dev/cxgb/cxgb_main.c b/sys/dev/cxgb/cxgb_main.c
index 2a754ac..5199a60 100644
--- a/sys/dev/cxgb/cxgb_main.c
+++ b/sys/dev/cxgb/cxgb_main.c
@@ -946,8 +946,9 @@ cxgb_port_attach(device_t dev)
}
ether_ifattach(ifp, p->hw_addr);
-
+#ifdef IFNET_MULTIQUEUE
ifp->if_transmit = cxgb_pcpu_transmit;
+#endif
/*
* Only default to jumbo frames on 10GigE
*/
diff --git a/sys/dev/cxgb/cxgb_osdep.h b/sys/dev/cxgb/cxgb_osdep.h
index d0a7258..f03cb0d 100644
--- a/sys/dev/cxgb/cxgb_osdep.h
+++ b/sys/dev/cxgb/cxgb_osdep.h
@@ -117,6 +117,30 @@ struct t3_mbuf_hdr {
#define TOE_SUPPORTED
#endif
+#if __FreeBSD_version < 800054
+#if defined (__GNUC__)
+ #if #cpu(i386) || defined __i386 || defined i386 || defined __i386__ || #cpu(x86_64) || defined __x86_64__
+ #define mb() __asm__ __volatile__ ("mfence;": : :"memory")
+ #define wmb() __asm__ __volatile__ ("sfence;": : :"memory")
+ #define rmb() __asm__ __volatile__ ("lfence;": : :"memory")
+ #elif #cpu(sparc64) || defined sparc64 || defined __sparcv9
+ #define mb() __asm__ __volatile__ ("membar #MemIssue": : :"memory")
+ #define wmb() mb()
+ #define rmb() mb()
+ #elif #cpu(sparc) || defined sparc || defined __sparc__
+ #define mb() __asm__ __volatile__ ("stbar;": : :"memory")
+ #define wmb() mb()
+ #define rmb() mb()
+#else
+ #define wmb() mb()
+ #define rmb() mb()
+ #define mb() /* XXX just to make this compile */
+ #endif
+#else
+ #error "unknown compiler"
+#endif
+#endif
+
#define __read_mostly __attribute__((__section__(".data.read_mostly")))
/*
OpenPOWER on IntegriCloud