PERFORCE change 126869 for review

Kip Macy kmacy at FreeBSD.org
Thu Sep 27 12:10:34 PDT 2007


http://perforce.freebsd.org/chv.cgi?CH=126869

Change 126869 by kmacy at kmacy_home:ethng on 2007/09/27 19:10:11

	double size of jumbo ring
	add t3_free_tx_desc_all to free any items that have not been freed by TX cleaning
	move dump_mi to uipc_mvec.c

Affected files ...

.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#20 edit
.. //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#26 edit

Differences ...

==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_adapter.h#20 (text+ko) ====

@@ -143,14 +143,11 @@
 	TPS_UPTODATE    = (1 << 5),
 };
 
-
 #define FL_Q_SIZE	4096
-#define JUMBO_Q_SIZE	512
+#define JUMBO_Q_SIZE	1024
 #define RSPQ_Q_SIZE	1024
 #define TX_ETH_Q_SIZE	1024
 
-
-
 /*
  * Types of Tx queues in each queue set.  Order here matters, do not change.
  * XXX TOE is not implemented yet, so the extra queues are just placeholders.
@@ -545,6 +542,7 @@
 int t3_sge_init_port(struct port_info *);
 void t3_sge_deinit_sw(adapter_t *);
 void t3_free_tx_desc(struct sge_txq *q, int n);
+void t3_free_tx_desc_all(struct sge_txq *q);
 
 void t3_rx_eth_lro(adapter_t *adap, struct sge_rspq *rq, struct mbuf *m,
     int ethpad, uint32_t rss_hash, uint32_t rss_csum, int lro);

==== //depot/projects/ethng/src/sys/dev/cxgb/cxgb_sge.c#26 (text+ko) ====

@@ -933,8 +933,6 @@
 #ifdef IFNET_MULTIQUEUE
 	panic("%s should not be called with multiqueue support\n", __FUNCTION__);
 #endif 
-
-	
 	for (i = 0; i < nqsets; i++) {
 		qs = &sc->sge.qs[i];
 		txq = &qs->txq[TXQ_ETH];
@@ -1249,25 +1247,6 @@
 	}
 }
 
-static void
-dump_mi(struct mbuf_iovec *mi)
-{
-	int i;
-	struct mbuf_vec *mv;
-	
-	printf("mi_flags=0x%08x mi_data=%p mi_len=%d mi_type=%d\n",
-	    mi->mi_flags, mi->mi_base + mi->mi_offset, mi->mi_len, mi->mi_type);
-
-	if (mi->mi_type == EXT_CLIOVEC ||
-	    mi->mi_type == EXT_IOVEC) {
-		mv = mtomv((struct mbuf *)mi->mi_base);
-		mi = mv->mv_vec;
-		for (i = 0; i < mv->mv_count; i++, mi++) 
-			dump_mi(mi);
-
-	}
-}
-
 /* sizeof(*eh) + sizeof(*vhdr) + sizeof(*ip) + sizeof(*tcp) */
 #define TCPPKTHDRSIZE (ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN + 20 + 20)
 
@@ -1441,7 +1420,7 @@
 			DPRINTF("mlen==%d max=%ld\n", mlen, (WR_LEN - sizeof(*cpl)));
 			if (mi->mi_type != MT_IOVEC &&
 			    mi->mi_type != MT_CLIOVEC) 
-				memcpy(&txd->flit[2], mi_data(mi), mlen);
+				memcpy(&txd->flit[2], mi->mi_data, mlen);
 			else {
 				/*
 				 * XXX mbuf_iovec
@@ -1711,6 +1690,7 @@
 	return ctrl_xmit(adap, &adap->sge.qs[0].txq[TXQ_CTRL], m);
 }
 
+
 /**
  *	free_qset - free the resources of an SGE queue set
  *	@sc: the controller owning the queue set
@@ -1724,13 +1704,15 @@
 t3_free_qset(adapter_t *sc, struct sge_qset *q)
 {
 	int i;
-
-       for (i = 0; i < SGE_TXQ_PER_SET; i++) 
-	       if (q->txq[i].txq_mr.mr_ring != NULL) {
-		       free(q->txq[i].txq_mr.mr_ring, M_DEVBUF);
-		       mtx_destroy(&q->txq[i].txq_mr.mr_lock);
-	       }
-       for (i = 0; i < SGE_RXQ_PER_SET; ++i) {
+	
+	t3_free_tx_desc_all(&q->txq[TXQ_ETH]);
+	
+	for (i = 0; i < SGE_TXQ_PER_SET; i++) 
+		if (q->txq[i].txq_mr.mr_ring != NULL) {
+			free(q->txq[i].txq_mr.mr_ring, M_DEVBUF);
+			mtx_destroy(&q->txq[i].txq_mr.mr_lock);
+		}
+	for (i = 0; i < SGE_RXQ_PER_SET; ++i) {
 		if (q->fl[i].desc) {
 			mtx_lock(&sc->sge.reg_lock);
 			t3_sge_disable_fl(sc, q->fl[i].cntxt_id);
@@ -1882,18 +1864,7 @@
 				bus_dmamap_unload(q->entry_tag, txsd->map);
 				txsd->flags &= ~TX_SW_DESC_MAPPED;
 			}
-#ifdef notyet			
-			critical_enter();
-			/*
-			 * transfer mbuf_vec contents to cpu local ring
-			 * XXX 
-			 * 
-			 */
-			critical_exit();
-#else
 			m_freem_iovec(&txsd->mi);
-#endif			
-			
 			txsd->mi.mi_base = NULL;
 
 #if defined(DIAGNOSTIC) && 0
@@ -1914,6 +1885,25 @@
 
 }
 
+void
+t3_free_tx_desc_all(struct sge_txq *q)
+{
+	int i;
+	struct tx_sw_desc *txsd;
+	
+	for (i = 0; i < q->size; i++) {
+		txsd = &q->sdesc[i];
+		if (txsd->mi.mi_base != NULL) {
+			if (txsd->flags & TX_SW_DESC_MAPPED) {
+				bus_dmamap_unload(q->entry_tag, txsd->map);
+				txsd->flags &= ~TX_SW_DESC_MAPPED;
+			}
+			m_freem_iovec(&txsd->mi);
+			bzero(&txsd->mi, sizeof(txsd->mi));
+		}
+	}
+}
+
 /**
  *	is_new_response - check if a response is newly written
  *	@r: the response descriptor
@@ -2678,7 +2668,10 @@
 		ret = 1;
 		break;
 	}
+	panic("append not supported");
+#if 0	
 	m_iovappend(m0, cl, fl->buf_size, len, sizeof(uint32_t), sd->rxsd_ref);
+#endif	
 done:	
 	if (++fl->cidx == fl->size)
 		fl->cidx = 0;


More information about the p4-projects mailing list