CHID
CHID

Reputation: 1643

DMA of data in socket buffer (skb) in linux

I was going through the process of packet transmission and packet reception in latest linux kernel. I can see that, there is a framework in skb where it supports "linear" data as well as "paged" data.

It has a separate structure called skb_shared_info to represent page fragments.

Now my doubt is, how will the device DMA the entire contents of the packet? Is it not going to be scattered across the memory?

Thanks CHID

Upvotes: 0

Views: 1912

Answers (1)

Roland
Roland

Reputation: 6543

It depends on the capability of the networking hardware. Most “modern” NICs can do gather/scatter DMA and handle tranferring a packet into multiple, non-contiguous buffers, but the Linux kernel networking stack will only give an skb with nonlinear data to a driver/netdev if NETIF_F_SG is set (indicating the device can handle scatter/gather). If the device driver sets NETIF_F_SG then it is telling the stack that it can handle multiple physical buffers per packet.

Upvotes: 2

Related Questions