Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
9714284f
cloud-kernel
项目概览
openanolis
/
cloud-kernel
接近 2 年 前同步成功
通知
169
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9714284f
编写于
6月 22, 2012
作者:
B
Ben Hutchings
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sfc: Stash header offsets for TSO in struct tso_state
Signed-off-by:
N
Ben Hutchings
<
bhutchings@solarflare.com
>
上级
53cb13c6
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
12 addition
and
16 deletion
+12
-16
drivers/net/ethernet/sfc/tx.c
drivers/net/ethernet/sfc/tx.c
+12
-16
未找到文件。
drivers/net/ethernet/sfc/tx.c
浏览文件 @
9714284f
...
...
@@ -613,10 +613,6 @@ void efx_remove_tx_queue(struct efx_tx_queue *tx_queue)
#endif
#define PTR_DIFF(p1, p2) ((u8 *)(p1) - (u8 *)(p2))
#define ETH_HDR_LEN(skb) (skb_network_header(skb) - (skb)->data)
#define SKB_TCP_OFF(skb) PTR_DIFF(tcp_hdr(skb), (skb)->data)
#define SKB_IPV4_OFF(skb) PTR_DIFF(ip_hdr(skb), (skb)->data)
#define SKB_IPV6_OFF(skb) PTR_DIFF(ipv6_hdr(skb), (skb)->data)
/**
* struct tso_state - TSO state for an SKB
...
...
@@ -630,6 +626,8 @@ void efx_remove_tx_queue(struct efx_tx_queue *tx_queue)
* @unmap_addr: DMA address of SKB fragment
* @dma_flags: TX buffer flags for DMA mapping - %EFX_TX_BUF_MAP_SINGLE or 0
* @protocol: Network protocol (after any VLAN header)
* @ip_off: Offset of IP header
* @tcp_off: Offset of TCP header
* @header_len: Number of bytes of header
* @ip_base_len: IPv4 tot_len or IPv6 payload_len, before TCP payload
*
...
...
@@ -651,6 +649,8 @@ struct tso_state {
unsigned
short
dma_flags
;
__be16
protocol
;
unsigned
int
ip_off
;
unsigned
int
tcp_off
;
unsigned
header_len
;
unsigned
int
ip_base_len
;
};
...
...
@@ -825,17 +825,14 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
/* Parse the SKB header and initialise state. */
static
void
tso_start
(
struct
tso_state
*
st
,
const
struct
sk_buff
*
skb
)
{
/* All ethernet/IP/TCP headers combined size is TCP header size
* plus offset of TCP header relative to start of packet.
*/
st
->
header_len
=
((
tcp_hdr
(
skb
)
->
doff
<<
2u
)
+
PTR_DIFF
(
tcp_hdr
(
skb
),
skb
->
data
));
st
->
ip_off
=
skb_network_header
(
skb
)
-
skb
->
data
;
st
->
tcp_off
=
skb_transport_header
(
skb
)
-
skb
->
data
;
st
->
header_len
=
st
->
tcp_off
+
(
tcp_hdr
(
skb
)
->
doff
<<
2u
);
if
(
st
->
protocol
==
htons
(
ETH_P_IP
))
{
st
->
ip_base_len
=
st
->
header_len
-
ETH_HDR_LEN
(
skb
)
;
st
->
ip_base_len
=
st
->
header_len
-
st
->
ip_off
;
st
->
ipv4_id
=
ntohs
(
ip_hdr
(
skb
)
->
id
);
}
else
{
st
->
ip_base_len
=
tcp_hdr
(
skb
)
->
doff
<<
2u
;
st
->
ip_base_len
=
st
->
header_len
-
st
->
tcp_off
;
st
->
ipv4_id
=
0
;
}
st
->
seqnum
=
ntohl
(
tcp_hdr
(
skb
)
->
seq
);
...
...
@@ -959,7 +956,7 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
if
(
!
header
)
return
-
ENOMEM
;
tsoh_th
=
(
struct
tcphdr
*
)(
header
+
SKB_TCP_OFF
(
skb
)
);
tsoh_th
=
(
struct
tcphdr
*
)(
header
+
st
->
tcp_off
);
/* Copy and update the headers. */
memcpy
(
header
,
skb
->
data
,
st
->
header_len
);
...
...
@@ -980,8 +977,7 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
ip_length
=
st
->
ip_base_len
+
st
->
packet_space
;
if
(
st
->
protocol
==
htons
(
ETH_P_IP
))
{
struct
iphdr
*
tsoh_iph
=
(
struct
iphdr
*
)(
header
+
SKB_IPV4_OFF
(
skb
));
struct
iphdr
*
tsoh_iph
=
(
struct
iphdr
*
)(
header
+
st
->
ip_off
);
tsoh_iph
->
tot_len
=
htons
(
ip_length
);
...
...
@@ -990,7 +986,7 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
st
->
ipv4_id
++
;
}
else
{
struct
ipv6hdr
*
tsoh_iph
=
(
struct
ipv6hdr
*
)(
header
+
SKB_IPV6_OFF
(
skb
)
);
(
struct
ipv6hdr
*
)(
header
+
st
->
ip_off
);
tsoh_iph
->
payload_len
=
htons
(
ip_length
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录