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
nexedi
linux
Commits
a58333d2
Commit
a58333d2
authored
Jun 21, 2004
by
Herbert Xu
Committed by
David S. Miller
Jun 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: In sungem driver, keep track of rx buffer alloc size based upon MTU.
parent
113dc07d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
drivers/net/sungem.c
drivers/net/sungem.c
+8
-4
drivers/net/sungem.h
drivers/net/sungem.h
+2
-1
No files found.
drivers/net/sungem.c
View file @
a58333d2
...
...
@@ -33,6 +33,7 @@
#include <linux/crc32.h>
#include <linux/random.h>
#include <linux/workqueue.h>
#include <linux/if_vlan.h>
#include <asm/system.h>
#include <asm/bitops.h>
...
...
@@ -742,7 +743,7 @@ static void gem_rx(struct gem *gp)
PCI_DMA_FROMDEVICE
);
gp
->
rx_skbs
[
entry
]
=
new_skb
;
new_skb
->
dev
=
gp
->
dev
;
skb_put
(
new_skb
,
(
ETH_FRAME_LEN
+
RX_OFFSET
));
skb_put
(
new_skb
,
(
gp
->
rx_buf_sz
+
RX_OFFSET
));
rxd
->
buffer
=
cpu_to_le64
(
pci_map_page
(
gp
->
pdev
,
virt_to_page
(
new_skb
->
data
),
offset_in_page
(
new_skb
->
data
),
...
...
@@ -1482,6 +1483,9 @@ static void gem_init_rings(struct gem *gp)
gem_clean_rings
(
gp
);
gp
->
rx_buf_sz
=
max
(
dev
->
mtu
+
ETH_HLEN
+
VLAN_HLEN
,
(
unsigned
)
VLAN_ETH_FRAME_LEN
);
for
(
i
=
0
;
i
<
RX_RING_SIZE
;
i
++
)
{
struct
sk_buff
*
skb
;
struct
gem_rxd
*
rxd
=
&
gb
->
rxd
[
i
];
...
...
@@ -1495,7 +1499,7 @@ static void gem_init_rings(struct gem *gp)
gp
->
rx_skbs
[
i
]
=
skb
;
skb
->
dev
=
dev
;
skb_put
(
skb
,
(
ETH_FRAME_LEN
+
RX_OFFSET
));
skb_put
(
skb
,
(
gp
->
rx_buf_sz
+
RX_OFFSET
));
dma_addr
=
pci_map_page
(
gp
->
pdev
,
virt_to_page
(
skb
->
data
),
offset_in_page
(
skb
->
data
),
...
...
@@ -1750,7 +1754,7 @@ static void gem_init_mac(struct gem *gp)
writel
(
0x40
,
gp
->
regs
+
MAC_MINFSZ
);
/* Ethernet payload + header + FCS + optional VLAN tag. */
writel
(
0x20000000
|
(
gp
->
dev
->
mtu
+
ETH_HLEN
+
4
+
4
),
gp
->
regs
+
MAC_MAXFSZ
);
writel
(
0x20000000
|
(
gp
->
rx_buf_sz
+
4
),
gp
->
regs
+
MAC_MAXFSZ
);
writel
(
0x07
,
gp
->
regs
+
MAC_PASIZE
);
writel
(
0x04
,
gp
->
regs
+
MAC_JAMSIZE
);
...
...
@@ -1827,7 +1831,7 @@ static void gem_init_pause_thresholds(struct gem *gp)
if
(
gp
->
rx_fifo_sz
<=
(
2
*
1024
))
{
gp
->
rx_pause_off
=
gp
->
rx_pause_on
=
gp
->
rx_fifo_sz
;
}
else
{
int
max_frame
=
(
gp
->
dev
->
mtu
+
ETH_HLEN
+
4
+
4
+
64
)
&
~
63
;
int
max_frame
=
(
gp
->
rx_buf_sz
+
4
+
64
)
&
~
63
;
int
off
=
(
gp
->
rx_fifo_sz
-
(
max_frame
*
2
));
int
on
=
off
-
max_frame
;
...
...
drivers/net/sungem.h
View file @
a58333d2
...
...
@@ -911,7 +911,7 @@ struct gem_rxd {
(GP)->tx_old - (GP)->tx_new - 1)
#define RX_OFFSET 2
#define RX_BUF_ALLOC_SIZE(gp) ((gp)->
dev->mtu + 46
+ RX_OFFSET + 64)
#define RX_BUF_ALLOC_SIZE(gp) ((gp)->
rx_buf_sz + 28
+ RX_OFFSET + 64)
#define RX_COPY_THRESHOLD 256
...
...
@@ -979,6 +979,7 @@ struct gem {
int
rx_fifo_sz
;
int
rx_pause_off
;
int
rx_pause_on
;
int
rx_buf_sz
;
int
mii_phy_addr
;
u32
mac_rx_cfg
;
...
...
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