·struct sk_buff *skb_copy(const struct sk_buff *skb, gfp_t gfp_mask) ·struct sk_buff *pskb_copy(struct sk_buff *skb, gfp_t gfp_mask) ·struct sk_buff *skb_pad(struct sk_buff *skb, int pad) ·void skb_clone_fraglist(struct sk_buff *skb) ·void skb_drop_fraglist(struct sk...
对于frags[]一般用在当数据比较多,在线性数据区装不下的时候,skb_frag_t中是一页一页的数据,skb_frag_struct结构体如下: AI检测代码解析 1 /* include/linux/skbuff.h */ 2 typedef struct skb_frag_struct skb_frag_t; 3 4 struct skb_frag_struct { 5 struct { 6 struct page *p; /*指向分片数据...
· void skb_clone_fraglist(struct sk_buff *skb) · void skb_drop_fraglist(struct sk_buff *skb) · void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) · pskb_expand_head(struct sk_buff *skb, int nhead, int ntail, gfp_t gfp_mask) · int skb_copy_bits(const...
structsk_buff *frag_list; skb_frag_t frags[MAX_SKB_FRAGS]; }; The nr_frags member states howmany frags there are active in the frags[] array. The tso_size and tso_segs is used to convey information to the devicedriver for TCP segmentation offload. The frag_list is used to maintain ...
//分配新的skb->data,将旧的skb->data、skb_shinfo(skb)->frags、skb_shinfo(skb)->frag_list中的内容拷贝到新skb->data的连续内存空间中,释放frags或frag_list //其中frags用于支持分散聚集IO,frags_list用于支持数据分片 1.1 int __skb_linearize(struct sk_buff *skb, int gfp_mask) ...
skb->nh.raw = skb_push(skb, sizeof(struct iphdr)); iph = skb->nh.iph; iph->version = 4; iph->ihl = 5; iph->tos = inet->tos; iph->tot_len = htons(skb->len); iph->frag_off = 0; iph->id = htons(inet->id++); ...
structskb_shared_info { ... structsk_buff *frag_list; ... /* must be last field, see pskb_expand_head */ skb_frag_tfrags[MAX_SKB_FRAGS]; } typedefstructbio_vecskb_frag_t; /* * wasunsignedshort, but we might as well be readyfor>64kB I/O pages ...
先移动frags,再移动frag_list 3. 更新skb中的元数据 开始的问题清楚了两个。而且从源码来看bpf_skb_pull_data的第二个参数填__sk_buff->len这样的用法其实是最正确的,因为pskb_may_pull中在执行实际expend时会使用第二个参数减去线性区大小。 也就是这样用: SEC("tc") int test_a(struct __sk_buff *...
structskb_shared_info { ... structsk_buff *frag_list; ... /* must be last field, see pskb_expand_head */ skb_frag_tfrags[MAX_SKB_FRAGS]; } typedefstructbio_vecskb_frag_t; /* * wasunsignedshort, but we might as well be readyfor>64kB I/O pages ...
kunmap_skb_frag(vaddr); if ((len -= copy) == 0) return 0; offset += copy; to += copy; } start = end; } // 拷贝其他碎片skb中的数据部分 if (skb_shinfo(skb)->frag_list) { struct sk_buff *list = skb_shinfo(skb)->frag_list; ...