当前位置:网站首页>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;
}
边栏推荐
- DHCP operation
- Pytest test framework II
- Variable setting in postman
- Procedural life: a few things you should know when entering the workplace
- Why do we always "give up halfway"?
- database/sql
- 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.
- [cloud native learning notes] kubernetes practice command
- Simple analysis of WordPress architecture
- Network security review office starts network security review on HowNet
猜你喜欢

基于C语言实现的足球信息查询系统 课程报告+项目源码+演示PPT+项目截图

After a few years in the testing industry, do you still know a little?

Auto. JS to automatically authorize screen capture permission

Variable setting in postman

OSI and tcp/ip model

Failed to open after installing Charles without any prompt

JMeter basic learning records

Power apps Guide

Station B takes goods to learn from New Oriental

After screwing the screws in the factory for two years, I earned more than 10000 yuan a month by "testing" and counterattacked
随机推荐
PIXIV Gizmo
OSI and tcp/ip model
Curl command
Basic database syntax learning
TCP Jprobe utilization problem location
Shrimp skin test surface treated
CondaValueError: The target prefix is the base prefix. Aborting.
Tool composition in JMeter
Different WordPress pages display different gadgets
Remember the frequently forgotten problem of continuously reading pictures -%04d
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.
大厂出海,败于“姿态”
JMeter basic learning records
The first day of handwritten RPC -- review of some basic knowledge
Three more days
Use of kubernetes storage volumes
Geek University cloud native training camp
[cloud native learning notes] kubernetes practice command
Postman assertion
Smooth live broadcast | analysis of key technologies for live broadcast pain points