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
efdfea6a
Commit
efdfea6a
authored
Jan 10, 2004
by
François Romieu
Committed by
Jeff Garzik
Jan 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr r8169] Rx copybreak for small packets.
- removal of rtl8169_unmap_rx() (unneeded as for now).
parent
70b64316
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
8 deletions
+39
-8
drivers/net/r8169.c
drivers/net/r8169.c
+39
-8
No files found.
drivers/net/r8169.c
View file @
efdfea6a
...
@@ -116,6 +116,8 @@ static struct pci_device_id rtl8169_pci_tbl[] = {
...
@@ -116,6 +116,8 @@ static struct pci_device_id rtl8169_pci_tbl[] = {
MODULE_DEVICE_TABLE
(
pci
,
rtl8169_pci_tbl
);
MODULE_DEVICE_TABLE
(
pci
,
rtl8169_pci_tbl
);
static
int
rx_copybreak
=
200
;
enum
RTL8169_registers
{
enum
RTL8169_registers
{
MAC0
=
0
,
/* Ethernet hardware address. */
MAC0
=
0
,
/* Ethernet hardware address. */
MAR0
=
8
,
/* Multicast filter. */
MAR0
=
8
,
/* Multicast filter. */
...
@@ -294,6 +296,7 @@ struct rtl8169_private {
...
@@ -294,6 +296,7 @@ struct rtl8169_private {
MODULE_AUTHOR
(
"Realtek"
);
MODULE_AUTHOR
(
"Realtek"
);
MODULE_DESCRIPTION
(
"RealTek RTL-8169 Gigabit Ethernet driver"
);
MODULE_DESCRIPTION
(
"RealTek RTL-8169 Gigabit Ethernet driver"
);
MODULE_PARM
(
media
,
"1-"
__MODULE_STRING
(
MAX_UNITS
)
"i"
);
MODULE_PARM
(
media
,
"1-"
__MODULE_STRING
(
MAX_UNITS
)
"i"
);
MODULE_PARM
(
rx_copybreak
,
"i"
);
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
static
int
rtl8169_open
(
struct
net_device
*
dev
);
static
int
rtl8169_open
(
struct
net_device
*
dev
);
...
@@ -768,6 +771,11 @@ static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
...
@@ -768,6 +771,11 @@ static void rtl8169_free_rx_skb(struct pci_dev *pdev, struct sk_buff **sk_buff,
rtl8169_make_unusable_by_asic
(
desc
);
rtl8169_make_unusable_by_asic
(
desc
);
}
}
static
inline
void
rtl8169_return_to_asic
(
struct
RxDesc
*
desc
)
{
desc
->
status
|=
OWNbit
+
RX_BUF_SIZE
;
}
static
inline
void
rtl8169_give_to_asic
(
struct
RxDesc
*
desc
,
dma_addr_t
mapping
)
static
inline
void
rtl8169_give_to_asic
(
struct
RxDesc
*
desc
,
dma_addr_t
mapping
)
{
{
desc
->
buf_addr
=
mapping
;
desc
->
buf_addr
=
mapping
;
...
@@ -1012,12 +1020,26 @@ rtl8169_tx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
...
@@ -1012,12 +1020,26 @@ rtl8169_tx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
}
}
}
}
static
inline
void
rtl8169_unmap_rx
(
struct
pci_dev
*
pdev
,
struct
RxDesc
*
desc
)
static
inline
int
rtl8169_try_rx_copy
(
struct
sk_buff
**
sk_buff
,
int
pkt_size
,
struct
RxDesc
*
desc
,
struct
net_device
*
dev
)
{
{
pci_dma_sync_single
(
pdev
,
le32_to_cpu
(
desc
->
buf_addr
),
RX_BUF_SIZE
,
int
ret
=
-
1
;
PCI_DMA_FROMDEVICE
);
pci_unmap_single
(
pdev
,
le32_to_cpu
(
desc
->
buf_addr
),
RX_BUF_SIZE
,
if
(
pkt_size
<
rx_copybreak
)
{
PCI_DMA_FROMDEVICE
);
struct
sk_buff
*
skb
;
skb
=
dev_alloc_skb
(
pkt_size
+
2
);
if
(
skb
)
{
skb
->
dev
=
dev
;
skb_reserve
(
skb
,
2
);
eth_copy_and_sum
(
skb
,
sk_buff
[
0
]
->
tail
,
pkt_size
,
0
);
*
sk_buff
=
skb
;
rtl8169_return_to_asic
(
desc
);
ret
=
0
;
}
}
return
ret
;
}
}
static
void
static
void
...
@@ -1043,17 +1065,26 @@ rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
...
@@ -1043,17 +1065,26 @@ rtl8169_rx_interrupt(struct net_device *dev, struct rtl8169_private *tp,
if
(
status
&
RxCRC
)
if
(
status
&
RxCRC
)
tp
->
stats
.
rx_crc_errors
++
;
tp
->
stats
.
rx_crc_errors
++
;
}
else
{
}
else
{
struct
RxDesc
*
desc
=
tp
->
RxDescArray
+
cur_rx
;
struct
sk_buff
*
skb
=
tp
->
Rx_skbuff
[
cur_rx
];
struct
sk_buff
*
skb
=
tp
->
Rx_skbuff
[
cur_rx
];
int
pkt_size
=
(
status
&
0x00001FFF
)
-
4
;
int
pkt_size
=
(
status
&
0x00001FFF
)
-
4
;
rtl8169_unmap_rx
(
tp
->
pci_dev
,
tp
->
RxDescArray
+
cur_rx
);
pci_dma_sync_single
(
tp
->
pci_dev
,
le32_to_cpu
(
desc
->
buf_addr
),
RX_BUF_SIZE
,
PCI_DMA_FROMDEVICE
);
if
(
rtl8169_try_rx_copy
(
&
skb
,
pkt_size
,
desc
,
dev
))
{
pci_unmap_single
(
tp
->
pci_dev
,
le32_to_cpu
(
desc
->
buf_addr
),
RX_BUF_SIZE
,
PCI_DMA_FROMDEVICE
);
tp
->
Rx_skbuff
[
cur_rx
]
=
NULL
;
}
skb_put
(
skb
,
pkt_size
);
skb_put
(
skb
,
pkt_size
);
skb
->
protocol
=
eth_type_trans
(
skb
,
dev
);
skb
->
protocol
=
eth_type_trans
(
skb
,
dev
);
netif_rx
(
skb
);
netif_rx
(
skb
);
tp
->
Rx_skbuff
[
cur_rx
]
=
NULL
;
dev
->
last_rx
=
jiffies
;
dev
->
last_rx
=
jiffies
;
tp
->
stats
.
rx_bytes
+=
pkt_size
;
tp
->
stats
.
rx_bytes
+=
pkt_size
;
tp
->
stats
.
rx_packets
++
;
tp
->
stats
.
rx_packets
++
;
...
...
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