diff --git a/net/core/dev.c b/net/core/dev.c
index a44d001237024966d1c38aab9b78e62843d27f20..b9d19fbb15890d0cdb6d79ede9fe2163cb92188d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5872,7 +5872,7 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi,
 				       maclen);
 
 		diffs |= skb_get_nfct(p) ^ skb_get_nfct(skb);
-
+#if IS_ENABLED(CONFIG_SKB_EXTENSIONS) && IS_ENABLED(CONFIG_NET_TC_SKB_EXT)
 		if (!diffs) {
 			struct tc_skb_ext *skb_ext = skb_ext_find(skb, TC_SKB_EXT);
 			struct tc_skb_ext *p_ext = skb_ext_find(p, TC_SKB_EXT);
@@ -5881,6 +5881,7 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi,
 			if (!diffs && unlikely(skb_ext))
 				diffs |= p_ext->chain ^ skb_ext->chain;
 		}
+#endif
 
 		NAPI_GRO_CB(p)->same_flow = !diffs;
 	}