diff options
Diffstat (limited to 'sys/netgraph/netflow/ng_netflow.c')
-rw-r--r-- | sys/netgraph/netflow/ng_netflow.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sys/netgraph/netflow/ng_netflow.c b/sys/netgraph/netflow/ng_netflow.c index 4cf453c..7b23e61 100644 --- a/sys/netgraph/netflow/ng_netflow.c +++ b/sys/netgraph/netflow/ng_netflow.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/systm.h> +#include <sys/counter.h> #include <sys/kernel.h> #include <sys/limits.h> #include <sys/mbuf.h> @@ -250,8 +251,8 @@ ng_netflow_constructor(node_p node) priv->node = node; /* Initialize timeouts to default values */ - priv->info.nfinfo_inact_t = INACTIVE_TIMEOUT; - priv->info.nfinfo_act_t = ACTIVE_TIMEOUT; + priv->nfinfo_inact_t = INACTIVE_TIMEOUT; + priv->nfinfo_act_t = ACTIVE_TIMEOUT; /* Set default config */ for (i = 0; i < NG_NETFLOW_MAXIFACES; i++) @@ -475,8 +476,8 @@ ng_netflow_rcvmsg (node_p node, item_p item, hook_p lasthook) set = (struct ng_netflow_settimeouts *)msg->data; - priv->info.nfinfo_inact_t = set->inactive_timeout; - priv->info.nfinfo_act_t = set->active_timeout; + priv->nfinfo_inact_t = set->inactive_timeout; + priv->nfinfo_act_t = set->active_timeout; break; } @@ -895,7 +896,7 @@ loopend: #endif /* Just in case of real reallocation in M_CHECK() / m_pullup() */ if (m != m_old) { - atomic_fetchadd_32(&priv->info.nfinfo_realloc_mbuf, 1); + priv->nfinfo_realloc_mbuf++; /* Restore ip/ipv6 pointer */ if (ip != NULL) ip = (struct ip *)(mtod(m, caddr_t) + l3_off); @@ -949,13 +950,13 @@ bypass: if (acct == 0) { /* Accounting failure */ if (ip != NULL) { - atomic_fetchadd_32(&priv->info.nfinfo_spackets, - 1); - priv->info.nfinfo_sbytes += m_length(m, NULL); + counter_u64_add(priv->nfinfo_spackets, 1); + counter_u64_add(priv->nfinfo_sbytes, + m->m_pkthdr.len); } else if (ip6 != NULL) { - atomic_fetchadd_32(&priv->info.nfinfo_spackets6, - 1); - priv->info.nfinfo_sbytes6 += m_length(m, NULL); + counter_u64_add(priv->nfinfo_spackets6, 1); + counter_u64_add(priv->nfinfo_sbytes6, + m->m_pkthdr.len); } } |