PERFORCE change 132411 for review

Steve Wise swise at FreeBSD.org
Thu Jan 3 09:25:58 PST 2008


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

Change 132411 by swise at swise:vic10:iwarp on 2008/01/03 17:25:40

	Add async notification support in if_cxgb.

Affected files ...

.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_adapter.h#9 edit
.. //depot/projects/iwarp/sys/dev/cxgb/cxgb_sge.c#6 edit

Differences ...

==== //depot/projects/iwarp/sys/dev/cxgb/cxgb_adapter.h#9 (text+ko) ====

@@ -120,8 +120,8 @@
 	uint8_t		port_id;
 	uint8_t		tx_chan;
 	uint8_t		txpkt_intf;
+	uint8_t		nqsets;
 	uint8_t         first_qset;
-	uint32_t	nqsets;
 	
 	uint8_t		hw_addr[ETHER_ADDR_LEN];
 	struct taskqueue *tq;
@@ -196,6 +196,7 @@
 	uint32_t	holdoff_tmr;
 	uint32_t	next_holdoff;
 	uint32_t        imm_data;
+	uint32_t        async_notif;
 	struct rsp_desc	*desc;
 	uint32_t	cntxt_id;
 	struct mtx      lock;

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

@@ -2749,15 +2749,37 @@
 		eth = (r->rss_hdr.opcode == CPL_RX_PKT);
 		
 		if (__predict_false(flags & F_RSPD_ASYNC_NOTIF)) {
-			/* XXX */
-			printf("async notification\n");
+			struct mbuf *m;
+
+			if (cxgb_debug)
+				printf("async notification\n");
+
+			if (rspq->rspq_mbuf == NULL) {
+				rspq->rspq_mbuf = m_gethdr(M_DONTWAIT, MT_DATA);
+				m = rspq->rspq_mbuf;
+			} else {
+				m = m_gethdr(M_DONTWAIT, MT_DATA);
+			}
+
+			/* XXX m is lost here if rspq->rspq_mbuf is not NULL */
+
+			if (m == NULL)
+				goto no_mem;
 
+                        memcpy(mtod(m, char *), r, AN_PKT_SIZE);
+			m->m_len = m->m_pkthdr.len = AN_PKT_SIZE;
+                        *mtod(m, char *) = CPL_ASYNC_NOTIF;
+			rss_csum = htonl(CPL_ASYNC_NOTIF << 24);
+			eop = 1;
+                        rspq->async_notif++;
+			goto skip;
 		} else if  (flags & F_RSPD_IMM_DATA_VALID) {
 #ifdef DISABLE_MBUF_IOVEC
 			if (cxgb_debug)
 				printf("IMM DATA VALID opcode=0x%x rspq->cidx=%d\n", r->rss_hdr.opcode, rspq->cidx);
 
 			if(get_imm_packet(adap, r, &rspq->rspq_mh) == 0) {
+		no_mem:
 				rspq->next_holdoff = NOMEM_INTR_DELAY;
 				budget_left--;
 				break;
@@ -2777,6 +2799,7 @@
 			 * XXX revisit me
 			 */
 			if (rspq->rspq_mbuf == NULL &&  m == NULL) {
+		no_mem:
 				rspq->next_holdoff = NOMEM_INTR_DELAY;
 				budget_left--;
 				break;
@@ -2788,7 +2811,7 @@
 			goto skip;
 			
 #endif			
-		} else if (r->len_cq) {			
+		} else if (r->len_cq) {
 			int drop_thresh = eth ? SGE_RX_DROP_THRES : 0;
 			
 #ifdef DISABLE_MBUF_IOVEC


More information about the p4-projects mailing list