aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/sm_statefuns.c
diff options
context:
space:
mode:
authorMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>2016-07-13 15:08:58 -0300
committerDavid S. Miller <davem@davemloft.net>2016-07-13 18:10:14 -0700
commite7487c86dc5c4a528a7dbd9dc14f453a0de61a84 (patch)
treefee52720c9c4621d165294c8d48dff6326468c36 /net/sctp/sm_statefuns.c
parentsctp: allow GSO frags to access the chunk too (diff)
downloadlinux-dev-e7487c86dc5c4a528a7dbd9dc14f453a0de61a84.tar.xz
linux-dev-e7487c86dc5c4a528a7dbd9dc14f453a0de61a84.zip
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.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index 5aabf42065e2..b7c1f7f3c838 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,