PERFORCE change 128380 for review

Kip Macy kmacy at FreeBSD.org
Tue Oct 30 18:42:31 PDT 2007


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

Change 128380 by kmacy at kmacy:storage:toestack on 2007/10/31 01:42:27

	don't allocate an mbuf just so we can call arpresolve - 
	arpresolve can now be called with m==NULL 

Affected files ...

.. //depot/projects/toestack/sys/dev/cxgb/cxgb_l2t.c#7 edit

Differences ...

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

@@ -174,17 +174,12 @@
 		     struct l2t_entry *e)
 {
 	struct rtentry *rt;
-	struct mbuf *m0;
-	
-	if ((m0 = m_gethdr(M_NOWAIT, MT_DATA)) == NULL)
-		return (ENOMEM);
 
 	rt = e->neigh;
-	
 again:
 	switch (e->state) {
 	case L2T_STATE_STALE:     /* entry is stale, kick off revalidation */
-		arpresolve(rt->rt_ifp, rt, m0, rt->rt_gateway, RT_ENADDR(rt));
+		arpresolve(rt->rt_ifp, rt, NULL, rt->rt_gateway, RT_ENADDR(rt));
 		mtx_lock(&e->lock);
 		if (e->state == L2T_STATE_STALE)
 			e->state = L2T_STATE_VALID;
@@ -201,8 +196,6 @@
 		mtx_unlock(&e->lock);
 		printf("enqueueing arp request\n");
 		
-		if ((m0 = m_gethdr(M_NOWAIT, MT_DATA)) == NULL)
-			return (ENOMEM);
 		/*
 		 * Only the first packet added to the arpq should kick off
 		 * resolution.  However, because the m_gethdr below can fail,
@@ -212,7 +205,9 @@
 		 * entries when there's no memory.
 		 */
 		printf("doing arpresolve\n");	
-		if (arpresolve(rt->rt_ifp, rt, m0, rt->rt_gateway, RT_ENADDR(rt)) == 0) {
+		if (arpresolve(rt->rt_ifp, rt, NULL, rt->rt_gateway, RT_ENADDR(rt)) == 0) {
+			if ((m = m_gethdr(M_NOWAIT, MT_DATA)) == NULL)
+				return (ENOMEM);
 
 			mtx_lock(&e->lock);
 			if (e->arpq_head) 


More information about the p4-projects mailing list