diff options
| author | Xin Long <lucien.xin@gmail.com> | 2016-09-28 14:37:27 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2016-09-30 02:07:05 -0400 |
| commit | 0605483f6ace1f6b63e397c819a115ddcd13af0d (patch) | |
| tree | e71a84a43cb26e43cf85d066ff98e87a5245e0d1 /net/sctp | |
| parent | 73dca124cdbad2d67d47d6196c08325f18447d07 (diff) | |
sctp: remove prsctp_param from sctp_chunk
Now sctp uses chunk->prsctp_param to save the prsctp param for all the
prsctp polices, we didn't need to introduce prsctp_param to sctp_chunk.
We can just use chunk->sinfo.sinfo_timetolive for RTX and BUF polices,
and reuse msg->expires_at for TTL policy, as the prsctp polices and old
expires policy are mutual exclusive.
This patch is to remove prsctp_param from sctp_chunk, and reuse msg's
expires_at for TTL and chunk's sinfo.sinfo_timetolive for RTX and BUF
polices.
Note that sctp can't use chunk's sinfo.sinfo_timetolive for TTL policy,
as it needs a u64 variables to save the expires_at time.
This one also fixes the "netperf-Throughput_Mbps -37.2% regression"
issue.
Fixes: a6c2f792873a ("sctp: implement prsctp TTL policy")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp')
| -rw-r--r-- | net/sctp/chunk.c | 9 | ||||
| -rw-r--r-- | net/sctp/outqueue.c | 4 | ||||
| -rw-r--r-- | net/sctp/sm_make_chunk.c | 15 |
3 files changed, 9 insertions, 19 deletions
diff --git a/net/sctp/chunk.c b/net/sctp/chunk.c index a55e54738b81..14990e21cf55 100644 --- a/net/sctp/chunk.c +++ b/net/sctp/chunk.c | |||
| @@ -179,6 +179,11 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, | |||
| 179 | msg, msg->expires_at, jiffies); | 179 | msg, msg->expires_at, jiffies); |
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | if (asoc->prsctp_enable && | ||
| 183 | SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags)) | ||
| 184 | msg->expires_at = | ||
| 185 | jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive); | ||
| 186 | |||
| 182 | /* This is the biggest possible DATA chunk that can fit into | 187 | /* This is the biggest possible DATA chunk that can fit into |
| 183 | * the packet | 188 | * the packet |
| 184 | */ | 189 | */ |
| @@ -349,14 +354,14 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk) | |||
| 349 | } | 354 | } |
| 350 | 355 | ||
| 351 | if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) && | 356 | if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) && |
| 352 | time_after(jiffies, chunk->prsctp_param)) { | 357 | time_after(jiffies, chunk->msg->expires_at)) { |
| 353 | if (chunk->sent_count) | 358 | if (chunk->sent_count) |
| 354 | chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++; | 359 | chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++; |
| 355 | else | 360 | else |
| 356 | chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++; | 361 | chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++; |
| 357 | return 1; | 362 | return 1; |
| 358 | } else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) && | 363 | } else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) && |
| 359 | chunk->sent_count > chunk->prsctp_param) { | 364 | chunk->sent_count > chunk->sinfo.sinfo_timetolive) { |
| 360 | chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++; | 365 | chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++; |
| 361 | return 1; | 366 | return 1; |
| 362 | } | 367 | } |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 72e54a416af6..e084f35d40d2 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
| @@ -383,7 +383,7 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc, | |||
| 383 | 383 | ||
| 384 | list_for_each_entry_safe(chk, temp, queue, transmitted_list) { | 384 | list_for_each_entry_safe(chk, temp, queue, transmitted_list) { |
| 385 | if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) || | 385 | if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) || |
| 386 | chk->prsctp_param <= sinfo->sinfo_timetolive) | 386 | chk->sinfo.sinfo_timetolive <= sinfo->sinfo_timetolive) |
| 387 | continue; | 387 | continue; |
| 388 | 388 | ||
| 389 | list_del_init(&chk->transmitted_list); | 389 | list_del_init(&chk->transmitted_list); |
| @@ -418,7 +418,7 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc, | |||
| 418 | 418 | ||
| 419 | list_for_each_entry_safe(chk, temp, queue, list) { | 419 | list_for_each_entry_safe(chk, temp, queue, list) { |
| 420 | if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) || | 420 | if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) || |
| 421 | chk->prsctp_param <= sinfo->sinfo_timetolive) | 421 | chk->sinfo.sinfo_timetolive <= sinfo->sinfo_timetolive) |
| 422 | continue; | 422 | continue; |
| 423 | 423 | ||
| 424 | list_del_init(&chk->list); | 424 | list_del_init(&chk->list); |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 8c77b87a8565..46ffecc57214 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
| @@ -706,20 +706,6 @@ nodata: | |||
| 706 | return retval; | 706 | return retval; |
| 707 | } | 707 | } |
| 708 | 708 | ||
| 709 | static void sctp_set_prsctp_policy(struct sctp_chunk *chunk, | ||
| 710 | const struct sctp_sndrcvinfo *sinfo) | ||
| 711 | { | ||
| 712 | if (!chunk->asoc->prsctp_enable) | ||
| 713 | return; | ||
| 714 | |||
| 715 | if (SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags)) | ||
| 716 | chunk->prsctp_param = | ||
| 717 | jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive); | ||
| 718 | else if (SCTP_PR_RTX_ENABLED(sinfo->sinfo_flags) || | ||
| 719 | SCTP_PR_PRIO_ENABLED(sinfo->sinfo_flags)) | ||
| 720 | chunk->prsctp_param = sinfo->sinfo_timetolive; | ||
| 721 | } | ||
| 722 | |||
| 723 | /* Make a DATA chunk for the given association from the provided | 709 | /* Make a DATA chunk for the given association from the provided |
| 724 | * parameters. However, do not populate the data payload. | 710 | * parameters. However, do not populate the data payload. |
| 725 | */ | 711 | */ |
| @@ -753,7 +739,6 @@ struct sctp_chunk *sctp_make_datafrag_empty(struct sctp_association *asoc, | |||
| 753 | 739 | ||
| 754 | retval->subh.data_hdr = sctp_addto_chunk(retval, sizeof(dp), &dp); | 740 | retval->subh.data_hdr = sctp_addto_chunk(retval, sizeof(dp), &dp); |
| 755 | memcpy(&retval->sinfo, sinfo, sizeof(struct sctp_sndrcvinfo)); | 741 | memcpy(&retval->sinfo, sinfo, sizeof(struct sctp_sndrcvinfo)); |
| 756 | sctp_set_prsctp_policy(retval, sinfo); | ||
| 757 | 742 | ||
| 758 | nodata: | 743 | nodata: |
| 759 | return retval; | 744 | return retval; |
