当前位置:网站首页>Tso hardware sharding is a header copy problem
Tso hardware sharding is a header copy problem
2022-06-24 21:24:00 【already_ skb】
//skb->date It points to the layer 2 header address , Here is the calculation Ethernet head + IP head size
static inline int skb_transport_offset(const struct sk_buff *skb)
{return skb_transport_header(skb) - skb->data;
}
static int e1000_tso(struct e1000_adapter *adapter,
struct e1000_tx_ring *tx_ring, struct sk_buff *skb,__be16 protocol)
{
struct e1000_context_desc *context_desc;
struct e1000_buffer *buffer_info;
unsigned int i;
u32 cmd_length = 0;
u16 ipcse = 0, tucse, mss;
u8 ipcss, ipcso, tucss, tucso, hdr_len;
int err;
if (skb_is_gso(skb)) {
if (skb_header_cloned(skb)) {
err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC);
if (err)
return err;
}
//hdr_len = Ethernet head + IP Head + TCP Head
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
//MSS size
mss = skb_shinfo(skb)->gso_size;
if (protocol == htons(ETH_P_IP)) {struct iphdr *iph = ip_hdr(skb);
iph->tot_len = 0;
iph->check = 0;
tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
iph->daddr, 0,
IPPROTO_TCP,
0);
cmd_length = E1000_TXD_CMD_IP;
ipcse = skb_transport_offset(skb) - 1;
} else if (skb_is_gso_v6(skb)) {
ipv6_hdr(skb)->payload_len = 0;
tcp_hdr(skb)->check =
~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
&ipv6_hdr(skb)->daddr,
0, IPPROTO_TCP, 0);
ipcse = 0;
}
ipcss = skb_network_offset(skb);
ipcso = (void *)&(ip_hdr(skb)->check) - (void *)skb->data;
tucss = skb_transport_offset(skb);
tucso = (void *)&(tcp_hdr(skb)->check) - (void *)skb->data;
tucse = 0;
cmd_length |= (E1000_TXD_CMD_DEXT | E1000_TXD_CMD_TSE |
E1000_TXD_CMD_TCP | (skb->len - (hdr_len)));
i = tx_ring->next_to_use;
context_desc = E1000_CONTEXT_DESC(*tx_ring, i);
buffer_info = &tx_ring->buffer_info[i];
context_desc->lower_setup.ip_fields.ipcss = ipcss;
context_desc->lower_setup.ip_fields.ipcso = ipcso;
context_desc->lower_setup.ip_fields.ipcse = cpu_to_le16(ipcse);
context_desc->upper_setup.tcp_fields.tucss = tucss;
context_desc->upper_setup.tcp_fields.tucso = tucso;
context_desc->upper_setup.tcp_fields.tucse = cpu_to_le16(tucse);
// Basic information of hardware sharding
// Network card hardware slicing requires automatic hardware copy , How much data to test , Where to start ?
// The Ethernet header data is copied + IP The head of data + TCP Head ( So far, the code flow has built the Ethernet header )
// Network card according to MSS Slice data , That is, the pure data part is MSS size
// So the network card partition is copied from the Ethernet head
// But because the data part changes, the network card must also support hardware verification
context_desc->tcp_seg_setup.fields.hdr_len = hdr_len;
buffer_info->time_stamp = jiffies;
buffer_info->next_to_watch = i;
if (++i == tx_ring->count) i = 0;
tx_ring->next_to_use = i;
return true;
}
return false;
}
边栏推荐
- 浅谈MySql update会锁定哪些范围的数据
- Smooth live broadcast | analysis of key technologies for live broadcast pain points
- Go coding specification
- I just purchased a MySQL database and prompted that there are already instances. The console login instance needs to provide a database account. How do I know the database account.
- Requests requests for web page garbled code resolution
- Station B takes goods to learn from New Oriental
- Does the developer want to change to software testing?
- Address mapping of virtual memory paging mechanism
- Rewrite, maplocal and maplocal operations of Charles
- Minimum cost and maximum flow (template question)
猜你喜欢

Hongxiang Yunteng is compatible with dragon lizard operating system, and the product runs stably

How Fiddler works

Read all text from stdin to a string

yeb_ Back first day

188. 买卖股票的最佳时机 IV

CondaValueError: The target prefix is the base prefix. Aborting.

Limit summary (under update)

I feel that I am bald again when I help my children with their homework. I feel pity for my parents all over the world

What does virtualization mean? What technologies are included? What is the difference with private cloud?

After screwing the screws in the factory for two years, I earned more than 10000 yuan a month by "testing" and counterattacked
随机推荐
Simple analysis of WordPress architecture
Use of kubernetes storage volumes
Self signed certificate generation
Apple mobile phone can see some fun ways to install IPA package
JMeter parameterization
Undo log and redo log must be clear this time
What will you do if you have been ignored by your leaders at work?
A/b test helps the growth of game business
Can the OPDS SQL component pass process parameters to the next component through context
Big factories go out to sea and lose "posture"
The first day of handwritten RPC -- review of some basic knowledge
List set Introduction & common methods
Basic database syntax learning
Php-pdo parameter binding problem
Haitai Advanced Technology | application of privacy computing technology in medical data protection
123. 买卖股票的最佳时机 III
Oauth2.0 introduction
虚拟货币7个月蒸发2万亿美元,“马斯克们”终结15万人暴富梦
memcached全面剖析–5. memcached的应用和兼容程序
regular expression