Skip to content

Commit b87641a

Browse files
lxindavem330
authored andcommitted
sctp: do state transition when a probe succeeds on HB ACK recv path
As described in rfc8899#section-5.2, when a probe succeeds, there might be the following state transitions: - Base -> Search, occurs when probe succeeds with BASE_PLPMTU, pl.pmtu is not changing, pl.probe_size increases by SCTP_PL_BIG_STEP, - Error -> Search, occurs when probe succeeds with BASE_PLPMTU, pl.pmtu is changed from SCTP_MIN_PLPMTU to SCTP_BASE_PLPMTU, pl.probe_size increases by SCTP_PL_BIG_STEP. - Search -> Search Complete, occurs when probe succeeds with the probe size SCTP_MAX_PLPMTU less than pl.probe_high, pl.pmtu is not changing, but update *pathmtu* with it, pl.probe_size is set back to pl.pmtu to double check it. - Search Complete -> Search, occurs when probe succeeds with the probe size equal to pl.pmtu, pl.pmtu is not changing, pl.probe_size increases by SCTP_PL_MIN_STEP. So search process can be described as: 1. When it just enters 'Search' state, *pathmtu* is not updated with pl.pmtu, and probe_size increases by a big step (SCTP_PL_BIG_STEP) each round. 2. Until pl.probe_high is set when a probe fails, and probe_size decreases back to pl.pmtu, as described in the last patch. 3. When the probe with the new size succeeds, probe_size changes to increase by a small step (SCTP_PL_MIN_STEP) due to pl.probe_high is set. 4. Until probe_size is next to pl.probe_high, the searching finishes and it goes to 'Complete' state and updates *pathmtu* with pl.pmtu, and then probe_size is set to pl.pmtu to confirm by once more probe. 5. This probe occurs after "30 * probe_inteval", a much longer time than that in Search state. Once it is done it goes to 'Search' state again with probe_size increased by SCTP_PL_MIN_STEP. As we can see above, during the searching, pl.pmtu changes while *pathmtu* doesn't. *pathmtu* is only updated when the search finishes by which it gets an optimal value for it. A big step is used at the beginning until it gets close to the optimal value, then it changes to a small step until it has this optimal value. The small step is also used in 'Complete' until it goes to 'Search' state again and the probe with 'pmtu + the small step' succeeds, which means a higher size could be used. Then probe_size changes to increase by a big step again until it gets close to the next optimal value. Note that anytime when black hole is detected, it goes directly to 'Base' state with pl.pmtu set to SCTP_BASE_PLPMTU, as described in the last patch. Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 1dc68c1 commit b87641a

File tree

3 files changed

+40
-1
lines changed

3 files changed

+40
-1
lines changed

include/net/sctp/structs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,7 @@ void sctp_transport_immediate_rtx(struct sctp_transport *);
10241024
void sctp_transport_dst_release(struct sctp_transport *t);
10251025
void sctp_transport_dst_confirm(struct sctp_transport *t);
10261026
void sctp_transport_pl_send(struct sctp_transport *t);
1027+
void sctp_transport_pl_recv(struct sctp_transport *t);
10271028

10281029

10291030
/* This is the structure we use to queue packets as they come into

net/sctp/sm_statefuns.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ enum sctp_disposition sctp_sf_backbeat_8_3(struct net *net,
12741274
!sctp_transport_pl_enabled(link))
12751275
return SCTP_DISPOSITION_DISCARD;
12761276

1277-
/* The actual handling will be performed here in a later patch. */
1277+
sctp_transport_pl_recv(link);
12781278
return SCTP_DISPOSITION_CONSUME;
12791279
}
12801280

net/sctp/transport.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,44 @@ void sctp_transport_pl_send(struct sctp_transport *t)
305305
t->pl.probe_count = 1;
306306
}
307307

308+
void sctp_transport_pl_recv(struct sctp_transport *t)
309+
{
310+
pr_debug("%s: PLPMTUD: transport: %p, state: %d, pmtu: %d, size: %d, high: %d\n",
311+
__func__, t, t->pl.state, t->pl.pmtu, t->pl.probe_size, t->pl.probe_high);
312+
313+
t->pl.pmtu = t->pl.probe_size;
314+
t->pl.probe_count = 0;
315+
if (t->pl.state == SCTP_PL_BASE) {
316+
t->pl.state = SCTP_PL_SEARCH; /* Base -> Search */
317+
t->pl.probe_size += SCTP_PL_BIG_STEP;
318+
} else if (t->pl.state == SCTP_PL_ERROR) {
319+
t->pl.state = SCTP_PL_SEARCH; /* Error -> Search */
320+
321+
t->pl.pmtu = t->pl.probe_size;
322+
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
323+
sctp_assoc_sync_pmtu(t->asoc);
324+
t->pl.probe_size += SCTP_PL_BIG_STEP;
325+
} else if (t->pl.state == SCTP_PL_SEARCH) {
326+
if (!t->pl.probe_high) {
327+
t->pl.probe_size = min(t->pl.probe_size + SCTP_PL_BIG_STEP,
328+
SCTP_MAX_PLPMTU);
329+
return;
330+
}
331+
t->pl.probe_size += SCTP_PL_MIN_STEP;
332+
if (t->pl.probe_size >= t->pl.probe_high) {
333+
t->pl.probe_high = 0;
334+
t->pl.state = SCTP_PL_COMPLETE; /* Search -> Search Complete */
335+
336+
t->pl.probe_size = t->pl.pmtu;
337+
t->pathmtu = t->pl.pmtu + sctp_transport_pl_hlen(t);
338+
sctp_assoc_sync_pmtu(t->asoc);
339+
}
340+
} else if (t->pl.state == SCTP_PL_COMPLETE) {
341+
t->pl.state = SCTP_PL_SEARCH; /* Search Complete -> Search */
342+
t->pl.probe_size += SCTP_PL_MIN_STEP;
343+
}
344+
}
345+
308346
bool sctp_transport_update_pmtu(struct sctp_transport *t, u32 pmtu)
309347
{
310348
struct dst_entry *dst = sctp_transport_dst_check(t);

0 commit comments

Comments
 (0)