Call m_snd_tag_rele() to free send tags.
Send tags are refcounted and if_snd_tag_free() is called by m_snd_tag_rele() when the last reference is dropped on a send tag. Reviewed by: gallatin, hselasky Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D26995
This commit is contained in:
parent
7552deb2a0
commit
98d7a8d9cd
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367148
@ -3347,20 +3347,10 @@ in_pcbattach_txrtlmt(struct inpcb *inp, struct ifnet *ifp,
|
||||
}
|
||||
|
||||
void
|
||||
in_pcbdetach_tag(struct ifnet *ifp, struct m_snd_tag *mst)
|
||||
in_pcbdetach_tag(struct m_snd_tag *mst)
|
||||
{
|
||||
if (ifp == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* If the device was detached while we still had reference(s)
|
||||
* on the ifp, we assume if_snd_tag_free() was replaced with
|
||||
* stubs.
|
||||
*/
|
||||
ifp->if_snd_tag_free(mst);
|
||||
|
||||
/* release reference count on network interface */
|
||||
if_rele(ifp);
|
||||
m_snd_tag_rele(mst);
|
||||
#ifdef INET
|
||||
counter_u64_add(rate_limit_active, -1);
|
||||
#endif
|
||||
|
@ -884,7 +884,7 @@ in_pcboutput_txrtlmt_locked(struct inpcb *, struct ifnet *,
|
||||
int in_pcbattach_txrtlmt(struct inpcb *, struct ifnet *, uint32_t, uint32_t,
|
||||
uint32_t, struct m_snd_tag **);
|
||||
void in_pcbdetach_txrtlmt(struct inpcb *);
|
||||
void in_pcbdetach_tag(struct ifnet *ifp, struct m_snd_tag *mst);
|
||||
void in_pcbdetach_tag(struct m_snd_tag *);
|
||||
int in_pcbmodify_txrtlmt(struct inpcb *, uint32_t);
|
||||
int in_pcbquery_txrtlmt(struct inpcb *, uint32_t *);
|
||||
int in_pcbquery_txrlevel(struct inpcb *, uint32_t *);
|
||||
|
@ -1028,7 +1028,7 @@ rt_find_real_interface(struct ifnet *ifp, struct inpcb *inp, int *error)
|
||||
return (NULL);
|
||||
}
|
||||
tifp = tag->ifp;
|
||||
tifp->if_snd_tag_free(tag);
|
||||
m_snd_tag_rele(tag);
|
||||
return (tifp);
|
||||
}
|
||||
|
||||
@ -1161,7 +1161,6 @@ static void
|
||||
tcp_rl_ifnet_departure(void *arg __unused, struct ifnet *ifp)
|
||||
{
|
||||
struct tcp_rate_set *rs, *nrs;
|
||||
struct ifnet *tifp;
|
||||
int i;
|
||||
|
||||
mtx_lock(&rs_mtx);
|
||||
@ -1173,8 +1172,7 @@ tcp_rl_ifnet_departure(void *arg __unused, struct ifnet *ifp)
|
||||
rs->rs_flags |= RS_IS_DEAD;
|
||||
for (i = 0; i < rs->rs_rate_cnt; i++) {
|
||||
if (rs->rs_rlt[i].flags & HDWRPACE_TAGPRESENT) {
|
||||
tifp = rs->rs_rlt[i].tag->ifp;
|
||||
in_pcbdetach_tag(tifp, rs->rs_rlt[i].tag);
|
||||
in_pcbdetach_tag(rs->rs_rlt[i].tag);
|
||||
rs->rs_rlt[i].tag = NULL;
|
||||
}
|
||||
rs->rs_rlt[i].flags = HDWRPACE_IFPDEPARTED;
|
||||
@ -1191,7 +1189,6 @@ static void
|
||||
tcp_rl_shutdown(void *arg __unused, int howto __unused)
|
||||
{
|
||||
struct tcp_rate_set *rs, *nrs;
|
||||
struct ifnet *tifp;
|
||||
int i;
|
||||
|
||||
mtx_lock(&rs_mtx);
|
||||
@ -1201,8 +1198,7 @@ tcp_rl_shutdown(void *arg __unused, int howto __unused)
|
||||
rs->rs_flags |= RS_IS_DEAD;
|
||||
for (i = 0; i < rs->rs_rate_cnt; i++) {
|
||||
if (rs->rs_rlt[i].flags & HDWRPACE_TAGPRESENT) {
|
||||
tifp = rs->rs_rlt[i].tag->ifp;
|
||||
in_pcbdetach_tag(tifp, rs->rs_rlt[i].tag);
|
||||
in_pcbdetach_tag(rs->rs_rlt[i].tag);
|
||||
rs->rs_rlt[i].tag = NULL;
|
||||
}
|
||||
rs->rs_rlt[i].flags = HDWRPACE_IFPDEPARTED;
|
||||
|
Loading…
Reference in New Issue
Block a user