skb

How to extract entire packet from skb including ethernet header, ip, and tcp plus pay load in poll method of device driver

孤街浪徒 提交于 2021-02-11 12:10:03
问题 in r8169 driver from realtek it does rx_buf = page_address(tp->Rx_databuff[entry]); dma_sync_single_for_cpu(d, addr, pkt_size, DMA_FROM_DEVICE); prefetch(rx_buf); skb_copy_to_linear_data(skb, rx_buf, pkt_size);<----//Do I get packet at this???? skb->tail += pkt_size; skb->len = pkt_size; dma_sync_single_for_device(d, addr, pkt_size, DMA_FROM_DEVICE); //csum... skb->protocol = eth_type_trans(skb, dev); napi_gro_receive(&tp->napi, skb); this is inside rtl_rx function called from poll of driver.

How to extract entire packet from skb including ethernet header, ip, and tcp plus pay load in poll method of device driver

耗尽温柔 提交于 2021-02-11 12:05:58
问题 in r8169 driver from realtek it does rx_buf = page_address(tp->Rx_databuff[entry]); dma_sync_single_for_cpu(d, addr, pkt_size, DMA_FROM_DEVICE); prefetch(rx_buf); skb_copy_to_linear_data(skb, rx_buf, pkt_size);<----//Do I get packet at this???? skb->tail += pkt_size; skb->len = pkt_size; dma_sync_single_for_device(d, addr, pkt_size, DMA_FROM_DEVICE); //csum... skb->protocol = eth_type_trans(skb, dev); napi_gro_receive(&tp->napi, skb); this is inside rtl_rx function called from poll of driver.

What's the correct way to process all the payload of a sk_buff packet in Linux

假如想象 提交于 2019-12-31 16:46:44
问题 I'm currently trying to debug an ATM encapsulation layer that runs on-top of Ethernet. Basically the ATM cells are stored in order after the ethernet header. However I suspect the drivers naive approach to the sk_buffs is broken. The driver blindly assumes that skb->data can be iterated through but looking at the kernel code for virtio_net.c:page_to_skb I see the following behaviour: memcpy(hdr, p, hdr_len); len -= hdr_len; p += offset; copy = len; if (copy > skb_tailroom(skb)) copy = skb