Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Nov 2008 07:30:08 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r185199 - head/sys/dev/cxgb
Message-ID:  <200811230730.mAN7U8fN043930@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Sun Nov 23 07:30:07 2008
New Revision: 185199
URL: http://svn.freebsd.org/changeset/base/185199

Log:
  Add backward compatibility ifdefs for non-multiq kernels

Modified:
  head/sys/dev/cxgb/cxgb_config.h
  head/sys/dev/cxgb/cxgb_main.c
  head/sys/dev/cxgb/cxgb_osdep.h

Modified: head/sys/dev/cxgb/cxgb_config.h
==============================================================================
--- head/sys/dev/cxgb/cxgb_config.h	Sun Nov 23 05:39:49 2008	(r185198)
+++ head/sys/dev/cxgb/cxgb_config.h	Sun Nov 23 07:30:07 2008	(r185199)
@@ -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

Modified: head/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- head/sys/dev/cxgb/cxgb_main.c	Sun Nov 23 05:39:49 2008	(r185198)
+++ head/sys/dev/cxgb/cxgb_main.c	Sun Nov 23 07:30:07 2008	(r185199)
@@ -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
 	 */

Modified: head/sys/dev/cxgb/cxgb_osdep.h
==============================================================================
--- head/sys/dev/cxgb/cxgb_osdep.h	Sun Nov 23 05:39:49 2008	(r185198)
+++ head/sys/dev/cxgb/cxgb_osdep.h	Sun Nov 23 07:30:07 2008	(r185199)
@@ -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")))
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811230730.mAN7U8fN043930>