return 0;
}
-static void hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
- u8 *il4_proto)
+static int hns3_get_l4_protocol(struct sk_buff *skb, u8 *ol4_proto,
+ u8 *il4_proto)
{
union {
struct iphdr *v4;
&l4_proto_tmp, &frag_off);
} else if (skb->protocol == htons(ETH_P_IP)) {
l4_proto_tmp = l3.v4->protocol;
+ } else {
+ return -EINVAL;
}
*ol4_proto = l4_proto_tmp;
/* tunnel packet */
if (!skb->encapsulation) {
*il4_proto = 0;
- return;
+ return 0;
}
/* find inner header point */
}
*il4_proto = l4_proto_tmp;
+
+ return 0;
}
static void hns3_set_l2l3l4_len(struct sk_buff *skb, u8 ol4_proto,
protocol = vlan_get_protocol(skb);
skb->protocol = protocol;
}
- hns3_get_l4_protocol(skb, &ol4_proto, &il4_proto);
+ ret = hns3_get_l4_protocol(skb, &ol4_proto, &il4_proto);
+ if (ret)
+ return ret;
hns3_set_l2l3l4_len(skb, ol4_proto, il4_proto,
&type_cs_vlan_tso,
&ol_type_vlan_len_msec);