diff options
author | Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> | 2016-07-13 18:08:58 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-07-14 01:10:14 (GMT) |
commit | e7487c86dc5c4a528a7dbd9dc14f453a0de61a84 (patch) | |
tree | fee52720c9c4621d165294c8d48dff6326468c36 /net/sctp/sm_statefuns.c | |
parent | 1f45f78f8e511203f03138f2ccde3d2cf90d2cbf (diff) | |
download | linux-e7487c86dc5c4a528a7dbd9dc14f453a0de61a84.tar.xz |
sctp: avoid identifying address family many times for a chunk
Identifying address family operations during rx path is not something
expensive but it's ugly to the eye to have it done multiple times,
specially when we already validated it during initial rx processing.
This patch takes advantage of the now shared sctp_input_cb and make the
pointer to the operations readily available.
Signed-off-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/sm_statefuns.c')
-rw-r--r-- | net/sctp/sm_statefuns.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index 5aabf42..b7c1f7f 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c @@ -6119,13 +6119,10 @@ static int sctp_eat_data(const struct sctp_association *asoc, */ if (!chunk->ecn_ce_done) { - struct sctp_af *af; + struct sctp_af *af = SCTP_INPUT_CB(chunk->skb)->af; chunk->ecn_ce_done = 1; - af = sctp_get_af_specific( - ipver2af(ip_hdr(chunk->skb)->version)); - - if (af && af->is_ce(sctp_gso_headskb(chunk->skb)) && + if (af->is_ce(sctp_gso_headskb(chunk->skb)) && asoc->peer.ecn_capable) { /* Do real work as sideffect. */ sctp_add_cmd_sf(commands, SCTP_CMD_ECN_CE, |