PERFORCE change 118709 for review

Kip Macy kmacy at FreeBSD.org
Tue Apr 24 06:41:52 UTC 2007


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

Change 118709 by kmacy at kmacy_vt-x:opentoe_init on 2007/04/24 06:41:47

	implement calc_tx_descs_ofld along with small cleanups

Affected files ...

.. //depot/projects/opentoe/sys/dev/cxgb/cxgb_sge.c#15 edit

Differences ...

==== //depot/projects/opentoe/sys/dev/cxgb/cxgb_sge.c#15 (text+ko) ====

@@ -1863,22 +1863,20 @@
  * 	packet.  These packets are already fully constructed.
  */
 static __inline unsigned int
-calc_tx_descs_ofld(const struct mbuf *m, unsigned int nsegs)
+calc_tx_descs_ofld(struct mbuf *m, unsigned int nsegs)
 {
-#ifdef notyet	
-	unsigned int flits, cnt = skb_shinfo(skb)->nr_frags;
+	unsigned int flits, cnt = 0;
+
 
-	if (m->m_len <= WR_LEN && cnt == 0)
+	if (m->m_len <= WR_LEN)
 		return 1;                 /* packet fits as immediate data */
 
-	flits = (m->m_pkthdr.header - mtod(m, char *)) / 8;   /* headers */
+	if (m->m_flags & M_IOVEC)
+		cnt = mtomv(m)->mv_count;
 
-	if (skb->tail != skb->h.raw)
-		cnt++;
+	flits = ((uint8_t *)m->m_pkthdr.header - mtod(m, uint8_t *)) / 8;   /* headers */
 
 	return flits_to_desc(flits + sgl_len(cnt));
-#endif
-	return (0);
 }
 
 /**
@@ -1952,16 +1950,14 @@
 static void
 restart_offloadq(unsigned long data)
 {
-#ifdef notyet	
+
 	struct mbuf *m;
-#endif	
 	struct sge_qset *qs = (struct sge_qset *)data;
 	struct sge_txq *q = &qs->txq[TXQ_OFLD];
 	adapter_t *adap = qs->port->adapter;
 	struct mbuf *m_vec[TX_CLEAN_MAX_DESC];
 	int i, cleaned;
 	
-#ifdef notyet
 	mtx_lock(&q->lock);
 again:	cleaned = reclaim_completed_tx(adap, q, TX_CLEAN_MAX_DESC, m_vec);
 
@@ -1988,14 +1984,14 @@
 			q->pidx -= q->size;
 			q->gen ^= 1;
 		}
-#if 0		
+		
 		__skb_unlink(skb, &q->sendq);
-#endif		
+		
 		mtx_unlock(&q->lock);
 		write_ofld_wr(adap, skb, q, pidx, gen, ndesc, segs, nsegs);
 		mtx_lock(&q->lock);
 	}
-#endif	
+
 	mtx_unlock(&q->lock);
 	
 #if USE_GTS


More information about the p4-projects mailing list