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
63f3ca28
Commit
63f3ca28
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 hdlc_fr] Switched allocation of net_device to alloc_netdev().
parent
ec47df58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
drivers/net/wan/hdlc_fr.c
drivers/net/wan/hdlc_fr.c
+18
-15
No files found.
drivers/net/wan/hdlc_fr.c
View file @
63f3ca28
...
...
@@ -378,8 +378,7 @@ int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
static
inline
struct
net_device_stats
*
pvc_get_stats
(
struct
net_device
*
dev
)
{
return
(
struct
net_device_stats
*
)
((
char
*
)
dev
+
sizeof
(
struct
net_device
));
return
netdev_priv
(
dev
);
}
...
...
@@ -997,7 +996,13 @@ static void fr_close(struct net_device *dev)
}
}
static
void
dlci_setup
(
struct
net_device
*
dev
)
{
dev
->
type
=
ARPHRD_DLCI
;
dev
->
flags
=
IFF_POINTOPOINT
;
dev
->
hard_header_len
=
10
;
dev
->
addr_len
=
2
;
}
static
int
fr_add_pvc
(
struct
net_device
*
master
,
unsigned
int
dlci
,
int
type
)
{
...
...
@@ -1021,26 +1026,24 @@ static int fr_add_pvc(struct net_device *master, unsigned int dlci, int type)
used
=
pvc_is_used
(
pvc
);
dev
=
kmalloc
(
sizeof
(
struct
net_device
)
+
sizeof
(
struct
net_device_stats
),
GFP_KERNEL
);
if
(
type
==
ARPHRD_ETHER
)
dev
=
alloc_netdev
(
sizeof
(
struct
net_device_stats
),
"pvceth%d"
,
ether_setup
);
else
dev
=
alloc_netdev
(
sizeof
(
struct
net_device_stats
),
"pvc%d"
,
dlci_setup
);
if
(
!
dev
)
{
printk
(
KERN_WARNING
"%s: Memory squeeze on fr_pvc()
\n
"
,
master
->
name
);
delete_unused_pvcs
(
hdlc
);
return
-
ENOBUFS
;
}
memset
(
dev
,
0
,
sizeof
(
struct
net_device
)
+
sizeof
(
struct
net_device_stats
));
if
(
type
==
ARPHRD_ETHER
)
{
ether_setup
(
dev
);
memcpy
(
dev
->
dev_addr
,
"
\x00\x01
"
,
2
);
get_random_bytes
(
dev
->
dev_addr
+
2
,
ETH_ALEN
-
2
);
}
else
{
dev
->
type
=
ARPHRD_DLCI
;
dev
->
flags
=
IFF_POINTOPOINT
;
dev
->
hard_header_len
=
10
;
dev
->
addr_len
=
2
;
*
(
u16
*
)
dev
->
dev_addr
=
htons
(
dlci
);
dlci_to_q922
(
dev
->
broadcast
,
dlci
);
}
...
...
@@ -1054,15 +1057,15 @@ static int fr_add_pvc(struct net_device *master, unsigned int dlci, int type)
dev
->
tx_queue_len
=
0
;
dev
->
priv
=
pvc
;
result
=
dev_alloc_name
(
dev
,
prefix
);
result
=
dev_alloc_name
(
dev
,
dev
->
name
);
if
(
result
<
0
)
{
kfree
(
dev
);
free_netdev
(
dev
);
delete_unused_pvcs
(
hdlc
);
return
result
;
}
if
(
register_netdevice
(
dev
)
!=
0
)
{
kfree
(
dev
);
free_netdev
(
dev
);
delete_unused_pvcs
(
hdlc
);
return
-
EIO
;
}
...
...
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