提交 0605483f 编写于 作者: X Xin Long 提交者: David S. Miller

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: a6c2f792 ("sctp: implement prsctp TTL policy")
Signed-off-by: NXin Long <lucien.xin@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 73dca124
...@@ -606,13 +606,6 @@ struct sctp_chunk { ...@@ -606,13 +606,6 @@ struct sctp_chunk {
/* This needs to be recoverable for SCTP_SEND_FAILED events. */ /* This needs to be recoverable for SCTP_SEND_FAILED events. */
struct sctp_sndrcvinfo sinfo; struct sctp_sndrcvinfo sinfo;
/* We use this field to record param for prsctp policies,
* for TTL policy, it is the time_to_drop of this chunk,
* for RTX policy, it is the max_sent_count of this chunk,
* for PRIO policy, it is the priority of this chunk.
*/
unsigned long prsctp_param;
/* Which association does this belong to? */ /* Which association does this belong to? */
struct sctp_association *asoc; struct sctp_association *asoc;
......
...@@ -179,6 +179,11 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc, ...@@ -179,6 +179,11 @@ struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *asoc,
msg, msg->expires_at, jiffies); msg, msg->expires_at, jiffies);
} }
if (asoc->prsctp_enable &&
SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags))
msg->expires_at =
jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive);
/* This is the biggest possible DATA chunk that can fit into /* This is the biggest possible DATA chunk that can fit into
* the packet * the packet
*/ */
...@@ -349,14 +354,14 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk) ...@@ -349,14 +354,14 @@ int sctp_chunk_abandoned(struct sctp_chunk *chunk)
} }
if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) && if (SCTP_PR_TTL_ENABLED(chunk->sinfo.sinfo_flags) &&
time_after(jiffies, chunk->prsctp_param)) { time_after(jiffies, chunk->msg->expires_at)) {
if (chunk->sent_count) if (chunk->sent_count)
chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++; chunk->asoc->abandoned_sent[SCTP_PR_INDEX(TTL)]++;
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) && } else if (SCTP_PR_RTX_ENABLED(chunk->sinfo.sinfo_flags) &&
chunk->sent_count > chunk->prsctp_param) { chunk->sent_count > chunk->sinfo.sinfo_timetolive) {
chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++; chunk->asoc->abandoned_sent[SCTP_PR_INDEX(RTX)]++;
return 1; return 1;
} }
......
...@@ -383,7 +383,7 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc, ...@@ -383,7 +383,7 @@ static int sctp_prsctp_prune_sent(struct sctp_association *asoc,
list_for_each_entry_safe(chk, temp, queue, transmitted_list) { list_for_each_entry_safe(chk, temp, queue, transmitted_list) {
if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) || if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) ||
chk->prsctp_param <= sinfo->sinfo_timetolive) chk->sinfo.sinfo_timetolive <= sinfo->sinfo_timetolive)
continue; continue;
list_del_init(&chk->transmitted_list); list_del_init(&chk->transmitted_list);
...@@ -418,7 +418,7 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc, ...@@ -418,7 +418,7 @@ static int sctp_prsctp_prune_unsent(struct sctp_association *asoc,
list_for_each_entry_safe(chk, temp, queue, list) { list_for_each_entry_safe(chk, temp, queue, list) {
if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) || if (!SCTP_PR_PRIO_ENABLED(chk->sinfo.sinfo_flags) ||
chk->prsctp_param <= sinfo->sinfo_timetolive) chk->sinfo.sinfo_timetolive <= sinfo->sinfo_timetolive)
continue; continue;
list_del_init(&chk->list); list_del_init(&chk->list);
......
...@@ -706,20 +706,6 @@ struct sctp_chunk *sctp_make_ecne(const struct sctp_association *asoc, ...@@ -706,20 +706,6 @@ struct sctp_chunk *sctp_make_ecne(const struct sctp_association *asoc,
return retval; return retval;
} }
static void sctp_set_prsctp_policy(struct sctp_chunk *chunk,
const struct sctp_sndrcvinfo *sinfo)
{
if (!chunk->asoc->prsctp_enable)
return;
if (SCTP_PR_TTL_ENABLED(sinfo->sinfo_flags))
chunk->prsctp_param =
jiffies + msecs_to_jiffies(sinfo->sinfo_timetolive);
else if (SCTP_PR_RTX_ENABLED(sinfo->sinfo_flags) ||
SCTP_PR_PRIO_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
* parameters. However, do not populate the data payload. * parameters. However, do not populate the data payload.
*/ */
...@@ -753,7 +739,6 @@ struct sctp_chunk *sctp_make_datafrag_empty(struct sctp_association *asoc, ...@@ -753,7 +739,6 @@ struct sctp_chunk *sctp_make_datafrag_empty(struct sctp_association *asoc,
retval->subh.data_hdr = sctp_addto_chunk(retval, sizeof(dp), &dp); retval->subh.data_hdr = sctp_addto_chunk(retval, sizeof(dp), &dp);
memcpy(&retval->sinfo, sinfo, sizeof(struct sctp_sndrcvinfo)); memcpy(&retval->sinfo, sinfo, sizeof(struct sctp_sndrcvinfo));
sctp_set_prsctp_policy(retval, sinfo);
nodata: nodata:
return retval; return retval;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册