sctp: avoid identifying address family many times for a chunk
[cascardo/linux.git] / net / sctp / sm_statefuns.c
index f1f08c8..b7c1f7f 100644 (file)
@@ -6119,13 +6119,11 @@ 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(chunk->skb) && asoc->peer.ecn_capable) {
+               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,
                                        SCTP_U32(tsn));