summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2003-07-23 14:28:57 +0000
committerharti <harti@FreeBSD.org>2003-07-23 14:28:57 +0000
commitf8b34e3f70219ed6642f2c3ed7430361969ccccf (patch)
tree9fe86b328b35bc3515a752c557d6999aa602cfe7
parent162e49f535eeecc1626f095ecec2e27292d2dd24 (diff)
downloadFreeBSD-src-f8b34e3f70219ed6642f2c3ed7430361969ccccf.zip
FreeBSD-src-f8b34e3f70219ed6642f2c3ed7430361969ccccf.tar.gz
Convert a lot of uma_zalloc() calls to be NOWAIT instead of WAITOK. All
these may be called from contexts where we cannot sleep (callout handlers for example).
-rw-r--r--sys/netatm/atm_cm.c15
-rw-r--r--sys/netatm/atm_device.c3
-rw-r--r--sys/netatm/ipatm/ipatm_vcm.c6
-rw-r--r--sys/netatm/uni/uniarp.c3
-rw-r--r--sys/netatm/uni/uniarp_cache.c3
-rw-r--r--sys/netatm/uni/uniarp_vcm.c6
-rw-r--r--sys/netatm/uni/unisig_decode.c2
-rw-r--r--sys/netatm/uni/unisig_subr.c28
-rw-r--r--sys/netatm/uni/unisig_vc_state.c12
9 files changed, 48 insertions, 30 deletions
diff --git a/sys/netatm/atm_cm.c b/sys/netatm/atm_cm.c
index 733c045..8ca491f 100644
--- a/sys/netatm/atm_cm.c
+++ b/sys/netatm/atm_cm.c
@@ -168,8 +168,9 @@ atm_cm_connect(epp, token, ap, copp)
/*
* Get a connection block
+ * May be called from timeout - don't wait.
*/
- cop = uma_zalloc(atm_connection_zone, M_WAITOK);
+ cop = uma_zalloc(atm_connection_zone, M_NOWAIT);
if (cop == NULL)
return (ENOMEM);
@@ -399,8 +400,9 @@ atm_cm_connect(epp, token, ap, copp)
/*
* Get a connection VCC block
+ * May be called from timeouts - don't wait.
*/
- cvp = uma_zalloc(atm_connvc_zone, M_WAITOK);
+ cvp = uma_zalloc(atm_connvc_zone, M_NOWAIT);
if (cvp == NULL) {
err = ENOMEM;
goto donex;
@@ -809,8 +811,9 @@ atm_cm_addllc(epp, token, llc, ecop, copp)
/*
* Get a connection block
+ * May be called from netisr - don't wait.
*/
- cop = uma_zalloc(atm_connection_zone, M_WAITOK);
+ cop = uma_zalloc(atm_connection_zone, M_NOWAIT);
if (cop == NULL)
return (ENOMEM);
@@ -1260,8 +1263,9 @@ atm_cm_incoming(vcp, ap)
/*
* Get a connection VCC block
+ * May be called from netisr - don't wait.
*/
- cvp = uma_zalloc(atm_connvc_zone, M_WAITOK);
+ cvp = uma_zalloc(atm_connvc_zone, M_NOWAIT);
if (cvp == NULL) {
err = ENOMEM;
goto fail;
@@ -1578,8 +1582,9 @@ atm_cm_incall(cvp)
if (cop == NULL) {
/*
* Need a new connection block
+ * May be called from timeout - dont wait.
*/
- cop = uma_zalloc(atm_connection_zone, M_WAITOK);
+ cop = uma_zalloc(atm_connection_zone, M_NOWAIT);
if (cop == NULL) {
cvp->cvc_attr.cause = atm_cause_tmpl;
cvp->cvc_attr.cause.v.cause_value =
diff --git a/sys/netatm/atm_device.c b/sys/netatm/atm_device.c
index 34d4ffb..d3bc45b 100644
--- a/sys/netatm/atm_device.c
+++ b/sys/netatm/atm_device.c
@@ -163,8 +163,9 @@ atm_dev_inst(ssp, cvcp)
/*
* Allocate a VCC control block
+ * This can happen from a callout so don't wait here.
*/
- cvp = uma_zalloc(cup->cu_vcc_zone, M_WAITOK);
+ cvp = uma_zalloc(cup->cu_vcc_zone, M_NOWAIT);
if (cvp == NULL)
return (ENOMEM);
diff --git a/sys/netatm/ipatm/ipatm_vcm.c b/sys/netatm/ipatm/ipatm_vcm.c
index 35744cb..a14f1f1 100644
--- a/sys/netatm/ipatm/ipatm_vcm.c
+++ b/sys/netatm/ipatm/ipatm_vcm.c
@@ -578,8 +578,9 @@ ipatm_createsvc(ifp, daf, dst, sivp)
/*
* Allocate IP VCC
+ * May be called from timeout - don't wait.
*/
- ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK);
+ ivp = uma_zalloc(ipatm_vc_zone, M_NOWAIT);
if (ivp == NULL) {
err = ENOMEM;
goto done;
@@ -930,8 +931,9 @@ ipatm_incoming(tok, cop, ap, tokp)
/*
* Allocate IP VCC
+ * May be called from timeout - don't wait.
*/
- ivp = uma_zalloc(ipatm_vc_zone, M_WAITOK);
+ ivp = uma_zalloc(ipatm_vc_zone, M_NOWAIT);
if (ivp == NULL) {
err = ENOMEM;
cause = T_ATM_CAUSE_UNSPECIFIED_RESOURCE_UNAVAILABLE;
diff --git a/sys/netatm/uni/uniarp.c b/sys/netatm/uni/uniarp.c
index a34c31e..843bc4a 100644
--- a/sys/netatm/uni/uniarp.c
+++ b/sys/netatm/uni/uniarp.c
@@ -703,9 +703,10 @@ uniarp_client_mode(uip, aap)
/*
* Now, get an arp entry for the server connection
+ * May be called from timeout - don't wait.
*/
uip->uip_arpstate = UIAS_CLIENT_POPEN;
- uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO);
+ uap = uma_zalloc(uniarp_zone, M_NOWAIT | M_ZERO);
if (uap == NULL) {
UNIIP_ARP_TIMER(uip, 1 * ATM_HZ);
return;
diff --git a/sys/netatm/uni/uniarp_cache.c b/sys/netatm/uni/uniarp_cache.c
index 3e28912..10b7118 100644
--- a/sys/netatm/uni/uniarp_cache.c
+++ b/sys/netatm/uni/uniarp_cache.c
@@ -117,9 +117,10 @@ uniarp_cache_svc(uip, ip, atm, atmsub, origin)
/*
* If there aren't any entries yet, create one
+ * May be called from netisr - don't wait.
*/
if ((ipuap == NULL) && (nouap == NULL)) {
- ipuap = uma_zalloc(uniarp_zone, M_WAITOK);
+ ipuap = uma_zalloc(uniarp_zone, M_NOWAIT);
if (ipuap == NULL)
return (ENOMEM);
ipuap->ua_dstip.s_addr = ip->s_addr;
diff --git a/sys/netatm/uni/uniarp_vcm.c b/sys/netatm/uni/uniarp_vcm.c
index 0e09adb..3a2bc8a 100644
--- a/sys/netatm/uni/uniarp_vcm.c
+++ b/sys/netatm/uni/uniarp_vcm.c
@@ -272,8 +272,9 @@ uniarp_svcout(ivp, dst)
/*
* We're a client with an open VCC to the server, get a new arp entry
+ * May be called from timeout - don't wait.
*/
- uap = uma_zalloc(uniarp_zone, M_WAITOK);
+ uap = uma_zalloc(uniarp_zone, M_NOWAIT);
if (uap == NULL) {
(void) splx(s);
return (MAP_FAILED);
@@ -433,8 +434,9 @@ uniarp_svcin(ivp, dst, dstsub)
/*
* No info in the cache - get a new arp entry
+ * May be called from timeout - don't wait.
*/
- uap = uma_zalloc(uniarp_zone, M_WAITOK | M_ZERO);
+ uap = uma_zalloc(uniarp_zone, M_NOWAIT | M_ZERO);
if (uap == NULL) {
(void) splx(s);
return (MAP_FAILED);
diff --git a/sys/netatm/uni/unisig_decode.c b/sys/netatm/uni/unisig_decode.c
index 676be2e..3f7f304 100644
--- a/sys/netatm/uni/unisig_decode.c
+++ b/sys/netatm/uni/unisig_decode.c
@@ -61,7 +61,7 @@ __FBSDID("$FreeBSD$");
#include <netatm/uni/unisig_decode.h>
#define ALLOC_IE(ie) do { \
- (ie) = uma_zalloc(unisig_ie_zone, M_WAITOK | M_ZERO); \
+ (ie) = uma_zalloc(unisig_ie_zone, M_NOWAIT | M_ZERO); \
if ((ie) == NULL) \
return (ENOMEM); \
} while (0)
diff --git a/sys/netatm/uni/unisig_subr.c b/sys/netatm/uni/unisig_subr.c
index dfcb0a8..f2b4c3c 100644
--- a/sys/netatm/uni/unisig_subr.c
+++ b/sys/netatm/uni/unisig_subr.c
@@ -267,8 +267,9 @@ unisig_open_vcc(usp, cvp)
/*
* Allocate control block for VCC
+ * May be called from timeout - don't wait.
*/
- uvp = uma_zalloc(unisig_vc_zone, M_WAITOK | M_ZERO);
+ uvp = uma_zalloc(unisig_vc_zone, M_NOWAIT | M_ZERO);
if (uvp == NULL) {
return(ENOMEM);
}
@@ -869,6 +870,7 @@ unisig_save_attrs(usp, msg, ap)
* 0 everything OK
* else error encountered
*
+ * May be called from timeout so make allocations non-waiting
*/
int
unisig_set_attrs(usp, msg, ap)
@@ -890,7 +892,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->aal.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_aalp) {
msg->msg_ie_aalp = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_aalp == NULL) {
err = ENOMEM;
goto done;
@@ -948,7 +950,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->traffic.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_clrt) {
msg->msg_ie_clrt = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_clrt == NULL) {
err = ENOMEM;
goto done;
@@ -1005,7 +1007,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->bearer.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_bbcp) {
msg->msg_ie_bbcp = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_bbcp == NULL) {
err = ENOMEM;
goto done;
@@ -1033,7 +1035,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->bhli.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_bhli) {
msg->msg_ie_bhli = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_bhli == NULL) {
err = ENOMEM;
goto done;
@@ -1073,7 +1075,7 @@ unisig_set_attrs(usp, msg, ap)
ap->blli.tag_l3 == T_ATM_PRESENT) {
if (!msg->msg_ie_blli) {
msg->msg_ie_blli = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_blli == NULL) {
err = ENOMEM;
goto done;
@@ -1158,7 +1160,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->called.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_cdad) {
msg->msg_ie_cdad = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_cdad == NULL) {
err = ENOMEM;
goto done;
@@ -1174,7 +1176,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->called.subaddr.address_format != T_ATM_ABSENT) {
if (!msg->msg_ie_cdsa) {
msg->msg_ie_cdsa = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_cdsa == NULL) {
err = ENOMEM;
goto done;
@@ -1196,7 +1198,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->calling.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_cgad) {
msg->msg_ie_cgad = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_cgad == NULL) {
err = ENOMEM;
goto done;
@@ -1213,7 +1215,7 @@ unisig_set_attrs(usp, msg, ap)
T_ATM_ABSENT) {
if (!msg->msg_ie_cgsa) {
msg->msg_ie_cgsa = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_cgsa == NULL) {
err = ENOMEM;
goto done;
@@ -1234,7 +1236,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->qos.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_qosp) {
msg->msg_ie_qosp = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_qosp == NULL) {
err = ENOMEM;
goto done;
@@ -1266,7 +1268,7 @@ unisig_set_attrs(usp, msg, ap)
ap->transit.v.length != 0) {
if (!msg->msg_ie_trnt) {
msg->msg_ie_trnt = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_trnt == NULL) {
err = ENOMEM;
goto done;
@@ -1291,7 +1293,7 @@ unisig_set_attrs(usp, msg, ap)
if (ap->cause.tag == T_ATM_PRESENT) {
if (!msg->msg_ie_caus) {
msg->msg_ie_caus = uma_zalloc(unisig_ie_zone,
- M_WAITOK | M_ZERO);
+ M_NOWAIT | M_ZERO);
if (msg->msg_ie_caus == NULL) {
err = ENOMEM;
goto done;
diff --git a/sys/netatm/uni/unisig_vc_state.c b/sys/netatm/uni/unisig_vc_state.c
index 50eb474..81ff8fc 100644
--- a/sys/netatm/uni/unisig_vc_state.c
+++ b/sys/netatm/uni/unisig_vc_state.c
@@ -659,9 +659,10 @@ unisig_vc_act06(usp, uvp, msg)
} else {
/*
* No--VCI must have been specified earlier
+ * May be called from netisr - don't wait.
*/
if (!uvp->uv_vci) {
- iep = uma_zalloc(unisig_ie_zone, M_WAITOK);
+ iep = uma_zalloc(unisig_ie_zone, M_NOWAIT);
if (iep == NULL)
return(ENOMEM);
iep->ie_ident = UNI_IE_CNID;
@@ -734,8 +735,9 @@ unisig_vc_act06(usp, uvp, msg)
/*
* Get memory for a CONNECT ACK message
+ * May be called from netisr.
*/
- cack_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
+ cack_msg = uma_zalloc(unisig_msg_zone, M_NOWAIT);
if (cack_msg == NULL)
return(ENOMEM);
@@ -1051,7 +1053,8 @@ unisig_vc_act09(usp, uvp, msg)
int rc;
struct unisig_msg *conn_msg;
- conn_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
+ /* may be called from timeout - don't wait */
+ conn_msg = uma_zalloc(unisig_msg_zone, M_NOWAIT);
if (conn_msg == NULL)
return(ENOMEM);
@@ -1603,8 +1606,9 @@ unisig_vc_act20(usp, uvp, msg)
/*
* Get memory for a STATUS ENQUIRY message
+ * May be called from netisr - don't wait.
*/
- stat_msg = uma_zalloc(unisig_msg_zone, M_WAITOK);
+ stat_msg = uma_zalloc(unisig_msg_zone, M_NOWAIT);
if (stat_msg == NULL)
return(ENOMEM);
OpenPOWER on IntegriCloud