Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Nov 2008 08:29:26 +0000 (UTC)
From:      Kip Macy <kmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r184865 - user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb
Message-ID:  <200811120829.mAC8TQRA024173@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kmacy
Date: Wed Nov 12 08:29:26 2008
New Revision: 184865
URL: http://svn.freebsd.org/changeset/base/184865

Log:
  Fix compilation issues with and enable multiqueue support

Modified:
  user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_adapter.h
  user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_config.h
  user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_main.c
  user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_multiq.c
  user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c

Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_adapter.h
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_adapter.h	Wed Nov 12 07:32:07 2008	(r184864)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_adapter.h	Wed Nov 12 08:29:26 2008	(r184865)
@@ -603,7 +603,7 @@ static inline int offload_running(adapte
 }
 
 int cxgb_pcpu_enqueue_packet(struct ifnet *ifp, struct mbuf *m);
-int cxgb_pcpu_start(struct ifnet *ifp, struct mbuf *m);
+int cxgb_pcpu_transmit(struct ifnet *ifp, struct mbuf *m);
 void cxgb_pcpu_shutdown_threads(struct adapter *sc);
 void cxgb_pcpu_startup_threads(struct adapter *sc);
 

Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_config.h
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_config.h	Wed Nov 12 07:32:07 2008	(r184864)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_config.h	Wed Nov 12 08:29:26 2008	(r184865)
@@ -32,6 +32,7 @@ $FreeBSD$
 #ifndef _CXGB_CONFIG_H_
 #define _CXGB_CONFIG_H_
 
-#define CONFIG_CHELSIO_T3_CORE
+#define	CONFIG_CHELSIO_T3_CORE
+#define	IFNET_MULTIQUEUE
 
 #endif

Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_main.c
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_main.c	Wed Nov 12 07:32:07 2008	(r184864)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_main.c	Wed Nov 12 08:29:26 2008	(r184865)
@@ -215,8 +215,9 @@ SYSCTL_UINT(_hw_cxgb, OID_AUTO, singleq,
 
 
 /*
- * The driver uses an auto-queue algorithm by default.
- * To disable it and force a single queue-set per port, use singleq = 1.
+ * By default the driver will not update the firmware unless
+ * it was compiled against a newer version
+ * 
  */
 static int force_fw_update = 0;
 TUNABLE_INT("hw.cxgb.force_fw_update", &force_fw_update);
@@ -827,7 +828,9 @@ cxgb_setup_msix(adapter_t *sc, int msix_
 				device_printf(sc->dev, "Cannot set up "
 				    "interrupt for message %d\n", rid);
 				return (EINVAL);
+				
 			}
+#if 0			
 #ifdef IFNET_MULTIQUEUE			
 			if (singleq == 0) {
 				int vector = rman_get_start(sc->msix_irq_res[k]);
@@ -835,7 +838,8 @@ cxgb_setup_msix(adapter_t *sc, int msix_
 					device_printf(sc->dev, "binding vector=%d to cpu=%d\n", vector, k % mp_ncpus);
 				intr_bind(vector, k % mp_ncpus);
 			}
-#endif			
+#endif
+#endif
 		}
 	}
 
@@ -925,12 +929,10 @@ cxgb_port_attach(device_t dev)
 	ifp->if_ioctl = cxgb_ioctl;
 	ifp->if_start = cxgb_start;
 
-#if 0	
+
 #ifdef IFNET_MULTIQUEUE
-	ifp->if_flags |= IFF_MULTIQ;
-	ifp->if_mq_start = cxgb_pcpu_start;
+	ifp->if_transmit = cxgb_pcpu_transmit;
 #endif
-#endif	
 	ifp->if_timer = 0;	/* Disable ifnet watchdog */
 	ifp->if_watchdog = NULL;
 

Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_multiq.c
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_multiq.c	Wed Nov 12 07:32:07 2008	(r184864)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_multiq.c	Wed Nov 12 08:29:26 2008	(r184865)
@@ -106,12 +106,12 @@ SYSCTL_UINT(_hw_cxgb, OID_AUTO, txq_mr_s
     "size of per-queue mbuf ring");
 
 
-static inline int32_t cxgb_pcpu_calc_cookie(struct ifnet *ifp, struct mbuf *immpkt);
 static void cxgb_pcpu_start_proc(void *arg);
+static int cxgb_tx(struct sge_qset *qs, uint32_t txmax);
+
 #ifdef IFNET_MULTIQUEUE
-static int cxgb_pcpu_cookie_to_qidx(struct port_info *, uint32_t cookie);
+static int cxgb_pcpu_cookie_to_qidx(struct port_info *pi, uint32_t cookie);
 #endif
-static int cxgb_tx(struct sge_qset *qs, uint32_t txmax);
 
 static inline int
 cxgb_pcpu_enqueue_packet_(struct sge_qset *qs, struct mbuf *m)
@@ -119,9 +119,6 @@ cxgb_pcpu_enqueue_packet_(struct sge_qse
 	struct sge_txq *txq;
 	int err = 0;
 
-#ifndef IFNET_MULTIQUEUE
-	panic("not expecting enqueue without multiqueue");
-#endif	
 	KASSERT(m != NULL, ("null mbuf"));
 	KASSERT(m->m_type == MT_DATA, ("bad mbuf type %d", m->m_type));
 	if (qs->qs_flags & QS_EXITING) {
@@ -149,7 +146,7 @@ cxgb_pcpu_enqueue_packet(struct ifnet *i
 #ifdef IFNET_MULTIQUEUE
 	int32_t calc_cookie;
 
-	calc_cookie = m->m_pkthdr.rss_hash;
+	calc_cookie = m->m_pkthdr.flowid;
 	qidx = cxgb_pcpu_cookie_to_qidx(pi, calc_cookie);
 #else
 	qidx = 0;
@@ -230,134 +227,6 @@ cxgb_dequeue_packet(struct sge_txq *txq,
 	return (count);
 }
 
-static int32_t
-cxgb_pcpu_get_cookie(struct ifnet *ifp, struct in6_addr *lip, uint16_t lport, struct in6_addr *rip, uint16_t rport, int ipv6)
-{
-	uint32_t base;
-	uint8_t buf[36];
-	int count;
-	int32_t cookie;
-
-	critical_enter();
-	/* 
-	 * Can definitely bypass bcopy XXX
-	 */
-	if (ipv6 == 0) {
-		count = 12;
-		bcopy(rip, &buf[0], 4);
-		bcopy(lip, &buf[4], 4);
-		bcopy(&rport, &buf[8], 2);
-		bcopy(&lport, &buf[10], 2);
-	} else {
-		count = 36;
-		bcopy(rip, &buf[0], 16);
-		bcopy(lip, &buf[16], 16);
-		bcopy(&rport, &buf[32], 2);
-		bcopy(&lport, &buf[34], 2);
-	}
-	
-	base = 0xffffffff;
-	base = update_crc32(base, buf, count);
-	base = sctp_csum_finalize(base);
-
-	/*
-	 * Indirection table is 128 bits
-	 * -> cookie indexes into indirection table which maps connection to queue
-	 * -> RSS map maps queue to CPU
-	 */
-	cookie = (base & (RSS_TABLE_SIZE-1));
-	critical_exit();
-	
-	return (cookie);
-}
-
-static int32_t
-cxgb_pcpu_calc_cookie(struct ifnet *ifp, struct mbuf *immpkt)
-{
-	struct in6_addr lip, rip;
-	uint16_t lport, rport;
-	struct ether_header *eh;
-	int32_t cookie;
-	struct ip *ip;
-	struct ip6_hdr *ip6;
-	struct tcphdr *th;
-	struct udphdr *uh;
-	struct sctphdr *sh;
-	uint8_t *next, proto;
-	int etype;
-
-	if (immpkt == NULL)
-		return -1;
-
-#if 1	
-	/*
-	 * XXX perf test
-	 */
-	return (0);
-#endif	
-	rport = lport = 0;
-	cookie = -1;
-	next = NULL;
-	eh = mtod(immpkt, struct ether_header *);
-	etype = ntohs(eh->ether_type);
-
-	switch (etype) {
-	case ETHERTYPE_IP:
-		ip = (struct ip *)(eh + 1);
-		next = (uint8_t *)(ip + 1);
-		bcopy(&ip->ip_src, &lip, 4);
-		bcopy(&ip->ip_dst, &rip, 4);
-		proto = ip->ip_p;
-		break;
-	case ETHERTYPE_IPV6:
-		ip6 = (struct ip6_hdr *)(eh + 1);
-		next = (uint8_t *)(ip6 + 1);
-		bcopy(&ip6->ip6_src, &lip, sizeof(struct in6_addr));
-		bcopy(&ip6->ip6_dst, &rip, sizeof(struct in6_addr));
-		if (ip6->ip6_nxt == IPPROTO_HOPOPTS) {
-			struct ip6_hbh *hbh;
-
-			hbh = (struct ip6_hbh *)(ip6 + 1);
-			proto = hbh->ip6h_nxt;
-		} else 
-			proto = ip6->ip6_nxt;
-		break;
-	case ETHERTYPE_ARP:
-	default:
-		/*
-		 * Default to queue zero
-		 */
-		proto = cookie = 0;
-	}
-	if (proto) {
-		switch (proto) {
-		case IPPROTO_TCP:
-			th = (struct tcphdr *)next;
-			lport = th->th_sport;
-			rport = th->th_dport;
-			break;
-		case IPPROTO_UDP:
-			uh = (struct udphdr *)next;
-			lport = uh->uh_sport;
-			rport = uh->uh_dport;
-			break;
-		case IPPROTO_SCTP:
-			sh = (struct sctphdr *)next;
-			lport = sh->src_port;
-			rport = sh->dest_port;
-			break;
-		default:
-			/* nothing to do */
-			break;
-		}
-	}
-	
-	if (cookie) 		
-		cookie = cxgb_pcpu_get_cookie(ifp, &lip, lport, &rip, rport, (etype == ETHERTYPE_IPV6));
-
-	return (cookie);
-}
-
 static void
 cxgb_pcpu_free(struct sge_qset *qs)
 {
@@ -494,7 +363,7 @@ cxgb_pcpu_start_(struct sge_qset *qs, st
 }
 
 int
-cxgb_pcpu_start(struct ifnet *ifp, struct mbuf *immpkt)
+cxgb_pcpu_transmit(struct ifnet *ifp, struct mbuf *immpkt)
 {
 	uint32_t cookie;
 	int err, qidx, locked, resid;
@@ -509,10 +378,10 @@ cxgb_pcpu_start(struct ifnet *ifp, struc
 	qidx = resid = err = cookie = locked = 0;
 
 #ifdef IFNET_MULTIQUEUE	
-	if (immpkt && (immpkt->m_pkthdr.rss_hash != 0)) {
-		cookie = immpkt->m_pkthdr.rss_hash;
+	if (immpkt && (immpkt->m_pkthdr.flowid != 0)) {
+		cookie = immpkt->m_pkthdr.flowid;
 		qidx = cxgb_pcpu_cookie_to_qidx(pi, cookie);
-		DPRINTF("hash=0x%x qidx=%d cpu=%d\n", immpkt->m_pkthdr.rss_hash, qidx, curcpu);
+		DPRINTF("hash=0x%x qidx=%d cpu=%d\n", immpkt->m_pkthdr.flowid, qidx, curcpu);
 		qs = &pi->adapter->sge.qs[qidx];
 	} else
 #endif		
@@ -555,7 +424,7 @@ cxgb_start(struct ifnet *ifp)
 	if (IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		return;
 
-	cxgb_pcpu_start(ifp, NULL);
+	cxgb_pcpu_transmit(ifp, NULL);
 }
 
 static void

Modified: user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c	Wed Nov 12 07:32:07 2008	(r184864)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c	Wed Nov 12 08:29:26 2008	(r184865)
@@ -2885,7 +2885,7 @@ process_responses(adapter_t *adap, struc
 			eop = get_packet(adap, drop_thresh, qs, &rspq->rspq_mbuf, r);
 #endif
 #ifdef IFNET_MULTIQUEUE
-			rspq->rspq_mh.mh_head->m_pkthdr.rss_hash = rss_hash;
+			rspq->rspq_mh.mh_head->m_pkthdr.flowid = rss_hash;
 #endif			
 			ethpad = 2;
 		} else {



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