struct iwl_cmd_meta *out_meta){inti;for(i =0; i < skb_shinfo(skb)->nr_frags; i++) {constskb_frag_t*frag = &skb_shinfo(skb)->frags[i];dma_addr_ttb_phys;inttb_idx;if(!skb_frag_size(frag))continue; tb_phys = skb_frag_dma_map(trans->dev, frag,0,skb_frag_size(frag), ...
理解skb_shinfo至关重要,它位于skb尾部,其中frags用于Scatter Gather(SG)功能,这是一种在TX时通过硬件加速数据发送的方式。SG通过软件生成分散的数据块,硬件进行DMA读取和合并,例如IXGBE驱动通过dma_map_single和skb_frag_dma_map为每个数据块分配DMA地址。在发送大包时,内核可能使用TSO(TCP Segmenta...
staticintipv6_frag_rcv(struct sk_buff *skb){structfrag_hdr*fhdr;structfrag_queue*fq;conststructipv6hdr*hdr=ipv6_hdr(skb);structnet*net=dev_net(skb_dst(skb)->dev);intiif;if(IP6CB(skb)->flags & IP6SKB_FRAGMENTED)gotofail_hdr; __IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)...
它,来判断是否真有数据到达等,诸如此类*/memcpy(rx->skb->data, &nic->blank_rfd,sizeof(structrfd));/*这是最关键的一步,建立DMA映射,把每一个缓冲区rx->skb->data都映射给了设备,缓存区节点 rx利用dma_addr保存了每一次映射的地址,这个地址后面会被用到*/rx->dma_addr = pci_map_single(nic->pd...
...sock)goto out; // 构造msghdriov.iov_base = buff;iov.iov_len = len;msg.msg_name = NULL;msg.msg_iov =...corkreq) { // 构造skbskb = ip_make_skb(sk, fl4, getfrag, msg->msg_iov, ulen, sizeof(struct udphdr),...int err; err = __ip_local_out(skb); // 构造ip ...
() */ skb_frag_t frags[MAX_SKB_FRAGS];/* 驱动和硬件支持 Scatter Gatter 对小块数据进行聚合, * 以及 TSO(硬件TCP分段)会用到该数组(后面会有详细介绍) */ }; /* 每个 skb_frag_t 存放数据块基于 struct page 的地址和长度信息*/ typedef struct skb_frag_struct skb_frag_t; struct skb_frag...
dma_unmap_single(&mp->myri_op->dev, sbus_readl(&rxd->myri_scatters[0].addr), RX_ALLOC_SIZE, DMA_FROM_DEVICE); mp->rx_skbs[index] = new_skb; new_skb->dev = dev; skb_put(new_skb, RX_ALLOC_SIZE); dma_addr = dma_map_single(&mp->myri_op->dev, ...
buf_len, DMA_FROM_DEVICE);if(err)gotoerr_frag_map; elem_info->u.rdq.skb = skb;return0; err_frag_map: dev_kfree_skb_any(skb);returnerr; } 开发者ID:valorekhov,项目名称:rpi-bluetooth-next,代码行数:27,代码来源:pci.c 示例5: ec_bhf_process_rx ...
mfn, GNTMAP_readonly); tx->gref = np->grant_tx_ref[id] = ref; tx->offset = frag->page_offset; tx->size = skb_frag_size(frag); tx->flags =0; } np->tx.req_prod_pvt = prod; } 开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:63,代码来源:xen-netfront.c ...
mapping = pci_map_single(priv->pdev,skb_tail_pointer(skb), MAX_RX_SIZE, PCI_DMA_FROMDEVICE); desc->host_addr = cpu_to_le32(mapping); desc->device_addr =0;//FIXME:necessary?desc->len = cpu_to_le16(MAX_RX_SIZE); desc->flags =0; ...