Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
0fe5565b
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
0fe5565b
编写于
6月 28, 2013
作者:
B
Ben Hutchings
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sfc: Introduce inline functions to simplify TX insertion
Signed-off-by:
N
Ben Hutchings
<
bhutchings@solarflare.com
>
上级
306a2782
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
20 deletion
+33
-20
drivers/net/ethernet/sfc/tx.c
drivers/net/ethernet/sfc/tx.c
+33
-20
未找到文件。
drivers/net/ethernet/sfc/tx.c
浏览文件 @
0fe5565b
...
...
@@ -33,6 +33,31 @@ unsigned int efx_piobuf_size __read_mostly = EFX_PIOBUF_SIZE_DEF;
#endif
/* EFX_USE_PIO */
static
inline
unsigned
int
efx_tx_queue_get_insert_index
(
const
struct
efx_tx_queue
*
tx_queue
)
{
return
tx_queue
->
insert_count
&
tx_queue
->
ptr_mask
;
}
static
inline
struct
efx_tx_buffer
*
__efx_tx_queue_get_insert_buffer
(
const
struct
efx_tx_queue
*
tx_queue
)
{
return
&
tx_queue
->
buffer
[
efx_tx_queue_get_insert_index
(
tx_queue
)];
}
static
inline
struct
efx_tx_buffer
*
efx_tx_queue_get_insert_buffer
(
const
struct
efx_tx_queue
*
tx_queue
)
{
struct
efx_tx_buffer
*
buffer
=
__efx_tx_queue_get_insert_buffer
(
tx_queue
);
EFX_BUG_ON_PARANOID
(
buffer
->
len
);
EFX_BUG_ON_PARANOID
(
buffer
->
flags
);
EFX_BUG_ON_PARANOID
(
buffer
->
unmap_len
);
return
buffer
;
}
static
void
efx_dequeue_buffer
(
struct
efx_tx_queue
*
tx_queue
,
struct
efx_tx_buffer
*
buffer
,
unsigned
int
*
pkts_compl
,
...
...
@@ -180,7 +205,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
struct
device
*
dma_dev
=
&
efx
->
pci_dev
->
dev
;
struct
efx_tx_buffer
*
buffer
;
skb_frag_t
*
fragment
;
unsigned
int
len
,
unmap_len
=
0
,
insert_ptr
;
unsigned
int
len
,
unmap_len
=
0
;
dma_addr_t
dma_addr
,
unmap_addr
=
0
;
unsigned
int
dma_len
;
unsigned
short
dma_flags
;
...
...
@@ -221,11 +246,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
/* Add to TX queue, splitting across DMA boundaries */
do
{
insert_ptr
=
tx_queue
->
insert_count
&
tx_queue
->
ptr_mask
;
buffer
=
&
tx_queue
->
buffer
[
insert_ptr
];
EFX_BUG_ON_PARANOID
(
buffer
->
flags
);
EFX_BUG_ON_PARANOID
(
buffer
->
len
);
EFX_BUG_ON_PARANOID
(
buffer
->
unmap_len
);
buffer
=
efx_tx_queue_get_insert_buffer
(
tx_queue
);
dma_len
=
efx_max_tx_len
(
efx
,
dma_addr
);
if
(
likely
(
dma_len
>=
len
))
...
...
@@ -283,8 +304,7 @@ netdev_tx_t efx_enqueue_skb(struct efx_tx_queue *tx_queue, struct sk_buff *skb)
while
(
tx_queue
->
insert_count
!=
tx_queue
->
write_count
)
{
unsigned
int
pkts_compl
=
0
,
bytes_compl
=
0
;
--
tx_queue
->
insert_count
;
insert_ptr
=
tx_queue
->
insert_count
&
tx_queue
->
ptr_mask
;
buffer
=
&
tx_queue
->
buffer
[
insert_ptr
];
buffer
=
__efx_tx_queue_get_insert_buffer
(
tx_queue
);
efx_dequeue_buffer
(
tx_queue
,
buffer
,
&
pkts_compl
,
&
bytes_compl
);
}
...
...
@@ -755,23 +775,18 @@ static void efx_tx_queue_insert(struct efx_tx_queue *tx_queue,
{
struct
efx_tx_buffer
*
buffer
;
struct
efx_nic
*
efx
=
tx_queue
->
efx
;
unsigned
dma_len
,
insert_ptr
;
unsigned
dma_len
;
EFX_BUG_ON_PARANOID
(
len
<=
0
);
while
(
1
)
{
insert_ptr
=
tx_queue
->
insert_count
&
tx_queue
->
ptr_mask
;
buffer
=
&
tx_queue
->
buffer
[
insert_ptr
];
buffer
=
efx_tx_queue_get_insert_buffer
(
tx_queue
);
++
tx_queue
->
insert_count
;
EFX_BUG_ON_PARANOID
(
tx_queue
->
insert_count
-
tx_queue
->
read_count
>=
efx
->
txq_entries
);
EFX_BUG_ON_PARANOID
(
buffer
->
len
);
EFX_BUG_ON_PARANOID
(
buffer
->
unmap_len
);
EFX_BUG_ON_PARANOID
(
buffer
->
flags
);
buffer
->
dma_addr
=
dma_addr
;
dma_len
=
efx_max_tx_len
(
efx
,
dma_addr
);
...
...
@@ -832,8 +847,7 @@ static void efx_enqueue_unwind(struct efx_tx_queue *tx_queue)
/* Work backwards until we hit the original insert pointer value */
while
(
tx_queue
->
insert_count
!=
tx_queue
->
write_count
)
{
--
tx_queue
->
insert_count
;
buffer
=
&
tx_queue
->
buffer
[
tx_queue
->
insert_count
&
tx_queue
->
ptr_mask
];
buffer
=
__efx_tx_queue_get_insert_buffer
(
tx_queue
);
efx_dequeue_buffer
(
tx_queue
,
buffer
,
NULL
,
NULL
);
}
}
...
...
@@ -978,7 +992,7 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
struct
tso_state
*
st
)
{
struct
efx_tx_buffer
*
buffer
=
&
tx_queue
->
buffer
[
tx_queue
->
insert_count
&
tx_queue
->
ptr_mask
]
;
efx_tx_queue_get_insert_buffer
(
tx_queue
)
;
bool
is_last
=
st
->
out_len
<=
skb_shinfo
(
skb
)
->
gso_size
;
u8
tcp_flags_clear
;
...
...
@@ -1048,8 +1062,7 @@ static int tso_start_new_packet(struct efx_tx_queue *tx_queue,
/* We mapped the headers in tso_start(). Unmap them
* when the last segment is completed.
*/
buffer
=
&
tx_queue
->
buffer
[
tx_queue
->
insert_count
&
tx_queue
->
ptr_mask
];
buffer
=
efx_tx_queue_get_insert_buffer
(
tx_queue
);
buffer
->
dma_addr
=
st
->
header_dma_addr
;
buffer
->
len
=
st
->
header_len
;
if
(
is_last
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录