svn commit: r185153 - user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb

Kip Macy kmacy at FreeBSD.org
Fri Nov 21 00:20:29 PST 2008


Author: kmacy
Date: Fri Nov 21 08:20:28 2008
New Revision: 185153
URL: http://svn.freebsd.org/changeset/base/185153

Log:
  add per-hardware queue ifaltq to enable altq with multiple transmit queues

Modified:
  user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_adapter.h
  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	Fri Nov 21 08:19:20 2008	(r185152)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_adapter.h	Fri Nov 21 08:20:28 2008	(r185153)
@@ -260,7 +260,9 @@ struct sge_txq {
 	 */
 	struct mbuf_head cleanq;	
 	struct buf_ring *txq_mr;
+	struct ifaltq	*txq_ifq;
 	struct mbuf     *immpkt;
+
 	uint32_t        txq_drops;
 	uint32_t        txq_skipped;
 	uint32_t        txq_coalesced;

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	Fri Nov 21 08:19:20 2008	(r185152)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_multiq.c	Fri Nov 21 08:20:28 2008	(r185153)
@@ -149,7 +149,7 @@ cxgb_pcpu_enqueue_packet(struct ifnet *i
 #endif	    
 	qs = &pi->adapter->sge.qs[qidx];
 	if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
-		IFQ_ENQUEUE(&ifp->if_snd, m, err);
+		IFQ_ENQUEUE(qs->txq[0].txq_ifq, m, err);
 	} else {
 		err = cxgb_pcpu_enqueue_packet_(qs, m);
 	}
@@ -178,8 +178,8 @@ cxgb_dequeue_packet(struct sge_txq *txq,
 	m_vec[0] = m;
 	return (1);
 #endif
-	if (ALTQ_ENABLED(&pi->ifp->if_snd)) {
-		IFQ_DRV_DEQUEUE(&pi->ifp->if_snd, m);
+	if (ALTQ_IS_ENABLED(txq->txq_ifq)) {
+		IFQ_DRV_DEQUEUE(txq->txq_ifq, m);
 		if (m == NULL)
 			return (0);
 	
@@ -307,7 +307,7 @@ cxgb_pcpu_start_(struct sge_qset *qs, st
 	else if (immpkt) {
 
 		if (!buf_ring_empty(txq->txq_mr)
-		    || ALTQ_ENABLED(&pi->ifp->if_snd)) 
+		    || ALTQ_IS_ENABLED(&pi->ifp->if_snd)) 
 			initerr = cxgb_pcpu_enqueue_packet_(qs, immpkt);
 		else
 			txq->immpkt = immpkt;

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	Fri Nov 21 08:19:20 2008	(r185152)
+++ user/kmacy/HEAD_fast_multi_xmit/sys/dev/cxgb/cxgb_sge.c	Fri Nov 21 08:20:28 2008	(r185153)
@@ -1714,9 +1714,15 @@ t3_free_qset(adapter_t *sc, struct sge_q
 	
 	t3_free_tx_desc_all(&q->txq[TXQ_ETH]);
 	
-	for (i = 0; i < SGE_TXQ_PER_SET; i++) 
+	for (i = 0; i < SGE_TXQ_PER_SET; i++) {
 		if (q->txq[i].txq_mr != NULL) 
 			buf_ring_free(q->txq[i].txq_mr, M_DEVBUF);
+		if (q->txq[i].txq_ifq != NULL) {
+			ifq_detach(q->txq[i].txq_ifq);
+			free(q->txq[i].txq_ifq, M_DEVBUF);
+		}
+	}
+	
 	for (i = 0; i < SGE_RXQ_PER_SET; ++i) {
 		if (q->fl[i].desc) {
 			mtx_lock_spin(&sc->sge.reg_lock);
@@ -2281,6 +2287,13 @@ t3_sge_alloc_qset(adapter_t *sc, u_int i
 			device_printf(sc->dev, "failed to allocate mbuf ring\n");
 			goto err;
 		}
+		if ((q->txq[i].txq_ifq =
+			malloc(sizeof(struct ifaltq), M_DEVBUF, M_NOWAIT|M_ZERO))
+		    == NULL) {
+			device_printf(sc->dev, "failed to allocate ifq\n");
+			goto err;
+		}
+		ifq_attach(q->txq[i].txq_ifq, pi->ifp);
 	}
 	init_qset_cntxt(q, id);
 	q->idx = id;


More information about the svn-src-user mailing list