Skip to content

Commit

Permalink
sctp: only check for ECN if peer is using it
Browse files Browse the repository at this point in the history
Currently only read-only checks are performed up to the point on where
we check if peer is ECN capable, checks which we can avoid otherwise.
The flag ecn_ce_done is only used to perform this check once per
incoming packet, and nothing more.

Thus this patch moves the peer check up.

Signed-off-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
marceloleitner authored and davem330 committed Jul 14, 2016
1 parent d9cef42 commit 2d47fd1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/sctp/sm_statefuns.c
Original file line number Diff line number Diff line change
Expand Up @@ -6118,12 +6118,11 @@ static int sctp_eat_data(const struct sctp_association *asoc,
* chunk later.
*/

if (!chunk->ecn_ce_done) {
if (asoc->peer.ecn_capable && !chunk->ecn_ce_done) {
struct sctp_af *af = SCTP_INPUT_CB(chunk->skb)->af;
chunk->ecn_ce_done = 1;

if (af->is_ce(sctp_gso_headskb(chunk->skb)) &&
asoc->peer.ecn_capable) {
if (af->is_ce(sctp_gso_headskb(chunk->skb))) {
/* Do real work as sideffect. */
sctp_add_cmd_sf(commands, SCTP_CMD_ECN_CE,
SCTP_U32(tsn));
Expand Down

0 comments on commit 2d47fd1

Please sign in to comment.