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
b9c58884
Commit
b9c58884
authored
Jan 10, 2004
by
Alexander Viro
Committed by
Stephen Hemminger
Jan 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[wan wanxl] eliminated hdlc_to_name() uses and a bunch of port->hdlc ones.
parent
f31b6d76
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
32 deletions
+28
-32
drivers/net/wan/wanxl.c
drivers/net/wan/wanxl.c
+28
-32
No files found.
drivers/net/wan/wanxl.c
View file @
b9c58884
...
...
@@ -82,15 +82,9 @@ typedef struct card_t {
static
inline
port_t
*
hdlc_to_port
(
hdlc_device
*
hdlc
)
{
return
(
port_t
*
)
hdlc
;
}
static
inline
port_t
*
dev_to_port
(
struct
net_device
*
dev
)
{
return
hdlc_to_port
(
dev_to_hdlc
(
dev
));
return
(
port_t
*
)
(
dev_to_hdlc
(
dev
));
}
...
...
@@ -102,7 +96,7 @@ static inline struct net_device *port_to_dev(port_t* port)
static
inline
const
char
*
port_name
(
port_t
*
port
)
{
return
hdlc_to_name
((
hdlc_device
*
)
port
)
;
return
port_to_dev
(
port
)
->
name
;
}
...
...
@@ -180,6 +174,8 @@ static inline void wanxl_cable_intr(port_t *port)
/* Transmit complete interrupt service */
static
inline
void
wanxl_tx_intr
(
port_t
*
port
)
{
struct
net_device
*
dev
=
port_to_dev
(
port
);
struct
net_device_stats
*
stats
=
&
dev_to_hdlc
(
dev
)
->
stats
;
while
(
1
)
{
desc_t
*
desc
=
&
get_status
(
port
)
->
tx_descs
[
port
->
tx_in
];
struct
sk_buff
*
skb
=
port
->
tx_skbs
[
port
->
tx_in
];
...
...
@@ -187,17 +183,17 @@ static inline void wanxl_tx_intr(port_t *port)
switch
(
desc
->
stat
)
{
case
PACKET_FULL
:
case
PACKET_EMPTY
:
netif_wake_queue
(
port_to_dev
(
port
)
);
netif_wake_queue
(
dev
);
return
;
case
PACKET_UNDERRUN
:
port
->
hdlc
.
stats
.
tx_errors
++
;
port
->
hdlc
.
stats
.
tx_fifo_errors
++
;
stats
->
tx_errors
++
;
stats
->
tx_fifo_errors
++
;
break
;
default:
port
->
hdlc
.
stats
.
tx_packets
++
;
port
->
hdlc
.
stats
.
tx_bytes
+=
skb
->
len
;
stats
->
tx_packets
++
;
stats
->
tx_bytes
+=
skb
->
len
;
}
desc
->
stat
=
PACKET_EMPTY
;
/* Free descriptor */
pci_unmap_single
(
port
->
card
->
pdev
,
desc
->
address
,
skb
->
len
,
...
...
@@ -218,13 +214,14 @@ static inline void wanxl_rx_intr(card_t *card)
struct
sk_buff
*
skb
=
card
->
rx_skbs
[
card
->
rx_in
];
port_t
*
port
=
card
->
ports
[
desc
->
stat
&
PACKET_PORT_MASK
];
struct
net_device
*
dev
=
port_to_dev
(
port
);
struct
net_device_stats
*
stats
=
&
dev_to_hdlc
(
dev
)
->
stats
;
if
((
desc
->
stat
&
PACKET_PORT_MASK
)
>
card
->
n_ports
)
printk
(
KERN_CRIT
"wanXL %s: received packet for"
" nonexistent port
\n
"
,
card_name
(
card
->
pdev
));
else
if
(
!
skb
)
port
->
hdlc
.
stats
.
rx_dropped
++
;
stats
->
rx_dropped
++
;
else
{
pci_unmap_single
(
card
->
pdev
,
desc
->
address
,
...
...
@@ -236,8 +233,8 @@ static inline void wanxl_rx_intr(card_t *card)
skb
->
len
);
debug_frame
(
skb
);
#endif
port
->
hdlc
.
stats
.
rx_packets
++
;
port
->
hdlc
.
stats
.
rx_bytes
+=
skb
->
len
;
stats
->
rx_packets
++
;
stats
->
rx_bytes
+=
skb
->
len
;
skb
->
mac
.
raw
=
skb
->
data
;
skb
->
dev
=
dev
;
dev
->
last_rx
=
jiffies
;
...
...
@@ -290,8 +287,7 @@ static irqreturn_t wanxl_intr(int irq, void* dev_id, struct pt_regs *regs)
static
int
wanxl_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
dev
)
{
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
port_t
*
port
=
hdlc_to_port
(
hdlc
);
port_t
*
port
=
dev_to_port
(
dev
);
desc_t
*
desc
;
spin_lock
(
&
port
->
lock
);
...
...
@@ -341,7 +337,7 @@ static int wanxl_xmit(struct sk_buff *skb, struct net_device *dev)
static
int
wanxl_attach
(
struct
net_device
*
dev
,
unsigned
short
encoding
,
unsigned
short
parity
)
{
port_t
*
port
=
hdlc_to_port
(
dev_to_hdlc
(
dev
)
);
port_t
*
port
=
dev_to_port
(
dev
);
if
(
encoding
!=
ENCODING_NRZ
&&
encoding
!=
ENCODING_NRZI
)
...
...
@@ -365,8 +361,7 @@ static int wanxl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
const
size_t
size
=
sizeof
(
sync_serial_settings
);
sync_serial_settings
line
;
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
port_t
*
port
=
hdlc_to_port
(
hdlc
);
port_t
*
port
=
dev_to_port
(
dev
);
if
(
cmd
!=
SIOCWANDEV
)
return
hdlc_ioctl
(
dev
,
ifr
,
cmd
);
...
...
@@ -415,8 +410,7 @@ static int wanxl_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static
int
wanxl_open
(
struct
net_device
*
dev
)
{
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
port_t
*
port
=
hdlc_to_port
(
hdlc
);
port_t
*
port
=
dev_to_port
(
dev
);
u8
*
dbr
=
port
->
card
->
plx
+
PLX_DOORBELL_TO_CARD
;
unsigned
long
timeout
;
int
i
;
...
...
@@ -450,8 +444,7 @@ static int wanxl_open(struct net_device *dev)
static
int
wanxl_close
(
struct
net_device
*
dev
)
{
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
port_t
*
port
=
hdlc_to_port
(
hdlc
);
port_t
*
port
=
dev_to_port
(
dev
);
unsigned
long
timeout
;
int
i
;
...
...
@@ -488,7 +481,7 @@ static int wanxl_close(struct net_device *dev)
static
struct
net_device_stats
*
wanxl_get_stats
(
struct
net_device
*
dev
)
{
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
port_t
*
port
=
hdlc_to_port
(
hdlc
);
port_t
*
port
=
dev_to_port
(
dev
);
hdlc
->
stats
.
rx_over_errors
=
get_status
(
port
)
->
rx_overruns
;
hdlc
->
stats
.
rx_frame_errors
=
get_status
(
port
)
->
rx_frame_errors
;
...
...
@@ -540,8 +533,10 @@ static void wanxl_pci_remove_one(struct pci_dev *pdev)
free_irq
(
card
->
irq
,
card
);
for
(
i
=
0
;
i
<
4
;
i
++
)
if
(
card
->
ports
[
i
])
unregister_hdlc_device
(
&
card
->
ports
[
i
]
->
hdlc
);
if
(
card
->
ports
[
i
])
{
struct
net_device
*
dev
=
port_to_dev
(
card
->
ports
[
i
]);
unregister_hdlc_device
(
dev_to_hdlc
(
dev
));
}
wanxl_reset
(
card
);
...
...
@@ -711,16 +706,17 @@ static int __devinit wanxl_pci_init_one(struct pci_dev *pdev,
for
(
i
=
0
;
i
<
ports
;
i
++
)
{
port_t
*
port
=
(
void
*
)
card
+
sizeof
(
card_t
)
+
i
*
sizeof
(
port_t
);
struct
net_device
*
dev
=
hdlc_to_dev
(
&
port
->
hdlc
);
struct
net_device
*
dev
=
port_to_dev
(
port
);
hdlc_device
*
hdlc
=
dev_to_hdlc
(
dev
);
spin_lock_init
(
&
port
->
lock
);
SET_MODULE_OWNER
(
dev
);
dev
->
tx_queue_len
=
50
;
dev
->
do_ioctl
=
wanxl_ioctl
;
dev
->
open
=
wanxl_open
;
dev
->
stop
=
wanxl_close
;
port
->
hdlc
.
attach
=
wanxl_attach
;
port
->
hdlc
.
xmit
=
wanxl_xmit
;
if
(
register_hdlc_device
(
&
port
->
hdlc
))
{
hdlc
->
attach
=
wanxl_attach
;
hdlc
->
xmit
=
wanxl_xmit
;
if
(
register_hdlc_device
(
dev_to_hdlc
(
dev
)
))
{
printk
(
KERN_ERR
"wanXL %s: unable to register hdlc"
" device
\n
"
,
card_name
(
pdev
));
wanxl_pci_remove_one
(
pdev
);
...
...
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