Fix !INET build.

This commit is contained in:
Xin LI 2019-08-02 22:43:09 +00:00
parent 072a067fb8
commit 903c4ee6ec
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350547
2 changed files with 10 additions and 0 deletions

View File

@ -3296,11 +3296,13 @@ in_pcbattach_txrtlmt(struct inpcb *inp, struct ifnet *ifp,
} else {
error = ifp->if_snd_tag_alloc(ifp, &params, &inp->inp_snd_tag);
#ifdef INET
if (error == 0) {
counter_u64_add(rate_limit_set_ok, 1);
counter_u64_add(rate_limit_active, 1);
} else
counter_u64_add(rate_limit_alloc_fail, 1);
#endif
}
return (error);
}
@ -3320,7 +3322,9 @@ in_pcbdetach_tag(struct ifnet *ifp, struct m_snd_tag *mst)
/* release reference count on network interface */
if_rele(ifp);
#ifdef INET
counter_u64_add(rate_limit_active, -1);
#endif
}
/*
@ -3479,6 +3483,7 @@ in_pcboutput_eagain(struct inpcb *inp)
INP_DOWNGRADE(inp);
}
#ifdef INET
static void
rl_init(void *st)
{
@ -3488,4 +3493,5 @@ rl_init(void *st)
}
SYSINIT(rl, SI_SUB_PROTO_DOMAININIT, SI_ORDER_ANY, rl_init, NULL);
#endif
#endif /* RATELIMIT */

View File

@ -270,9 +270,11 @@ rs_destroy(epoch_context_t ctx)
}
#ifdef INET
extern counter_u64_t rate_limit_set_ok;
extern counter_u64_t rate_limit_active;
extern counter_u64_t rate_limit_alloc_fail;
#endif
static int
rl_attach_txrtlmt(struct ifnet *ifp,
@ -294,12 +296,14 @@ rl_attach_txrtlmt(struct ifnet *ifp,
error = EOPNOTSUPP;
} else {
error = ifp->if_snd_tag_alloc(ifp, &params, tag);
#ifdef INET
if (error == 0) {
if_ref((*tag)->ifp);
counter_u64_add(rate_limit_set_ok, 1);
counter_u64_add(rate_limit_active, 1);
} else
counter_u64_add(rate_limit_alloc_fail, 1);
#endif
}
return (error);
}