sctp: implement prsctp RTX policy

prsctp RTX policy is a policy to abandon chunks when they are
retransmitted beyond the max count.

This patch uses sent_count to count how many times one chunk has
been sent, and prsctp_param is the max rtx count, which is from
sinfo->sinfo_timetolive in sctp_set_prsctp_policy(). So similar
to TTL policy, if RTX policy is enabled, msg->expire_at won't
work.

Then in sctp_chunk_abandoned, this patch checks if chunk->sent_count
is bigger than chunk->prsctp_param to abandon this chunk.

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Xin Long 2016-07-09 19:47:44 +08:00 коммит произвёл David S. Miller
Родитель a6c2f79287
Коммит 01aadb3af6
2 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -355,6 +355,10 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk)
else else
chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++; chunk->asoc->abandoned_unsent[SCTP_PR_INDEX(TTL)]++;
return 1; return 1;
} else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) &&
chunk->sent_count > chunk->prsctp_param) {
chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++;
return 1;
} }
return 0; return 0;

Просмотреть файл

@ -720,6 +720,8 @@ static void sctp_set_prsctp_policy(struct sctp_chunk *chunk,
if (SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags)) if (SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags))
chunk->prsctp_param = chunk->prsctp_param =
jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive); jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive);
else if (SCTP_PR_RTX_ENABLED(sinfo->sinfo_flags))
chunk->prsctp_param = sinfo->sinfo_timetolive;
} }
/* Make a DATA chunk for the given association from the provided /* Make a DATA chunk for the given association from the provided