UDP offload为udpv4_offload
static const struct net_offload udpv4_offload = {
.callbacks = {
.gso_segment = udp4_ufo_fragment,
.gro_receive = udp4_gro_receive,
.gro_complete = udp4_gro_complete,
},
};
udp4_gro_receive
static struct sk_buff **udp4_gro_receive(struct sk_buff **head,
struct sk_buff *skb)
{
struct udphdr *uh = udp_gro_udphdr(skb); //取到UDP头指针
if (unlikely(!uh))
goto flush;
/* Don't bother verifying checksum if we're going to flush anyway. */
if (NAPI_GRO_CB(skb)->flush) //如果flush已经置1,则不进行csum计算
goto skip;
if (skb_gro_checksum_validate_zero_check(skb, IPPROTO_UDP, uh->check, //如果csum check失败,则直接flush报文到协议栈
inet_gro_compute_pseudo))
goto flush;
else if (uh->check) //如果csum_cnt为0,且csum_valid为false使用新计算的伪首部的csum值
skb_gro_checksum_try_convert(skb, IPPROTO_UDP, uh->chec