Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
6cc92cdd
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看板
提交
6cc92cdd
编写于
8月 08, 2007
作者:
J
Jeff Garzik
提交者:
David S. Miller
10月 10, 2007
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[netdrvr] 8139cp, 8139too: convert to generic DMA
Signed-off-by:
N
Jeff Garzik
<
jeff@garzik.org
>
上级
ae94607d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
24 deletion
+27
-24
drivers/net/8139cp.c
drivers/net/8139cp.c
+17
-14
drivers/net/8139too.c
drivers/net/8139too.c
+10
-10
未找到文件。
drivers/net/8139cp.c
浏览文件 @
6cc92cdd
...
...
@@ -562,7 +562,7 @@ static int cp_rx_poll(struct napi_struct *napi, int budget)
skb_reserve
(
new_skb
,
RX_OFFSET
);
pci_unmap_single
(
cp
->
p
dev
,
mapping
,
dma_unmap_single
(
&
cp
->
pdev
->
dev
,
mapping
,
buflen
,
PCI_DMA_FROMDEVICE
);
/* Handle checksum offloading for incoming packets. */
...
...
@@ -573,7 +573,7 @@ static int cp_rx_poll(struct napi_struct *napi, int budget)
skb_put
(
skb
,
len
);
mapping
=
pci_map_single
(
cp
->
p
dev
,
new_skb
->
data
,
buflen
,
mapping
=
dma_map_single
(
&
cp
->
pdev
->
dev
,
new_skb
->
data
,
buflen
,
PCI_DMA_FROMDEVICE
);
cp
->
rx_skb
[
rx_tail
]
=
new_skb
;
...
...
@@ -701,7 +701,7 @@ static void cp_tx (struct cp_private *cp)
skb
=
cp
->
tx_skb
[
tx_tail
];
BUG_ON
(
!
skb
);
pci_unmap_single
(
cp
->
p
dev
,
le64_to_cpu
(
txd
->
addr
),
dma_unmap_single
(
&
cp
->
pdev
->
dev
,
le64_to_cpu
(
txd
->
addr
),
le32_to_cpu
(
txd
->
opts1
)
&
0xffff
,
PCI_DMA_TODEVICE
);
...
...
@@ -779,7 +779,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
dma_addr_t
mapping
;
len
=
skb
->
len
;
mapping
=
pci_map_single
(
cp
->
p
dev
,
skb
->
data
,
len
,
PCI_DMA_TODEVICE
);
mapping
=
dma_map_single
(
&
cp
->
pdev
->
dev
,
skb
->
data
,
len
,
PCI_DMA_TODEVICE
);
CP_VLAN_TX_TAG
(
txd
,
vlan_tag
);
txd
->
addr
=
cpu_to_le64
(
mapping
);
wmb
();
...
...
@@ -815,7 +815,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
*/
first_eor
=
eor
;
first_len
=
skb_headlen
(
skb
);
first_mapping
=
pci_map_single
(
cp
->
p
dev
,
skb
->
data
,
first_mapping
=
dma_map_single
(
&
cp
->
pdev
->
dev
,
skb
->
data
,
first_len
,
PCI_DMA_TODEVICE
);
cp
->
tx_skb
[
entry
]
=
skb
;
entry
=
NEXT_TX
(
entry
);
...
...
@@ -827,7 +827,7 @@ static int cp_start_xmit (struct sk_buff *skb, struct net_device *dev)
dma_addr_t
mapping
;
len
=
this_frag
->
size
;
mapping
=
pci_map_single
(
cp
->
p
dev
,
mapping
=
dma_map_single
(
&
cp
->
pdev
->
dev
,
((
void
*
)
page_address
(
this_frag
->
page
)
+
this_frag
->
page_offset
),
len
,
PCI_DMA_TODEVICE
);
...
...
@@ -1066,8 +1066,8 @@ static int cp_refill_rx (struct cp_private *cp)
skb_reserve
(
skb
,
RX_OFFSET
);
mapping
=
pci_map_single
(
cp
->
pdev
,
skb
->
data
,
cp
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
mapping
=
dma_map_single
(
&
cp
->
pdev
->
dev
,
skb
->
data
,
cp
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
cp
->
rx_skb
[
i
]
=
skb
;
cp
->
rx_ring
[
i
].
opts2
=
0
;
...
...
@@ -1107,7 +1107,8 @@ static int cp_alloc_rings (struct cp_private *cp)
{
void
*
mem
;
mem
=
pci_alloc_consistent
(
cp
->
pdev
,
CP_RING_BYTES
,
&
cp
->
ring_dma
);
mem
=
dma_alloc_coherent
(
&
cp
->
pdev
->
dev
,
CP_RING_BYTES
,
&
cp
->
ring_dma
,
GFP_KERNEL
);
if
(
!
mem
)
return
-
ENOMEM
;
...
...
@@ -1125,7 +1126,7 @@ static void cp_clean_rings (struct cp_private *cp)
for
(
i
=
0
;
i
<
CP_RX_RING_SIZE
;
i
++
)
{
if
(
cp
->
rx_skb
[
i
])
{
desc
=
cp
->
rx_ring
+
i
;
pci_unmap_single
(
cp
->
pdev
,
le64_to_cpu
(
desc
->
addr
),
dma_unmap_single
(
&
cp
->
pdev
->
dev
,
le64_to_cpu
(
desc
->
addr
),
cp
->
rx_buf_sz
,
PCI_DMA_FROMDEVICE
);
dev_kfree_skb
(
cp
->
rx_skb
[
i
]);
}
...
...
@@ -1136,7 +1137,7 @@ static void cp_clean_rings (struct cp_private *cp)
struct
sk_buff
*
skb
=
cp
->
tx_skb
[
i
];
desc
=
cp
->
tx_ring
+
i
;
pci_unmap_single
(
cp
->
pdev
,
le64_to_cpu
(
desc
->
addr
),
dma_unmap_single
(
&
cp
->
pdev
->
dev
,
le64_to_cpu
(
desc
->
addr
),
le32_to_cpu
(
desc
->
opts1
)
&
0xffff
,
PCI_DMA_TODEVICE
);
if
(
le32_to_cpu
(
desc
->
opts1
)
&
LastFrag
)
...
...
@@ -1155,7 +1156,8 @@ static void cp_clean_rings (struct cp_private *cp)
static
void
cp_free_rings
(
struct
cp_private
*
cp
)
{
cp_clean_rings
(
cp
);
pci_free_consistent
(
cp
->
pdev
,
CP_RING_BYTES
,
cp
->
rx_ring
,
cp
->
ring_dma
);
dma_free_coherent
(
&
cp
->
pdev
->
dev
,
CP_RING_BYTES
,
cp
->
rx_ring
,
cp
->
ring_dma
);
cp
->
rx_ring
=
NULL
;
cp
->
tx_ring
=
NULL
;
}
...
...
@@ -1519,7 +1521,8 @@ static void cp_get_ethtool_stats (struct net_device *dev,
dma_addr_t
dma
;
int
i
;
nic_stats
=
pci_alloc_consistent
(
cp
->
pdev
,
sizeof
(
*
nic_stats
),
&
dma
);
nic_stats
=
dma_alloc_coherent
(
&
cp
->
pdev
->
dev
,
sizeof
(
*
nic_stats
),
&
dma
,
GFP_KERNEL
);
if
(
!
nic_stats
)
return
;
...
...
@@ -1554,7 +1557,7 @@ static void cp_get_ethtool_stats (struct net_device *dev,
tmp_stats
[
i
++
]
=
cp
->
cp_stats
.
rx_frags
;
BUG_ON
(
i
!=
CP_NUM_STATS
);
pci_free_consistent
(
cp
->
p
dev
,
sizeof
(
*
nic_stats
),
nic_stats
,
dma
);
dma_free_coherent
(
&
cp
->
pdev
->
dev
,
sizeof
(
*
nic_stats
),
nic_stats
,
dma
);
}
static
const
struct
ethtool_ops
cp_ethtool_ops
=
{
...
...
drivers/net/8139too.c
浏览文件 @
6cc92cdd
...
...
@@ -1316,18 +1316,18 @@ static int rtl8139_open (struct net_device *dev)
if
(
retval
)
return
retval
;
tp
->
tx_bufs
=
pci_alloc_consistent
(
tp
->
pci_
dev
,
TX_BUF_TOT_LEN
,
&
tp
->
tx_bufs_dma
);
tp
->
rx_ring
=
pci_alloc_consistent
(
tp
->
pci_
dev
,
RX_BUF_TOT_LEN
,
&
tp
->
rx_ring_dma
);
tp
->
tx_bufs
=
dma_alloc_coherent
(
&
tp
->
pci_dev
->
dev
,
TX_BUF_TOT_LEN
,
&
tp
->
tx_bufs_dma
,
GFP_KERNEL
);
tp
->
rx_ring
=
dma_alloc_coherent
(
&
tp
->
pci_dev
->
dev
,
RX_BUF_TOT_LEN
,
&
tp
->
rx_ring_dma
,
GFP_KERNEL
);
if
(
tp
->
tx_bufs
==
NULL
||
tp
->
rx_ring
==
NULL
)
{
free_irq
(
dev
->
irq
,
dev
);
if
(
tp
->
tx_bufs
)
pci_free_consistent
(
tp
->
pci_
dev
,
TX_BUF_TOT_LEN
,
dma_free_coherent
(
&
tp
->
pci_dev
->
dev
,
TX_BUF_TOT_LEN
,
tp
->
tx_bufs
,
tp
->
tx_bufs_dma
);
if
(
tp
->
rx_ring
)
pci_free_consistent
(
tp
->
pci_
dev
,
RX_BUF_TOT_LEN
,
dma_free_coherent
(
&
tp
->
pci_dev
->
dev
,
RX_BUF_TOT_LEN
,
tp
->
rx_ring
,
tp
->
rx_ring_dma
);
return
-
ENOMEM
;
...
...
@@ -2246,10 +2246,10 @@ static int rtl8139_close (struct net_device *dev)
rtl8139_tx_clear
(
tp
);
pci_free_consistent
(
tp
->
pci_
dev
,
RX_BUF_TOT_LEN
,
tp
->
rx_ring
,
tp
->
rx_ring_dma
);
pci_free_consistent
(
tp
->
pci_
dev
,
TX_BUF_TOT_LEN
,
tp
->
tx_bufs
,
tp
->
tx_bufs_dma
);
dma_free_coherent
(
&
tp
->
pci_dev
->
dev
,
RX_BUF_TOT_LEN
,
tp
->
rx_ring
,
tp
->
rx_ring_dma
);
dma_free_coherent
(
&
tp
->
pci_dev
->
dev
,
TX_BUF_TOT_LEN
,
tp
->
tx_bufs
,
tp
->
tx_bufs_dma
);
tp
->
rx_ring
=
NULL
;
tp
->
tx_bufs
=
NULL
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录