Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Apr 2012 16:57:51 +0000 (UTC)
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r234387 - user/np/toe_iwarp/sys/netinet
Message-ID:  <201204171657.q3HGvqZD090825@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: np
Date: Tue Apr 17 16:57:51 2012
New Revision: 234387
URL: http://svn.freebsd.org/changeset/base/234387

Log:
  Replacement for the old arp_update_event.  This one allows you to track
  state changes of an llentry.

Modified:
  user/np/toe_iwarp/sys/netinet/if_ether.c
  user/np/toe_iwarp/sys/netinet/if_ether.h
  user/np/toe_iwarp/sys/netinet/in.c

Modified: user/np/toe_iwarp/sys/netinet/if_ether.c
==============================================================================
--- user/np/toe_iwarp/sys/netinet/if_ether.c	Tue Apr 17 16:28:22 2012	(r234386)
+++ user/np/toe_iwarp/sys/netinet/if_ether.c	Tue Apr 17 16:57:51 2012	(r234387)
@@ -180,6 +180,17 @@ arptimer(void *arg)
 		    callout_active(&lle->la_timer)) {
 			callout_stop(&lle->la_timer);
 			LLE_REMREF(lle);
+
+			if (lle->la_flags != LLE_DELETED) {
+				int evt;
+
+				if (lle->la_flags & LLE_VALID)
+					evt = LLENTRY_EXPIRED;
+				else
+					evt = LLENTRY_TIMEDOUT;
+				EVENTHANDLER_INVOKE(lle_event, lle, evt);
+			}
+
 			pkts_dropped = llentry_free(lle);
 			ARPSTAT_ADD(dropped, pkts_dropped);
 			ARPSTAT_INC(timeouts);
@@ -312,7 +323,7 @@ arpresolve(struct ifnet *ifp, struct rte
 	}
 retry:
 	IF_AFDATA_RLOCK(ifp);	
-	la = lla_lookup(LLTABLE(ifp), flags, dst);
+	la = *lle = lla_lookup(LLTABLE(ifp), flags, dst);
 	IF_AFDATA_RUNLOCK(ifp);	
 	if ((la == NULL) && ((flags & LLE_EXCLUSIVE) == 0)
 	    && ((ifp->if_flags & (IFF_NOARP | IFF_STATICARP)) == 0)) {		
@@ -344,7 +355,6 @@ retry:
 			la->la_preempt--;
 		}
 		
-		*lle = la;
 		error = 0;
 		goto done;
 	} 
@@ -727,6 +737,7 @@ match:
 		la->la_flags |= LLE_VALID;
 
 		EVENTHANDLER_INVOKE(arp_update_event, la);
+		EVENTHANDLER_INVOKE(lle_event, la, LLENTRY_RESOLVED);
 
 		if (!(la->la_flags & LLE_STATIC)) {
 			int canceled;

Modified: user/np/toe_iwarp/sys/netinet/if_ether.h
==============================================================================
--- user/np/toe_iwarp/sys/netinet/if_ether.h	Tue Apr 17 16:28:22 2012	(r234386)
+++ user/np/toe_iwarp/sys/netinet/if_ether.h	Tue Apr 17 16:57:51 2012	(r234387)
@@ -122,9 +122,19 @@ void	arp_ifinit2(struct ifnet *, struct 
 void	arp_ifscrub(struct ifnet *, uint32_t);
 
 #include <sys/eventhandler.h>
+/* XXX: can be retired once OFED code is updated to use lle_event */
 typedef void (*llevent_arp_update_fn)(void *, struct llentry *);
 EVENTHANDLER_DECLARE(arp_update_event, llevent_arp_update_fn);
 
+enum {
+	LLENTRY_RESOLVED,
+	LLENTRY_TIMEDOUT,
+	LLENTRY_DELETED,
+	LLENTRY_EXPIRED,
+};
+typedef void (*lle_event_fn)(void *, struct llentry *, int);
+EVENTHANDLER_DECLARE(lle_event, lle_event_fn);
+
 #endif
 
 #endif

Modified: user/np/toe_iwarp/sys/netinet/in.c
==============================================================================
--- user/np/toe_iwarp/sys/netinet/in.c	Tue Apr 17 16:28:22 2012	(r234386)
+++ user/np/toe_iwarp/sys/netinet/in.c	Tue Apr 17 16:57:51 2012	(r234387)
@@ -1470,6 +1470,7 @@ in_lltable_lookup(struct lltable *llt, u
 			LLE_WLOCK(lle);
 			lle->la_flags = LLE_DELETED;
 			EVENTHANDLER_INVOKE(arp_update_event, lle);
+			EVENTHANDLER_INVOKE(lle_event, lle, LLENTRY_DELETED);
 			LLE_WUNLOCK(lle);
 #ifdef DIAGNOSTIC
 			log(LOG_INFO, "ifaddr cache = %p  is deleted\n", lle);	



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