PERFORCE change 128361 for review

Kip Macy kmacy at FreeBSD.org
Tue Oct 30 12:05:22 PDT 2007


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

Change 128361 by kmacy at kmacy:storage:toestack on 2007/10/30 19:04:26

	remove some dead (kprobes) code and add debug prints

Affected files ...

.. //depot/projects/toestack/sys/dev/cxgb/cxgb_l2t.c#5 edit
.. //depot/projects/toestack/sys/dev/cxgb/cxgb_l2t.h#6 edit

Differences ...

==== //depot/projects/toestack/sys/dev/cxgb/cxgb_l2t.c#5 (text+ko) ====

@@ -197,7 +197,8 @@
 		}
 		arpq_enqueue(e, m);
 		mtx_unlock(&e->lock);
-
+		printf("enqueueing arp request\n");
+		
 		if ((m0 = m_gethdr(M_NOWAIT, MT_DATA)) == NULL)
 			return (ENOMEM);
 		/*
@@ -208,6 +209,7 @@
 		 * A better way would be to use a work request to retry L2T
 		 * entries when there's no memory.
 		 */
+		printf("doing arpresolve\n");	
 		if (arpresolve(rt->rt_ifp, rt, m0, rt->rt_gateway, RT_ENADDR(rt)) == 0) {
 
 			mtx_lock(&e->lock);
@@ -216,7 +218,9 @@
 			else
 				m_freem(m);
 			mtx_unlock(&e->lock);
-		}
+		} else
+			printf("arpresolve returned non-zero\n");
+		
 	}
 	return 0;
 }
@@ -379,6 +383,8 @@
 	/* Need to allocate a new entry */
 	e = alloc_l2e(d);
 	if (e) {
+		printf("initializing new entry\n");
+		
 		mtx_lock(&e->lock);          /* avoid race with t3_l2t_free */
 		e->next = d->l2tab[hash].first;
 		d->l2tab[hash].first = e;
@@ -433,11 +439,6 @@
 
 }
 
-#if defined(NETEVENT) || !defined(CONFIG_CHELSIO_T3_MODULE)
-/*
- * Called when the host's ARP layer makes a change to some entry that is
- * loaded into the HW L2 table.
- */
 void
 t3_l2t_update(struct t3cdev *dev, struct rtentry *neigh)
 {
@@ -484,71 +485,6 @@
 	if (arpq)
 		handle_failed_resolution(dev, arpq);
 }
-#else
-/*
- * Called from a kprobe, interrupts are off.
- */
-void
-t3_l2t_update(struct t3cdev *dev, struct rtentry *neigh)
-{
-	struct l2t_entry *e;
-	struct l2t_data *d = L2DATA(dev);
-	u32 addr = *(u32 *) rt_key(neigh);
-	int ifidx = neigh->dev->ifindex;
-	int hash = arp_hash(addr, ifidx, d);
-
-	rw_rlock(&d->lock);
-	for (e = d->l2tab[hash].first; e; e = e->next)
-		if (e->addr == addr && e->ifindex == ifidx) {
-			mtx_lock(&e->lock);
-			if (atomic_load_acq_int(&e->refcnt)) {
-				if (neigh != e->neigh)
-					neigh_replace(e, neigh);
-				e->tdev = dev;
-				mod_timer(&e->update_timer, jiffies + 1);
-			}
-			mtx_unlock(&e->lock);
-			break;
-		}
-	rw_runlock(&d->lock);
-}
-
-static void
-update_timer_cb(unsigned long data)
-{
-	struct mbuf *arpq = NULL;
-	struct l2t_entry *e = (struct l2t_entry *)data;
-	struct rtentry *neigh = e->neigh;
-	struct t3cdev *dev = e->tdev;
-
-	barrier();
-	if (!atomic_load_acq_int(&e->refcnt))
-		return;
-
-	rw_rlock(&neigh->lock);
-	mtx_lock(&e->lock);
-
-	if (atomic_load_acq_int(&e->refcnt)) {
-		if (e->state == L2T_STATE_RESOLVING) {
-			if (neigh->nud_state & NUD_FAILED) {
-				arpq = e->arpq_head;
-				e->arpq_head = e->arpq_tail = NULL;
-			} else if (neigh_is_connected(neigh) && e->arpq_head)
-				setup_l2e_send_pending(dev, NULL, e);
-		} else {
-			e->state = neigh_is_connected(neigh) ?
-				L2T_STATE_VALID : L2T_STATE_STALE;
-			if (memcmp(e->dmac, RT_ENADDR(neigh), sizeof(e->dmac)))
-				setup_l2e_send_pending(dev, NULL, e);
-		}
-	}
-	mtx_unlock(&e->lock);
-	rw_runlock(&neigh->lock);
-
-	if (arpq)
-		handle_failed_resolution(dev, arpq);
-}
-#endif
 
 struct l2t_data *
 t3_init_l2t(unsigned int l2t_capacity)

==== //depot/projects/toestack/sys/dev/cxgb/cxgb_l2t.h#6 (text+ko) ====

@@ -148,8 +148,13 @@
 static inline int l2t_send(struct t3cdev *dev, struct mbuf *m,
 			   struct l2t_entry *e)
 {
-	if (__predict_true(e->state == L2T_STATE_VALID))
+	if (__predict_true(e->state == L2T_STATE_VALID)) {
+		printf ("l2t_entry state is valid\n");
+		
 		return cxgb_ofld_send(dev, (struct mbuf *)m);
+	}
+	printf("send slow\n");
+	
 	return t3_l2t_send_slow(dev, (struct mbuf *)m, e);
 }
 


More information about the p4-projects mailing list