PERFORCE change 37575 for review
Sam Leffler
sam at FreeBSD.org
Fri Sep 5 09:11:19 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=37575
Change 37575 by sam at sam_ebb on 2003/09/05 09:10:33
Locking fixups based on testing by Pavlin Radoslavov <pavlin at icir.org>.
Move up VIF_LOCK in add_mfc to insure lock order for ip_mdq.
ip_mdq handling of bw_meter_receive_packet does not require
an explicit MFC lock; use an existing lock.
Affected files ...
.. //depot/projects/netperf/sys/netinet/ip_mroute.c#9 edit
Differences ...
==== //depot/projects/netperf/sys/netinet/ip_mroute.c#9 (text+ko) ====
@@ -1116,6 +1116,7 @@
u_short nstl;
int s;
+ VIF_LOCK();
MFC_LOCK();
rt = mfc_find(mfccp->mfcc_origin.s_addr, mfccp->mfcc_mcastgrp.s_addr);
@@ -1130,6 +1131,7 @@
update_mfc_params(rt, mfccp);
MFC_UNLOCK();
+ VIF_UNLOCK();
return 0;
}
@@ -1212,6 +1214,7 @@
}
}
MFC_UNLOCK();
+ VIF_UNLOCK();
return 0;
}
@@ -1331,6 +1334,7 @@
}
VIF_LOCK();
+ MFC_LOCK();
if (imo && ((vifi = imo->imo_multicast_vif) < numvifs)) {
if (ip->ip_ttl < 255)
ip->ip_ttl++; /* compensate for -1 in *_send routines */
@@ -1344,6 +1348,7 @@
vifp->v_ifp->if_name, vifp->v_ifp->if_unit);
}
error = ip_mdq(m, ifp, NULL, vifi);
+ MFC_UNLOCK();
VIF_UNLOCK();
return error;
}
@@ -1359,6 +1364,7 @@
* or a packet destined to a local-only group.
*/
if (ip->ip_ttl <= 1 || ntohl(ip->ip_dst.s_addr) <= INADDR_MAX_LOCAL_GROUP) {
+ MFC_UNLOCK();
VIF_UNLOCK();
return 0;
}
@@ -1366,14 +1372,13 @@
/*
* Determine forwarding vifs from the forwarding cache table
*/
- MFC_LOCK();
++mrtstat.mrts_mfc_lookups;
rt = mfc_find(ip->ip_src.s_addr, ip->ip_dst.s_addr);
/* Entry exists, so forward if necessary */
if (rt != NULL) {
+ error = ip_mdq(m, ifp, rt, -1);
MFC_UNLOCK();
- error = ip_mdq(m, ifp, rt, -1);
VIF_UNLOCK();
return error;
} else {
@@ -1744,10 +1749,9 @@
struct timeval now;
GET_TIME(now);
- MFC_LOCK();
+ MFC_LOCK_ASSERT();
for (x = rt->mfc_bw_meter; x != NULL; x = x->bm_mfc_next)
bw_meter_receive_packet(x, plen, &now);
- MFC_UNLOCK();
}
return 0;
More information about the p4-projects
mailing list