diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2018-04-26 15:58:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-04-27 14:35:22 -0400 |
commit | c4b2893dae6427ce1e528033383c94cbf81e80d8 (patch) | |
tree | f59a37a6fc863c939a09436d92d4f46b1477d1cd | |
parent | c88da20f95ad0bfa49e3e9035c26aaac0b05d11d (diff) |
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>
-rw-r--r-- | include/net/sctp/structs.h | 1 | ||||
-rw-r--r-- | net/sctp/associola.c | 21 | ||||
-rw-r--r-- | net/sctp/socket.c | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h index 05594b248e52..c5e244be8f1e 100644 --- a/include/net/sctp/structs.h +++ b/include/net/sctp/structs.h | |||
@@ -2097,6 +2097,7 @@ int sctp_assoc_update(struct sctp_association *old, | |||
2097 | 2097 | ||
2098 | __u32 sctp_association_get_next_tsn(struct sctp_association *); | 2098 | __u32 sctp_association_get_next_tsn(struct sctp_association *); |
2099 | 2099 | ||
2100 | void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu); | ||
2100 | void sctp_assoc_sync_pmtu(struct sctp_association *asoc); | 2101 | void sctp_assoc_sync_pmtu(struct sctp_association *asoc); |
2101 | void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); | 2102 | void sctp_assoc_rwnd_increase(struct sctp_association *, unsigned int); |
2102 | void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); | 2103 | void sctp_assoc_rwnd_decrease(struct sctp_association *, unsigned int); |
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, | |||
660 | * If not and the current association PMTU is higher than the new | 660 | * If not and the current association PMTU is higher than the new |
661 | * peer's PMTU, reset the association PMTU to the new peer's PMTU. | 661 | * peer's PMTU, reset the association PMTU to the new peer's PMTU. |
662 | */ | 662 | */ |
663 | if (asoc->pathmtu) | 663 | sctp_assoc_set_pmtu(asoc, asoc->pathmtu ? |
664 | asoc->pathmtu = min_t(int, peer->pathmtu, asoc->pathmtu); | 664 | min_t(int, peer->pathmtu, asoc->pathmtu) : |
665 | else | 665 | peer->pathmtu); |
666 | asoc->pathmtu = peer->pathmtu; | ||
667 | |||
668 | pr_debug("%s: association:%p PMTU set to %d\n", __func__, asoc, | ||
669 | asoc->pathmtu); | ||
670 | 666 | ||
671 | peer->pmtu_pending = 0; | 667 | peer->pmtu_pending = 0; |
672 | 668 | ||
@@ -1374,6 +1370,15 @@ sctp_assoc_choose_alter_transport(struct sctp_association *asoc, | |||
1374 | } | 1370 | } |
1375 | } | 1371 | } |
1376 | 1372 | ||
1373 | void sctp_assoc_set_pmtu(struct sctp_association *asoc, __u32 pmtu) | ||
1374 | { | ||
1375 | if (asoc->pathmtu != pmtu) | ||
1376 | asoc->pathmtu = pmtu; | ||
1377 | |||
1378 | pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc, | ||
1379 | asoc->pathmtu, asoc->frag_point); | ||
1380 | } | ||
1381 | |||
1377 | /* Update the association's pmtu and frag_point by going through all the | 1382 | /* Update the association's pmtu and frag_point by going through all the |
1378 | * transports. This routine is called when a transport's PMTU has changed. | 1383 | * transports. This routine is called when a transport's PMTU has changed. |
1379 | */ | 1384 | */ |
@@ -1397,7 +1402,7 @@ void sctp_assoc_sync_pmtu(struct sctp_association *asoc) | |||
1397 | pmtu = t->pathmtu; | 1402 | pmtu = t->pathmtu; |
1398 | } | 1403 | } |
1399 | 1404 | ||
1400 | asoc->pathmtu = pmtu; | 1405 | sctp_assoc_set_pmtu(asoc, pmtu); |
1401 | asoc->frag_point = sctp_frag_point(asoc, pmtu); | 1406 | asoc->frag_point = sctp_frag_point(asoc, pmtu); |
1402 | 1407 | ||
1403 | pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc, | 1408 | pr_debug("%s: asoc:%p, pmtu:%d, frag_point:%d\n", __func__, asoc, |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 80835ac26d2c..eeec81d5c485 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -2539,7 +2539,7 @@ static int sctp_apply_peer_addr_params(struct sctp_paddrparams *params, | |||
2539 | trans->pathmtu = params->spp_pathmtu; | 2539 | trans->pathmtu = params->spp_pathmtu; |
2540 | sctp_assoc_sync_pmtu(asoc); | 2540 | sctp_assoc_sync_pmtu(asoc); |
2541 | } else if (asoc) { | 2541 | } else if (asoc) { |
2542 | asoc->pathmtu = params->spp_pathmtu; | 2542 | sctp_assoc_set_pmtu(asoc, params->spp_pathmtu); |
2543 | } else { | 2543 | } else { |
2544 | sp->pathmtu = params->spp_pathmtu; | 2544 | sp->pathmtu = params->spp_pathmtu; |
2545 | } | 2545 | } |