Commit c4b2893d authored by Marcelo Ricardo Leitner's avatar Marcelo Ricardo Leitner Committed by David S. Miller

sctp: introduce sctp_assoc_set_pmtu

All changes to asoc PMTU should now go through this wrapper, making it
easier to track them and to do other actions upon it.
Signed-off-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c88da20f
...@@ -2097,6 +2097,7 @@ int sctp_assoc_update(struct sctp_association *old, ...@@ -2097,6 +2097,7 @@ int sctp_assoc_update(struct sctp_association *old,
__u32 sctp_association_get_next_tsn(struct sctp_association *); __u32 sctp_association_get_next_tsn(struct sctp_association *);
void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu);
void sctp_assoc_sync_pmtu(struct sctp_association *asoc); void sctp_assoc_sync_pmtu(struct sctp_association *asoc);
void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int);
void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int);
......
...@@ -660,13 +660,9 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc, ...@@ -660,13 +660,9 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
* If not and the current association PMTU is higher than the new * If not and the current association PMTU is higher than the new
* peer's PMTU, reset the association PMTU to the new peer's PMTU. * peer's PMTU, reset the association PMTU to the new peer's PMTU.
*/ */
if (asoc->pathmtu) sctp_assoc_set_pmtu(asoc, asoc->pathmtu ?
asoc->pathmtu = min_t(int, peer->pathmtu, asoc->pathmtu); min_t(int, peer->pathmtu, asoc->pathmtu) :
else peer->pathmtu);
asoc->pathmtu = peer->pathmtu;
pr_debug("%s: association:%p PMTU set to %d\n", __func__, asoc,
asoc->pathmtu);
peer->pmtu_pending = 0; peer->pmtu_pending = 0;
...@@ -1374,6 +1370,15 @@ sctp_assoc_choose_alter_transport(struct sctp_association *asoc, ...@@ -1374,6 +1370,15 @@ sctp_assoc_choose_alter_transport(struct sctp_association *asoc,
} }
} }
void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu)
{
if (asoc->pathmtu != pmtu)
asoc->pathmtu = pmtu;
pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc,
asoc->pathmtu, asoc->frag_point);
}
/* Update the association's pmtu and frag_point by going through all the /* Update the association's pmtu and frag_point by going through all the
* transports. This routine is called when a transport's PMTU has changed. * transports. This routine is called when a transport's PMTU has changed.
*/ */
...@@ -1397,7 +1402,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc) ...@@ -1397,7 +1402,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
pmtu = t->pathmtu; pmtu = t->pathmtu;
} }
asoc->pathmtu = pmtu; sctp_assoc_set_pmtu(asoc, pmtu);
asoc->frag_point = sctp_frag_point(asoc, pmtu); asoc->frag_point = sctp_frag_point(asoc, pmtu);
pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc, pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc,
......
...@@ -2539,7 +2539,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, ...@@ -2539,7 +2539,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params,
trans->pathmtu = params->spp_pathmtu; trans->pathmtu = params->spp_pathmtu;
sctp_assoc_sync_pmtu(asoc); sctp_assoc_sync_pmtu(asoc);
} else if (asoc) { } else if (asoc) {
asoc->pathmtu = params->spp_pathmtu; sctp_assoc_set_pmtu(asoc, params->spp_pathmtu);
} else { } else {
sp->pathmtu = params->spp_pathmtu; sp->pathmtu = params->spp_pathmtu;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment