Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 31 Oct 2007 01:42:30 GMT
From:      Kip Macy <kmacy@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 128380 for review
Message-ID:  <200710310142.l9V1gUl8079100@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=128380

Change 128380 by kmacy@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) 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200710310142.l9V1gUl8079100>