Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
fa657efc
Commit
fa657efc
authored
Apr 03, 2002
by
Jeff Garzik
Committed by
Linus Torvalds
Apr 03, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up tg3 net drver PCI DMA mapping, and in the process
fix the build on ia32. Author: Dave Miller
parent
fb46223e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
21 deletions
+33
-21
drivers/net/tg3.c
drivers/net/tg3.c
+33
-21
No files found.
drivers/net/tg3.c
View file @
fa657efc
...
@@ -1725,17 +1725,20 @@ static void tg3_rx(struct tg3 *tp)
...
@@ -1725,17 +1725,20 @@ static void tg3_rx(struct tg3 *tp)
desc_idx
=
desc
->
opaque
&
RXD_OPAQUE_INDEX_MASK
;
desc_idx
=
desc
->
opaque
&
RXD_OPAQUE_INDEX_MASK
;
opaque_key
=
desc
->
opaque
&
RXD_OPAQUE_RING_MASK
;
opaque_key
=
desc
->
opaque
&
RXD_OPAQUE_RING_MASK
;
if
(
opaque_key
==
RXD_OPAQUE_RING_STD
)
{
if
(
opaque_key
==
RXD_OPAQUE_RING_STD
)
{
dma_addr
=
tp
->
rx_std_buffers
[
desc_idx
].
mapping
;
dma_addr
=
pci_unmap_addr
(
&
tp
->
rx_std_buffers
[
desc_idx
],
mapping
);
skb
=
tp
->
rx_std_buffers
[
desc_idx
].
skb
;
skb
=
tp
->
rx_std_buffers
[
desc_idx
].
skb
;
post_ptr
=
&
tp
->
rx_std_ptr
;
post_ptr
=
&
tp
->
rx_std_ptr
;
}
else
if
(
opaque_key
==
RXD_OPAQUE_RING_JUMBO
)
{
}
else
if
(
opaque_key
==
RXD_OPAQUE_RING_JUMBO
)
{
dma_addr
=
tp
->
rx_jumbo_buffers
[
desc_idx
].
mapping
;
dma_addr
=
pci_unmap_addr
(
&
tp
->
rx_jumbo_buffers
[
desc_idx
],
mapping
);
skb
=
tp
->
rx_jumbo_buffers
[
desc_idx
].
skb
;
skb
=
tp
->
rx_jumbo_buffers
[
desc_idx
].
skb
;
post_ptr
=
&
tp
->
rx_jumbo_ptr
;
post_ptr
=
&
tp
->
rx_jumbo_ptr
;
}
}
#if TG3_MINI_RING_WORKS
#if TG3_MINI_RING_WORKS
else
if
(
opaque_key
==
RXD_OPAQUE_RING_MINI
)
{
else
if
(
opaque_key
==
RXD_OPAQUE_RING_MINI
)
{
dma_addr
=
tp
->
rx_mini_buffers
[
desc_idx
].
mapping
;
dma_addr
=
pci_unmap_addr
(
&
tp
->
rx_mini_buffers
[
desc_idx
],
mapping
);
skb
=
tp
->
rx_mini_buffers
[
desc_idx
].
skb
;
skb
=
tp
->
rx_mini_buffers
[
desc_idx
].
skb
;
post_ptr
=
&
tp
->
rx_mini_ptr
;
post_ptr
=
&
tp
->
rx_mini_ptr
;
}
}
...
@@ -2074,6 +2077,7 @@ static void tg3_set_txd_addr(struct tg3 *tp, int entry, dma_addr_t mapping)
...
@@ -2074,6 +2077,7 @@ static void tg3_set_txd_addr(struct tg3 *tp, int entry, dma_addr_t mapping)
NIC_SRAM_TX_BUFFER_DESC
);
NIC_SRAM_TX_BUFFER_DESC
);
txd
+=
(
entry
*
TXD_SIZE
);
txd
+=
(
entry
*
TXD_SIZE
);
if
(
sizeof
(
dma_addr_t
)
!=
sizeof
(
u32
))
writel
(((
u64
)
mapping
>>
32
),
writel
(((
u64
)
mapping
>>
32
),
txd
+
TXD_ADDR
+
TG3_64BIT_REG_HIGH
);
txd
+
TXD_ADDR
+
TG3_64BIT_REG_HIGH
);
...
@@ -2113,10 +2117,12 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
...
@@ -2113,10 +2117,12 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
frag
->
page
,
frag
->
page_offset
,
frag
->
page
,
frag
->
page_offset
,
guilty_len
,
PCI_DMA_TODEVICE
);
guilty_len
,
PCI_DMA_TODEVICE
);
}
}
pci_unmap_single
(
tp
->
pdev
,
tp
->
tx_buffers
[
guilty_entry
].
mapping
,
pci_unmap_single
(
tp
->
pdev
,
pci_unmap_addr
(
&
tp
->
tx_buffers
[
guilty_entry
],
mapping
),
guilty_len
,
PCI_DMA_TODEVICE
);
guilty_len
,
PCI_DMA_TODEVICE
);
tg3_set_txd_addr
(
tp
,
guilty_entry
,
new_addr
);
tg3_set_txd_addr
(
tp
,
guilty_entry
,
new_addr
);
tp
->
tx_buffers
[
guilty_entry
].
mapping
=
new_addr
;
pci_unmap_addr_set
(
&
tp
->
tx_buffers
[
guilty_entry
],
mapping
,
new_addr
);
*
start
=
last_plus_one
;
*
start
=
last_plus_one
;
#else
#else
/* Oh well, no IOMMU, have to allocate a whole new SKB. */
/* Oh well, no IOMMU, have to allocate a whole new SKB. */
...
@@ -2150,11 +2156,12 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
...
@@ -2150,11 +2156,12 @@ static int tigon3_4gb_hwbug_workaround(struct tg3 *tp, struct sk_buff *skb,
len
=
skb
->
len
-
skb
->
data_len
;
len
=
skb
->
len
-
skb
->
data_len
;
else
else
len
=
skb_shinfo
(
skb
)
->
frags
[
i
-
1
].
size
;
len
=
skb_shinfo
(
skb
)
->
frags
[
i
-
1
].
size
;
pci_unmap_single
(
tp
->
pdev
,
tp
->
tx_buffers
[
entry
].
mapping
,
pci_unmap_single
(
tp
->
pdev
,
pci_unmap_addr
(
&
tp
->
tx_buffers
[
entry
],
mapping
),
len
,
PCI_DMA_TODEVICE
);
len
,
PCI_DMA_TODEVICE
);
if
(
i
==
0
)
{
if
(
i
==
0
)
{
tp
->
tx_buffers
[
entry
].
skb
=
new_skb
;
tp
->
tx_buffers
[
entry
].
skb
=
new_skb
;
tp
->
tx_buffers
[
entry
].
mapping
=
new_addr
;
pci_unmap_addr_set
(
&
tp
->
tx_buffers
[
entry
],
mapping
,
new_addr
)
;
}
else
{
}
else
{
tp
->
tx_buffers
[
entry
].
skb
=
NULL
;
tp
->
tx_buffers
[
entry
].
skb
=
NULL
;
}
}
...
@@ -2201,8 +2208,7 @@ static void tg3_set_txd(struct tg3 *tp, int entry,
...
@@ -2201,8 +2208,7 @@ static void tg3_set_txd(struct tg3 *tp, int entry,
txd
+=
(
entry
*
TXD_SIZE
);
txd
+=
(
entry
*
TXD_SIZE
);
/* Save some PIOs */
/* Save some PIOs */
if
(((
u64
)
tp
->
tx_buffers
[
entry
].
mapping
>>
32
)
!=
if
(
sizeof
(
dma_addr_t
)
!=
sizeof
(
u32
))
((
u64
)
mapping
>>
32
))
writel
(((
u64
)
mapping
>>
32
),
writel
(((
u64
)
mapping
>>
32
),
txd
+
TXD_ADDR
+
TG3_64BIT_REG_HIGH
);
txd
+
TXD_ADDR
+
TG3_64BIT_REG_HIGH
);
...
@@ -2259,9 +2265,12 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
...
@@ -2259,9 +2265,12 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
mapping
=
pci_map_single
(
tp
->
pdev
,
skb
->
data
,
len
,
PCI_DMA_TODEVICE
);
mapping
=
pci_map_single
(
tp
->
pdev
,
skb
->
data
,
len
,
PCI_DMA_TODEVICE
);
tp
->
tx_buffers
[
entry
].
skb
=
skb
;
tp
->
tx_buffers
[
entry
].
skb
=
skb
;
tp
->
tx_buffers
[
entry
].
mapping
=
mapping
;
pci_unmap_addr_set
(
&
tp
->
tx_buffers
[
entry
],
mapping
,
mapping
);
would_hit_hwbug
=
0
;
would_hit_hwbug
=
tg3_4g_overflow_test
(
mapping
,
len
);
if
(
tg3_4g_overflow_test
(
mapping
,
len
))
would_hit_hwbug
=
entry
+
1
;
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
base_flags
,
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
base_flags
,
(
skb_shinfo
(
skb
)
->
nr_frags
==
0
));
(
skb_shinfo
(
skb
)
->
nr_frags
==
0
));
...
@@ -2283,10 +2292,14 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
...
@@ -2283,10 +2292,14 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
len
,
PCI_DMA_TODEVICE
);
len
,
PCI_DMA_TODEVICE
);
tp
->
tx_buffers
[
entry
].
skb
=
NULL
;
tp
->
tx_buffers
[
entry
].
skb
=
NULL
;
tp
->
tx_buffers
[
entry
].
mapping
=
mapping
;
pci_unmap_addr_set
(
&
tp
->
tx_buffers
[
entry
],
mapping
,
mapping
)
;
would_hit_hwbug
|=
if
(
tg3_4g_overflow_test
(
mapping
,
len
))
{
tg3_4g_overflow_test
(
mapping
,
len
);
/* Only one should match. */
if
(
would_hit_hwbug
)
BUG
();
would_hit_hwbug
=
entry
+
1
;
}
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
base_flags
,
(
i
==
last
));
base_flags
,
(
i
==
last
));
...
@@ -2300,19 +2313,18 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
...
@@ -2300,19 +2313,18 @@ static int tg3_start_xmit_4gbug(struct sk_buff *skb, struct net_device *dev)
u32
start
;
u32
start
;
unsigned
int
len
=
0
;
unsigned
int
len
=
0
;
would_hit_hwbug
-=
1
;
entry
=
entry
-
1
-
skb_shinfo
(
skb
)
->
nr_frags
;
entry
=
entry
-
1
-
skb_shinfo
(
skb
)
->
nr_frags
;
entry
&=
(
TG3_TX_RING_SIZE
-
1
);
entry
&=
(
TG3_TX_RING_SIZE
-
1
);
start
=
entry
;
start
=
entry
;
i
=
0
;
i
=
0
;
while
(
entry
!=
last_plus_one
)
{
while
(
entry
!=
last_plus_one
)
{
dma_addr_t
mapping
=
tp
->
tx_buffers
[
entry
].
mapping
;
if
(
i
==
0
)
if
(
i
==
0
)
len
=
skb
->
len
-
skb
->
data_len
;
len
=
skb
->
len
-
skb
->
data_len
;
else
else
len
=
skb_shinfo
(
skb
)
->
frags
[
i
-
1
].
size
;
len
=
skb_shinfo
(
skb
)
->
frags
[
i
-
1
].
size
;
if
(
tg3_4g_overflow_test
(
mapping
,
len
)
)
if
(
entry
==
would_hit_hwbug
)
break
;
break
;
i
++
;
i
++
;
...
@@ -2392,7 +2404,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -2392,7 +2404,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
mapping
=
pci_map_single
(
tp
->
pdev
,
skb
->
data
,
len
,
PCI_DMA_TODEVICE
);
mapping
=
pci_map_single
(
tp
->
pdev
,
skb
->
data
,
len
,
PCI_DMA_TODEVICE
);
tp
->
tx_buffers
[
entry
].
skb
=
skb
;
tp
->
tx_buffers
[
entry
].
skb
=
skb
;
tp
->
tx_buffers
[
entry
].
mapping
=
mapping
;
pci_unmap_addr_set
(
&
tp
->
tx_buffers
[
entry
],
mapping
,
mapping
)
;
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
base_flags
,
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
base_flags
,
(
skb_shinfo
(
skb
)
->
nr_frags
==
0
));
(
skb_shinfo
(
skb
)
->
nr_frags
==
0
));
...
@@ -2415,7 +2427,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
...
@@ -2415,7 +2427,7 @@ static int tg3_start_xmit(struct sk_buff *skb, struct net_device *dev)
len
,
PCI_DMA_TODEVICE
);
len
,
PCI_DMA_TODEVICE
);
tp
->
tx_buffers
[
entry
].
skb
=
NULL
;
tp
->
tx_buffers
[
entry
].
skb
=
NULL
;
tp
->
tx_buffers
[
entry
].
mapping
=
mapping
;
pci_unmap_addr_set
(
&
tp
->
tx_buffers
[
entry
],
mapping
,
mapping
)
;
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
tg3_set_txd
(
tp
,
entry
,
mapping
,
len
,
base_flags
,
(
i
==
last
));
base_flags
,
(
i
==
last
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment