Page MenuHomeFreeBSD

D54603.id169328.diff
No OneTemporary

D54603.id169328.diff

diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h
--- a/sys/netinet/ip_mroute.h
+++ b/sys/netinet/ip_mroute.h
@@ -262,9 +262,9 @@
u_long v_bytes_in; /* # bytes in on interface */
u_long v_bytes_out; /* # bytes out on interface */
#ifdef _KERNEL
-#define MROUTE_VIF_SYSCTL_LEN __offsetof(struct vif, v_spin)
- struct mtx v_spin; /* Spin mutex for pkt stats */
- char v_spin_name[32];
+#define MROUTE_VIF_SYSCTL_LEN __offsetof(struct vif, v_mtx)
+ struct mtx v_mtx; /* mutex for pkt stats */
+ char v_mtx_name[32];
#endif
};
@@ -350,8 +350,8 @@
#ifdef _KERNEL
struct callout bm_meter_callout; /* Periodic callout */
void* arg; /* custom argument */
- struct mtx bm_spin; /* meter spin lock */
- char bm_spin_name[32];
+ struct mtx bm_mtx; /* meter lock */
+ char bm_mtx_name[32];
#endif
};
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -606,12 +606,12 @@
return EINVAL;
}
- mtx_lock_spin(&V_viftable[vifi].v_spin);
+ mtx_lock(&V_viftable[vifi].v_mtx);
req->icount = V_viftable[vifi].v_pkt_in;
req->ocount = V_viftable[vifi].v_pkt_out;
req->ibytes = V_viftable[vifi].v_bytes_in;
req->obytes = V_viftable[vifi].v_bytes_out;
- mtx_unlock_spin(&V_viftable[vifi].v_spin);
+ mtx_unlock(&V_viftable[vifi].v_mtx);
MRW_RUNLOCK();
return 0;
@@ -1004,8 +1004,8 @@
vifp->v_pkt_out = 0;
vifp->v_bytes_in = 0;
vifp->v_bytes_out = 0;
- sprintf(vifp->v_spin_name, "BM[%d] spin", vifcp->vifc_vifi);
- mtx_init(&vifp->v_spin, vifp->v_spin_name, NULL, MTX_SPIN);
+ sprintf(vifp->v_mtx_name, "BM[%d] mtx", vifcp->vifc_vifi);
+ mtx_init(&vifp->v_mtx, vifp->v_mtx_name, NULL, MTX_DEF);
/* Adjust numvifs up if the vifi is higher than numvifs */
if (V_numvifs <= vifcp->vifc_vifi)
@@ -1053,7 +1053,7 @@
}
}
- mtx_destroy(&vifp->v_spin);
+ mtx_destroy(&vifp->v_mtx);
bzero((caddr_t)vifp, sizeof (*vifp));
@@ -1659,7 +1659,7 @@
}
/* If I sourced this packet, it counts as output, else it was input. */
- mtx_lock_spin(&V_viftable[vifi].v_spin);
+ mtx_lock(&V_viftable[vifi].v_mtx);
if (in_hosteq(ip->ip_src, V_viftable[vifi].v_lcl_addr)) {
V_viftable[vifi].v_pkt_out++;
V_viftable[vifi].v_bytes_out += plen;
@@ -1667,7 +1667,7 @@
V_viftable[vifi].v_pkt_in++;
V_viftable[vifi].v_bytes_in += plen;
}
- mtx_unlock_spin(&V_viftable[vifi].v_spin);
+ mtx_unlock(&V_viftable[vifi].v_mtx);
rt->mfc_pkt_cnt++;
rt->mfc_byte_cnt += plen;
@@ -1704,14 +1704,14 @@
for (x = rt->mfc_bw_meter_leq; x != NULL; x = x->bm_mfc_next) {
/*
* Record that a packet is received.
- * Spin lock has to be taken as callout context
+ * A lock has to be taken as callout context
* (expire_bw_meter_leq) might modify these fields
* as well
*/
- mtx_lock_spin(&x->bm_spin);
+ mtx_lock(&x->bm_mtx);
x->bm_measured.b_packets++;
x->bm_measured.b_bytes += plen;
- mtx_unlock_spin(&x->bm_spin);
+ mtx_unlock(&x->bm_mtx);
}
}
@@ -1894,13 +1894,14 @@
/* Reset counters */
x->bm_start_time = now;
- /* Spin lock has to be taken as ip_forward context
+ /*
+ * The lock has to be taken as ip_forward context
* might modify these fields as well
*/
- mtx_lock_spin(&x->bm_spin);
+ mtx_lock(&x->bm_mtx);
x->bm_measured.b_bytes = 0;
x->bm_measured.b_packets = 0;
- mtx_unlock_spin(&x->bm_spin);
+ mtx_unlock(&x->bm_mtx);
callout_schedule(&x->bm_meter_callout, tvtohz(&x->bm_threshold.b_time));
@@ -1986,8 +1987,8 @@
x->bm_time_next = NULL;
x->bm_mfc = mfc;
x->arg = curvnet;
- sprintf(x->bm_spin_name, "BM spin %p", x);
- mtx_init(&x->bm_spin, x->bm_spin_name, NULL, MTX_SPIN);
+ sprintf(x->bm_mtx_name, "BM mtx %p", x);
+ mtx_init(&x->bm_mtx, x->bm_mtx_name, NULL, MTX_DEF);
/* For LEQ case create periodic callout */
if (req->bu_flags & BW_UPCALL_LEQ) {
@@ -2014,7 +2015,7 @@
/* MRW_WLOCK must be held here */
if (x->bm_flags & BW_METER_LEQ) {
callout_drain(&x->bm_meter_callout);
- mtx_destroy(&x->bm_spin);
+ mtx_destroy(&x->bm_mtx);
}
list = list->bm_mfc_next;
@@ -2115,7 +2116,7 @@
/*
* Processing for ">=" type of bw_meter entry.
- * bm_spin does not have to be hold here as in GEQ
+ * bm_mtx does not have to be hold here as in GEQ
* case this is the only context accessing bm_measured.
*/
if (BW_TIMEVALCMP(&delta, &x->bm_threshold.b_time, >)) {

File Metadata

Mime Type
text/plain
Expires
Tue, Jan 13, 1:08 PM (3 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
27594364
Default Alt Text
D54603.id169328.diff (4 KB)

Event Timeline