svn commit: r291822 - in projects/hps_head/sys: dev/oce kern net netgraph netinet netinet6 netpfil/pf
Hans Petter Selasky
hselasky at FreeBSD.org
Fri Dec 4 20:12:51 UTC 2015
Author: hselasky
Date: Fri Dec 4 20:12:49 2015
New Revision: 291822
URL: https://svnweb.freebsd.org/changeset/base/291822
Log:
Check the return values from callout_reset() and callout_stop() in a
more proper and readable way. This also fixes a bug in the ARP timer
code and in the OCE driver.
Modified:
projects/hps_head/sys/dev/oce/oce_if.c
projects/hps_head/sys/kern/subr_taskqueue.c
projects/hps_head/sys/net/if_llatbl.c
projects/hps_head/sys/netgraph/ng_base.c
projects/hps_head/sys/netinet/if_ether.c
projects/hps_head/sys/netinet/in.c
projects/hps_head/sys/netinet6/in6.c
projects/hps_head/sys/netinet6/nd6.c
projects/hps_head/sys/netpfil/pf/if_pfsync.c
Modified: projects/hps_head/sys/dev/oce/oce_if.c
==============================================================================
--- projects/hps_head/sys/dev/oce/oce_if.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/dev/oce/oce_if.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -343,7 +343,7 @@ oce_attach(device_t dev)
callout_init(&sc->timer, 1);
rc = callout_reset(&sc->timer, 2 * hz, oce_local_timer, sc);
- if (rc)
+ if (rc == CALLOUT_RET_CANCELLED)
goto stats_free;
return 0;
Modified: projects/hps_head/sys/kern/subr_taskqueue.c
==============================================================================
--- projects/hps_head/sys/kern/subr_taskqueue.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/kern/subr_taskqueue.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -496,7 +496,7 @@ taskqueue_cancel_timeout(struct taskqueu
int error;
TQ_LOCK(queue);
- pending = !!(callout_stop(&timeout_task->c) > 0);
+ pending = (callout_stop(&timeout_task->c) == CALLOUT_RET_CANCELLED) ? 1 : 0;
error = taskqueue_cancel_locked(queue, &timeout_task->t, &pending1);
if ((timeout_task->f & DT_CALLOUT_ARMED) != 0) {
timeout_task->f &= ~DT_CALLOUT_ARMED;
Modified: projects/hps_head/sys/net/if_llatbl.c
==============================================================================
--- projects/hps_head/sys/net/if_llatbl.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/net/if_llatbl.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -394,7 +394,7 @@ lltable_free(struct lltable *llt)
IF_AFDATA_WUNLOCK(llt->llt_ifp);
LIST_FOREACH_SAFE(lle, &dchain, lle_chain, next) {
- if (callout_stop(&lle->lle_timer) > 0)
+ if (callout_stop(&lle->lle_timer) == CALLOUT_RET_CANCELLED)
LLE_REMREF(lle);
llentry_free(lle);
}
Modified: projects/hps_head/sys/netgraph/ng_base.c
==============================================================================
--- projects/hps_head/sys/netgraph/ng_base.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/netgraph/ng_base.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -3813,7 +3813,8 @@ ng_uncallout(struct callout *c, node_p n
rval = callout_stop(c);
item = c->c_arg;
/* Do an extra check */
- if ((rval > 0) && (c->c_func == &ng_callout_trampoline) &&
+ if ((rval == CALLOUT_RET_CANCELLED) &&
+ (c->c_func == &ng_callout_trampoline) &&
(NGI_NODE(item) == node)) {
/*
* We successfully removed it from the queue before it ran
Modified: projects/hps_head/sys/netinet/if_ether.c
==============================================================================
--- projects/hps_head/sys/netinet/if_ether.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/netinet/if_ether.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -420,7 +420,7 @@ arpresolve_full(struct ifnet *ifp, int i
la->la_expire = time_uptime;
canceled = callout_reset(&la->lle_timer, hz * V_arpt_down,
arptimer, la);
- if (canceled)
+ if (canceled == CALLOUT_RET_CANCELLED)
LLE_REMREF(la);
la->la_asked++;
LLE_WUNLOCK(la);
@@ -1084,7 +1084,7 @@ arp_mark_lle_reachable(struct llentry *l
la->la_expire = time_uptime + V_arpt_keep;
canceled = callout_reset(&la->lle_timer,
hz * V_arpt_keep, arptimer, la);
- if (canceled)
+ if (canceled == CALLOUT_RET_CANCELLED)
LLE_REMREF(la);
}
la->la_asked = 0;
Modified: projects/hps_head/sys/netinet/in.c
==============================================================================
--- projects/hps_head/sys/netinet/in.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/netinet/in.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -1093,7 +1093,7 @@ in_lltable_free_entry(struct lltable *ll
}
/* cancel timer */
- if (callout_stop(&lle->lle_timer) > 0)
+ if (callout_stop(&lle->lle_timer) == CALLOUT_RET_CANCELLED)
LLE_REMREF(lle);
/* Drop hold queue */
Modified: projects/hps_head/sys/netinet6/in6.c
==============================================================================
--- projects/hps_head/sys/netinet6/in6.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/netinet6/in6.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -2133,7 +2133,7 @@ in6_lltable_free_entry(struct lltable *l
lltable_unlink_entry(llt, lle);
}
- if (callout_stop(&lle->lle_timer) > 0)
+ if (callout_stop(&lle->lle_timer) == CALLOUT_RET_CANCELLED)
LLE_REMREF(lle);
llentry_free(lle);
Modified: projects/hps_head/sys/netinet6/nd6.c
==============================================================================
--- projects/hps_head/sys/netinet6/nd6.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/netinet6/nd6.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -508,7 +508,7 @@ nd6_llinfo_settimer_locked(struct llentr
nd6_llinfo_timer, ln);
}
}
- if (canceled > 0)
+ if (canceled == CALLOUT_RET_CANCELLED)
LLE_REMREF(ln);
}
Modified: projects/hps_head/sys/netpfil/pf/if_pfsync.c
==============================================================================
--- projects/hps_head/sys/netpfil/pf/if_pfsync.c Fri Dec 4 19:46:49 2015 (r291821)
+++ projects/hps_head/sys/netpfil/pf/if_pfsync.c Fri Dec 4 20:12:49 2015 (r291822)
@@ -352,7 +352,7 @@ pfsync_clone_destroy(struct ifnet *ifp)
TAILQ_REMOVE(&sc->sc_deferrals, pd, pd_entry);
sc->sc_deferred--;
- if (callout_stop(&pd->pd_tmo) > 0) {
+ if (callout_stop(&pd->pd_tmo) == CALLOUT_RET_CANCELLED) {
pf_release_state(pd->pd_st);
m_freem(pd->pd_m);
free(pd, M_PFSYNC);
@@ -1775,7 +1775,7 @@ pfsync_undefer_state(struct pf_state *st
TAILQ_FOREACH(pd, &sc->sc_deferrals, pd_entry) {
if (pd->pd_st == st) {
- if (callout_stop(&pd->pd_tmo) > 0)
+ if (callout_stop(&pd->pd_tmo) == CALLOUT_RET_CANCELLED)
pfsync_undefer(pd, drop);
return;
}
More information about the svn-src-projects
mailing list