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
1c306ffb
Commit
1c306ffb
authored
Sep 25, 2003
by
Chas Williams
Committed by
David S. Miller
Sep 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[ATM]: [ioctl][4/8] Use new code for mpoa (from levon@movementarian.org)
parent
8bedf7c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
78 deletions
+37
-78
net/atm/ioctl.c
net/atm/ioctl.c
+5
-60
net/atm/mpc.c
net/atm/mpc.c
+32
-6
net/atm/mpc.h
net/atm/mpc.h
+0
-12
No files found.
net/atm/ioctl.c
View file @
1c306ffb
...
@@ -14,6 +14,7 @@
...
@@ -14,6 +14,7 @@
#include <linux/atmarp.h>
/* manifest constants */
#include <linux/atmarp.h>
/* manifest constants */
#include <linux/sonet.h>
/* for ioctls */
#include <linux/sonet.h>
/* for ioctls */
#include <linux/atmsvc.h>
#include <linux/atmsvc.h>
#include <linux/atmmpc.h>
#include <asm/ioctls.h>
#include <asm/ioctls.h>
#ifdef CONFIG_ATM_CLIP
#ifdef CONFIG_ATM_CLIP
...
@@ -54,36 +55,6 @@ EXPORT_SYMBOL(atm_lane_ops_set);
...
@@ -54,36 +55,6 @@ EXPORT_SYMBOL(atm_lane_ops_set);
#endif
#endif
#endif
#endif
#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
#include <linux/atmmpc.h>
#include "mpc.h"
struct
atm_mpoa_ops
*
atm_mpoa_ops
;
static
DECLARE_MUTEX
(
atm_mpoa_ops_mutex
);
void
atm_mpoa_ops_set
(
struct
atm_mpoa_ops
*
hook
)
{
down
(
&
atm_mpoa_ops_mutex
);
atm_mpoa_ops
=
hook
;
up
(
&
atm_mpoa_ops_mutex
);
}
int
try_atm_mpoa_ops
(
void
)
{
down
(
&
atm_mpoa_ops_mutex
);
if
(
atm_mpoa_ops
&&
try_module_get
(
atm_mpoa_ops
->
owner
))
{
up
(
&
atm_mpoa_ops_mutex
);
return
1
;
}
up
(
&
atm_mpoa_ops_mutex
);
return
0
;
}
#ifdef CONFIG_ATM_MPOA_MODULE
EXPORT_SYMBOL
(
atm_mpoa_ops
);
EXPORT_SYMBOL
(
try_atm_mpoa_ops
);
EXPORT_SYMBOL
(
atm_mpoa_ops_set
);
#endif
#endif
#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
#include <linux/atm_tcp.h>
#include <linux/atm_tcp.h>
#ifdef CONFIG_ATM_TCP_MODULE
#ifdef CONFIG_ATM_TCP_MODULE
...
@@ -309,36 +280,6 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
...
@@ -309,36 +280,6 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
error
=
-
ENOSYS
;
error
=
-
ENOSYS
;
goto
done
;
goto
done
;
#endif
#endif
#if defined(CONFIG_ATM_MPOA) || defined(CONFIG_ATM_MPOA_MODULE)
case
ATMMPC_CTRL
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
#if defined(CONFIG_ATM_MPOA_MODULE)
if
(
!
atm_mpoa_ops
)
request_module
(
"mpoa"
);
#endif
if
(
try_atm_mpoa_ops
())
{
error
=
atm_mpoa_ops
->
mpoad_attach
(
vcc
,
(
int
)
arg
);
module_put
(
atm_mpoa_ops
->
owner
);
if
(
error
>=
0
)
sock
->
state
=
SS_CONNECTED
;
}
else
error
=
-
ENOSYS
;
goto
done
;
case
ATMMPC_DATA
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
error
=
-
EPERM
;
goto
done
;
}
if
(
try_atm_mpoa_ops
())
{
error
=
atm_mpoa_ops
->
vcc_attach
(
vcc
,
arg
);
module_put
(
atm_mpoa_ops
->
owner
);
}
else
error
=
-
ENOSYS
;
goto
done
;
#endif
#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
#if defined(CONFIG_ATM_TCP) || defined(CONFIG_ATM_TCP_MODULE)
case
SIOCSIFATMTCP
:
case
SIOCSIFATMTCP
:
if
(
!
capable
(
CAP_NET_ADMIN
))
{
if
(
!
capable
(
CAP_NET_ADMIN
))
{
...
@@ -385,6 +326,10 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
...
@@ -385,6 +326,10 @@ int vcc_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
default:
default:
break
;
break
;
}
}
if
(
cmd
==
ATMMPC_CTRL
||
cmd
==
ATMMPC_DATA
)
request_module
(
"mpoa"
);
error
=
-
ENOIOCTLCMD
;
error
=
-
ENOIOCTLCMD
;
down
(
&
ioctl_mutex
);
down
(
&
ioctl_mutex
);
...
...
net/atm/mpc.c
View file @
1c306ffb
...
@@ -1400,15 +1400,41 @@ static void mpc_cache_check( unsigned long checking_time )
...
@@ -1400,15 +1400,41 @@ static void mpc_cache_check( unsigned long checking_time )
return
;
return
;
}
}
static
struct
atm_mpoa_ops
__atm_mpoa_ops
=
{
static
int
atm_mpoa_ioctl
(
struct
socket
*
sock
,
unsigned
int
cmd
,
unsigned
long
arg
)
.
mpoad_attach
=
atm_mpoa_mpoad_attach
,
{
.
vcc_attach
=
atm_mpoa_vcc_attach
,
int
err
=
0
;
.
owner
=
THIS_MODULE
struct
atm_vcc
*
vcc
=
ATM_SD
(
sock
);
if
(
cmd
!=
ATMMPC_CTRL
&&
cmd
!=
ATMMPC_DATA
)
return
-
ENOIOCTLCMD
;
if
(
!
capable
(
CAP_NET_ADMIN
))
return
-
EPERM
;
switch
(
cmd
)
{
case
ATMMPC_CTRL
:
err
=
atm_mpoa_mpoad_attach
(
vcc
,
(
int
)
arg
);
if
(
err
>=
0
)
sock
->
state
=
SS_CONNECTED
;
break
;
case
ATMMPC_DATA
:
err
=
atm_mpoa_vcc_attach
(
vcc
,
arg
);
break
;
default:
break
;
}
return
err
;
}
static
struct
atm_ioctl
atm_ioctl_ops
=
{
.
owner
=
THIS_MODULE
,
.
ioctl
=
atm_mpoa_ioctl
,
};
};
static
__init
int
atm_mpoa_init
(
void
)
static
__init
int
atm_mpoa_init
(
void
)
{
{
atm_mpoa_ops_set
(
&
__atm_mpoa
_ops
);
register_atm_ioctl
(
&
atm_ioctl
_ops
);
#ifdef CONFIG_PROC_FS
#ifdef CONFIG_PROC_FS
if
(
mpc_proc_init
()
!=
0
)
if
(
mpc_proc_init
()
!=
0
)
...
@@ -1434,7 +1460,7 @@ void __exit atm_mpoa_cleanup(void)
...
@@ -1434,7 +1460,7 @@ void __exit atm_mpoa_cleanup(void)
del_timer
(
&
mpc_timer
);
del_timer
(
&
mpc_timer
);
unregister_netdevice_notifier
(
&
mpoa_notifier
);
unregister_netdevice_notifier
(
&
mpoa_notifier
);
atm_mpoa_ops_set
(
NULL
);
deregister_atm_ioctl
(
&
atm_ioctl_ops
);
mpc
=
mpcs
;
mpc
=
mpcs
;
mpcs
=
NULL
;
mpcs
=
NULL
;
...
...
net/atm/mpc.h
View file @
1c306ffb
...
@@ -44,18 +44,6 @@ struct atm_mpoa_qos {
...
@@ -44,18 +44,6 @@ struct atm_mpoa_qos {
};
};
/* Functions to call during ioctl(ATMMPC, ) */
struct
atm_mpoa_ops
{
int
(
*
mpoad_attach
)(
struct
atm_vcc
*
vcc
,
int
arg
);
/* attach mpoa daemon */
int
(
*
vcc_attach
)(
struct
atm_vcc
*
vcc
,
long
arg
);
/* attach shortcut vcc */
struct
module
*
owner
;
};
/* Boot/module initialization function */
extern
struct
atm_mpoa_ops
*
atm_mpoa_ops
;
int
try_atm_mpoa_ops
(
void
);
void
atm_mpoa_ops_set
(
struct
atm_mpoa_ops
*
hook
);
/* MPOA QoS operations */
/* MPOA QoS operations */
struct
atm_mpoa_qos
*
atm_mpoa_add_qos
(
uint32_t
dst_ip
,
struct
atm_qos
*
qos
);
struct
atm_mpoa_qos
*
atm_mpoa_add_qos
(
uint32_t
dst_ip
,
struct
atm_qos
*
qos
);
struct
atm_mpoa_qos
*
atm_mpoa_search_qos
(
uint32_t
dst_ip
);
struct
atm_mpoa_qos
*
atm_mpoa_search_qos
(
uint32_t
dst_ip
);
...
...
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