linux-sctp.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: netdev@vger.kernel.org
Cc: Neil Horman <nhorman@tuxdriver.com>,
	Vlad Yasevich <vyasevich@gmail.com>,
	linux-sctp@vger.kernel.org
Subject: [PATCH net-next 6/6] sctp: only check for ECN if peer is using it
Date: Wed, 13 Jul 2016 18:09:00 +0000	[thread overview]
Message-ID: <ba4e30dc1a674f5ccb9aa86f2f5d5d859d92f343.1468432819.git.marcelo.leitner@gmail.com> (raw)
In-Reply-To: <cover.1468432819.git.marcelo.leitner@gmail.com>

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 <marcelo.leitner@gmail.com>
---
 net/sctp/sm_statefuns.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index b7c1f7f3c8388400e51e3fbdbe099bc354559913..d88bb2b0b69913ad5962f9a5655d413f2c210ed0 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -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));
-- 
2.7.4


  parent reply	other threads:[~2016-07-13 18:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-13 18:08 [PATCH net-next 0/6] sctp: allow GSO frags to access the chunk too Marcelo Ricardo Leitner
2016-07-13 18:08 ` [PATCH net-next 1/6] sctp: allow others to use sctp_input_cb Marcelo Ricardo Leitner
2016-07-13 18:08 ` [PATCH net-next 2/6] sctp: reorder sctp_ulpevent and shrink msg_flags Marcelo Ricardo Leitner
2016-07-13 18:08 ` [PATCH net-next 3/6] sctp: allow GSO frags to access the chunk too Marcelo Ricardo Leitner
2016-07-13 18:08 ` [PATCH net-next 4/6] sctp: avoid identifying address family many times for a chunk Marcelo Ricardo Leitner
2016-07-13 18:08 ` [PATCH net-next 5/6] sctp: do not clear chunk->ecn_ce_done flag Marcelo Ricardo Leitner
2016-07-13 18:09 ` Marcelo Ricardo Leitner [this message]
2016-07-14  1:10 ` [PATCH net-next 0/6] sctp: allow GSO frags to access the chunk too David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ba4e30dc1a674f5ccb9aa86f2f5d5d859d92f343.1468432819.git.marcelo.leitner@gmail.com \
    --to=marcelo.leitner@gmail.com \
    --cc=linux-sctp@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    --cc=vyasevich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).