diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2018-04-26 21:58:53 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-27 20:35:22 +0200 |
commit | c4b2893dae6427ce1e528033383c94cbf81e80d8 (patch) | |
tree | f59a37a6fc863c939a09436d92d4f46b1477d1cd /net/sctp/associola.c | |
parent | sctp: remove an if() that is always true (diff) | |
download | linux-c4b2893dae6427ce1e528033383c94cbf81e80d8.tar.xz linux-c4b2893dae6427ce1e528033383c94cbf81e80d8.zip |
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: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index c5ed09cfa842..85b362324084 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c @@ -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 * peer's PMTU, reset the association PMTU to the new peer's PMTU. */ - if (asoc->pathmtu) - asoc->pathmtu = min_t(int, peer->pathmtu, asoc->pathmtu); - else - asoc->pathmtu = peer->pathmtu; - - pr_debug("%s: association:%p PMTU set to %d\n", __func__, asoc, - asoc->pathmtu); + sctp_assoc_set_pmtu(asoc, asoc->pathmtu ? + min_t(int, peer->pathmtu, asoc->pathmtu) : + peer->pathmtu); peer->pmtu_pending = 0; @@ -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 * 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) pmtu = t->pathmtu; } - asoc->pathmtu = pmtu; + sctp_assoc_set_pmtu(asoc, pmtu); asoc->frag_point = sctp_frag_point(asoc, pmtu); pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc, |