Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xcap
xcap-capability-linux
Commits
6abf74b2
Commit
6abf74b2
authored
Jan 15, 2017
by
Vikram Narayanan
Browse files
lcd/testmod: Fix reg/unreg for nullnet
reg/unreg works Signed-off-by:
Vikram Narayanan
<
vikram186@gmail.com
>
parent
c0d05162
Changes
11
Hide whitespace changes
Inline
Side-by-side
lcd-domains/test_mods/nullnet/boot/main.c
View file @
6abf74b2
...
...
@@ -18,7 +18,7 @@ static int boot_main(void)
int
ret
;
cptr_t
net_chnl
;
cptr_t
net_chnl_domain_cptr
,
dummy_chnl_domain_cptr
;
cptr_t
net_lcd
,
dummy_lcd
;
cptr_t
net_
k
lcd
,
dummy_lcd
;
struct
lcd_create_ctx
*
dummy_ctx
;
/*
* Enter lcd mode
...
...
@@ -41,7 +41,7 @@ static int boot_main(void)
ret
=
lcd_create_module_klcd
(
LCD_DIR
(
"nullnet/net_klcd"
),
"lcd_test_mod_nullnet_net_klcd"
,
&
net_lcd
);
&
net_
k
lcd
);
if
(
ret
)
{
LIBLCD_ERR
(
"failed to create net klcd"
);
...
...
@@ -71,7 +71,7 @@ static int boot_main(void)
/* ---------- Set up boot info ---------- */
// HACK: But WTF is this?
net_chnl_domain_cptr
=
__cptr
(
3
);
ret
=
lcd_cap_grant
(
net_lcd
,
net_chnl
,
net_chnl_domain_cptr
);
ret
=
lcd_cap_grant
(
net_
k
lcd
,
net_chnl
,
net_chnl_domain_cptr
);
if
(
ret
)
{
LIBLCD_ERR
(
"grant"
);
goto
fail7
;
...
...
@@ -83,16 +83,12 @@ static int boot_main(void)
/* ---------- RUN! ---------- */
LIBLCD_MSG
(
"starting network..."
);
ret
=
lcd_run
(
net_lcd
);
ret
=
lcd_run
(
net_
k
lcd
);
if
(
ret
)
{
LIBLCD_ERR
(
"failed to start vfs lcd"
);
goto
fail8
;
}
/* Wait a few moments so vfs lcd has a chance to enter its
* dispatch loop. This is obviously a hack. You could use some
* kind of protocol to wait for the vfs to signal it is ready. */
//msleep(2000);
LIBLCD_MSG
(
"starting dummy ethernet..."
);
ret
=
lcd_run
(
dummy_lcd
);
if
(
ret
)
{
...
...
@@ -102,7 +98,7 @@ static int boot_main(void)
/*
* Wait for 4 seconds
*/
msleep
(
4
000
);
msleep
(
10
000
);
/*
* Tear everything down
*/
...
...
@@ -120,7 +116,8 @@ fail7:
fail6:
fail5:
fail4:
lcd_cap_delete
(
net_lcd
);
//lcd_cap_delete(net_klcd);
lcd_destroy_module_klcd
(
net_klcd
,
"lcd_test_mod_nullnet_net_klcd"
);
fail3:
fail2:
lcd_exit
(
0
);
/* will free endpoints */
...
...
lcd-domains/test_mods/nullnet/dummy_lcd/dummy.c
View file @
6abf74b2
...
...
@@ -209,7 +209,7 @@ static struct rtnl_link_ops dummy_link_ops __read_mostly = {
module_param
(
numdummies
,
int
,
0
);
MODULE_PARM_DESC
(
numdummies
,
"Number of dummy pseudo devices"
);
#endif
#if 0
#ifdef LCD_ISOLATE
static int dummy_init_one(void)
#else
...
...
@@ -233,30 +233,31 @@ err:
free_netdev
(
dev_dummy
);
return
err
;
}
#endif
#ifndef LCD_ISOLATE
static
int
__init
dummy_init_module
(
void
)
#else
int
dummy_init_module
(
void
)
#endif
{
int
i
,
err
=
0
;
int
i
;
int
err
=
0
;
rtnl_lock
();
//
rtnl_lock();
err
=
__rtnl_link_register
(
&
dummy_link_ops_container
.
rtnl_link_ops
);
if
(
err
<
0
)
goto
out
;
for
(
i
=
0
;
i
<
numdummies
&&
!
err
;
i
++
)
{
err
=
dummy_init_one
();
cond_resched
();
//
err = dummy_init_one();
//
cond_resched();
}
if
(
err
<
0
)
/*
if (err < 0)
__rtnl_link_unregister(&dummy_link_ops_container.rtnl_link_ops);
*/
out:
rtnl_unlock
();
// rtnl_unlock();
return
err
;
}
...
...
lcd-domains/test_mods/nullnet/dummy_lcd/glue/dispatch.c
View file @
6abf74b2
#include <lcd_config/pre_hook.h>
#include <liblcd/liblcd.h>
#include "../nullnet_caller.h"
#include <lcd_config/post_hook.h>
int
dispatch_async_loop
(
struct
thc_channel
*
channel
,
struct
fipc_message
*
message
,
struct
glue_cspace
*
cspace
,
struct
cptr
sync_ep
)
{
int
fn_type
;
fn_type
=
async_msg_get_fn_type
(
message
);
switch
(
fn_type
)
{
case
NDO_INIT
:
LIBLCD_MSG
(
"Calling function ndo_init"
);
return
ndo_init_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
NDO_UNINIT
:
LIBLCD_MSG
(
"Calling function ndo_uninit"
);
return
ndo_uninit_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
NDO_START_XMIT
:
LIBLCD_MSG
(
"Calling function ndo_start_xmit"
);
return
ndo_start_xmit_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
NDO_VALIDATE_ADDR
:
LIBLCD_MSG
(
"Calling function ndo_validate_addr"
);
return
ndo_validate_addr_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
NDO_GET_STATS64
:
LIBLCD_MSG
(
"Calling function ndo_get_stats64"
);
return
ndo_get_stats64_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
NDO_SET_RX_MODE
:
LIBLCD_MSG
(
"Calling function ndo_set_rx_mode"
);
return
ndo_set_rx_mode_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
NDO_SET_MAC_ADDRESS
:
LIBLCD_MSG
(
"Calling function ndo_set_mac_address"
);
return
ndo_set_mac_address_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
NDO_CHANGE_CARRIER
:
LIBLCD_MSG
(
"Calling function ndo_change_carrier"
);
return
ndo_change_carrier_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
SETUP
:
LIBLCD_MSG
(
"Calling function setup"
);
return
setup_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
case
VALIDATE
:
LIBLCD_MSG
(
"Calling function validate"
);
return
validate_callee
(
message
,
channel
,
cspace
,
sync_ep
);
break
;
}
return
0
;
}
lcd-domains/test_mods/nullnet/dummy_lcd/glue/nullnet_caller.c
View file @
6abf74b2
...
...
@@ -45,6 +45,7 @@ static int setup_async_channel(cptr_t *buf1_cptr_out, cptr_t *buf2_cptr_out,
struct
fipc_ring_channel
*
fchnl
;
struct
thc_channel
*
chnl
;
unsigned
int
pg_order
=
PMFS_ASYNC_RPC_BUFFER_ORDER
-
PAGE_SHIFT
;
LIBLCD_MSG
(
"%s
\n
"
,
__func__
);
/*
* Allocate buffers
*
...
...
@@ -86,6 +87,7 @@ static int setup_async_channel(cptr_t *buf1_cptr_out, cptr_t *buf2_cptr_out,
LIBLCD_ERR
(
"prep buffers"
);
goto
fail5
;
}
LIBLCD_MSG
(
"==> Prep buffers"
);
/*
* Alloc and init channel header
*/
...
...
@@ -102,6 +104,17 @@ static int setup_async_channel(cptr_t *buf1_cptr_out, cptr_t *buf2_cptr_out,
LIBLCD_ERR
(
"ring chnl init"
);
goto
fail7
;
}
{
size_t
sz
=
sizeof
(
*
chnl
);
int
idx
=
kmalloc_index
(
sz
);
int
i
=
0
;
for
(
i
=
0
;
i
<
sizeof
(
kmalloc_caches
)
/
sizeof
(
kmalloc_caches
[
0
]);
i
++
)
{
printk
(
"--> idx %d | cache addr %p
\n
"
,
i
,
kmalloc_caches
[
i
]);
}
LIBLCD_MSG
(
"==> Prep buffers 2, size %zu | idx %d | ptr %p"
,
sz
,
idx
,
kmalloc_caches
[
idx
]);
}
/*
* Install async channel in async dispatch loop
*/
...
...
@@ -189,14 +202,13 @@ fail1:
return
;
}
cptr_t
net_sync_endpoint
;
extern
cptr_t
nullnet_sync_endpoint
;
extern
cptr_t
nullnet_register_channel
;
int
__rtnl_link_register
(
struct
rtnl_link_ops
*
ops
)
{
struct
rtnl_link_ops_container
*
ops_container
;
int
err
;
struct
fipc_message
*
request
;
struct
fipc_message
*
response
;
cptr_t
tx
,
rx
;
struct
thc_channel
*
chnl
;
int
ret
;
...
...
@@ -204,7 +216,7 @@ int __rtnl_link_register(struct rtnl_link_ops *ops)
/*
* Set up async and sync channels
*/
ret
=
lcd_create_sync_endpoint
(
&
net_sync_endpoint
);
ret
=
lcd_create_sync_endpoint
(
&
null
net_sync_endpoint
);
if
(
ret
)
{
LIBLCD_ERR
(
"lcd_create_sync_endpoint"
);
goto
fail1
;
...
...
@@ -216,31 +228,49 @@ int __rtnl_link_register(struct rtnl_link_ops *ops)
}
ops_container
=
container_of
(
ops
,
struct
rtnl_link_ops_container
,
rtnl_link_ops
);
LIBLCD_MSG
(
"Retrieve container ops %p
\n
"
,
ops_container
);
err
=
glue_cap_insert_rtnl_link_ops_type
(
c_cspace
,
ops_container
,
&
ops_container
->
my_ref
);
if
(
err
)
{
LIBLCD_ERR
(
"lcd insert"
);
lcd_exit
(
-
1
);
}
ret
=
async_msg_blocking_send_start
(
net_async
,
&
request
);
if
(
ret
)
{
LIBLCD_ERR
(
"failed to get a send slot"
);
lcd_exit
(
-
1
);
}
async_msg_set_fn_type
(
request
,
__RTNL_LINK_REGISTER
);
fipc_set_reg2
(
request
,
ops_container
->
my_ref
.
cptr
);
// fipc_set_reg1(request, ops->kind);
err
=
thc_ipc_call
(
net_async
,
request
,
&
response
);
if
(
err
)
{
LIBLCD_ERR
(
"thc_ipc_call"
);
lcd_exit
(
-
1
);
goto
fail3
;
}
ops_container
->
other_ref
.
cptr
=
fipc_get_reg2
(
response
);
ret
=
fipc_get_reg2
(
response
);
fipc_recv_msg_end
(
thc_channel_to_fipc
(
net_async
),
response
);
lcd_set_r0
(
__RTNL_LINK_REGISTER
);
lcd_set_r1
(
cptr_val
(
ops_container
->
my_ref
));
lcd_set_cr0
(
nullnet_sync_endpoint
);
lcd_set_cr1
(
rx
);
lcd_set_cr2
(
tx
);
ret
=
lcd_sync_call
(
nullnet_register_channel
);
/*
* Flush cap registers
*/
lcd_set_cr0
(
CAP_CPTR_NULL
);
lcd_set_cr1
(
CAP_CPTR_NULL
);
lcd_set_cr2
(
CAP_CPTR_NULL
);
if
(
ret
)
{
LIBLCD_ERR
(
"lcd_call"
);
goto
fail4
;
}
ret
=
lcd_r0
();
printk
(
"%s: Got %d
\n
"
,
__func__
,
ret
);
if
(
ret
<
0
)
{
LIBLCD_ERR
(
"remote register fs failed"
);
goto
fail5
;
}
ops_container
->
other_ref
.
cptr
=
lcd_r1
();
net_async
=
chnl
;
return
ret
;
fail5:
fail4:
glue_cap_remove
(
c_cspace
,
ops_container
->
my_ref
);
fail3:
destroy_async_channel
(
chnl
);
fail2:
lcd_cap_delete
(
net_sync_endpoint
);
lcd_cap_delete
(
null
net_sync_endpoint
);
fail1:
return
ret
;
...
...
@@ -497,7 +527,7 @@ void rtnl_link_unregister(struct rtnl_link_ops *ops)
ret
=
async_msg_blocking_send_start
(
net_async
,
&
request
);
if
(
ret
)
{
LIBLCD_ERR
(
"failed to get a send slot"
);
lcd_exit
(
-
1
)
;
goto
fail1
;
}
async_msg_set_fn_type
(
request
,
RTNL_LINK_UNREGISTER
);
fipc_set_reg2
(
request
,
ops_container
->
my_ref
.
cptr
);
...
...
@@ -505,12 +535,15 @@ void rtnl_link_unregister(struct rtnl_link_ops *ops)
err
=
thc_ipc_call
(
net_async
,
request
,
&
response
);
if
(
err
)
{
LIBLCD_ERR
(
"thc_ipc_call"
);
lcd_exit
(
-
1
)
;
goto
fail2
;
}
glue_cap_remove
(
c_cspace
,
ops_container
->
my_ref
);
fipc_recv_msg_end
(
thc_channel_to_fipc
(
net_async
),
response
);
lcd_cap_delete
(
nullnet_sync_endpoint
);
destroy_async_channel
(
net_async
);
fail2:
fail1:
return
;
}
...
...
@@ -582,7 +615,7 @@ void consume_skb(struct sk_buff *skb)
return
;
}
int
ndo_init_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_init_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
struct
net_device
*
dev
;
struct
fipc_message
*
response
;
...
...
@@ -622,7 +655,7 @@ int ndo_init_callee(struct fipc_message *request, struct thc_channel *channel, s
}
int
ndo_uninit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_uninit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
//struct net_device *dev;
int
ret
;
...
...
@@ -640,7 +673,7 @@ int ndo_uninit_callee(struct fipc_message *request, struct thc_channel *channel,
}
int
ndo_start_xmit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_start_xmit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
// struct sk_buff *skb;
// struct net_device *dev;
...
...
@@ -660,7 +693,7 @@ int ndo_start_xmit_callee(struct fipc_message *request, struct thc_channel *chan
}
int
ndo_validate_addr_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_validate_addr_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
//struct net_device *dev;
struct
fipc_message
*
response
;
...
...
@@ -679,7 +712,7 @@ int ndo_validate_addr_callee(struct fipc_message *request, struct thc_channel *c
}
int
ndo_set_rx_mode_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_set_rx_mode_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
int
ret
;
struct
fipc_message
*
response
;
...
...
@@ -696,7 +729,7 @@ int ndo_set_rx_mode_callee(struct fipc_message *request, struct thc_channel *cha
}
int
ndo_set_mac_address_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_set_mac_address_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
// void *addr;
struct
fipc_message
*
response
;
...
...
@@ -739,7 +772,7 @@ int ndo_set_mac_address_callee(struct fipc_message *request, struct thc_channel
}
int
ndo_get_stats64_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_get_stats64_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
//struct rtnl_link_stats64 *storage;
struct
fipc_message
*
response
;
...
...
@@ -758,7 +791,7 @@ int ndo_get_stats64_callee(struct fipc_message *request, struct thc_channel *cha
}
int
ndo_change_carrier_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
ndo_change_carrier_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
// struct net_device *dev;
//bool new_carrier;
...
...
@@ -778,7 +811,7 @@ int ndo_change_carrier_callee(struct fipc_message *request, struct thc_channel *
}
int
setup_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
setup_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
//struct net_device *dev;
int
ret
;
...
...
@@ -796,7 +829,7 @@ int setup_callee(struct fipc_message *request, struct thc_channel *channel, stru
return
ret
;
}
int
validate_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
)
int
validate_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
)
{
struct
nlattr
**
tb
;
struct
nlattr
**
data
;
...
...
lcd-domains/test_mods/nullnet/dummy_lcd/main.c
View file @
6abf74b2
...
...
@@ -14,8 +14,8 @@
cptr_t
nullnet_register_channel
;
struct
thc_channel
*
nullnet_async_chnl
;
//
struct glue_cspace *nullnet_cspace;
//
cptr_t nullnet_sync_endpoint;
struct
glue_cspace
*
nullnet_cspace
;
cptr_t
nullnet_sync_endpoint
;
int
dummy_done
;
int
dummy_init_module
(
void
);
void
dummy_cleanup_module
(
void
);
...
...
@@ -25,9 +25,8 @@ void dummy_cleanup_module(void);
static
void
main_and_loop
(
void
)
{
int
ret
;
int
stop
=
0
;
int
stop
=
1
;
struct
fipc_message
*
msg
;
return
;
DO_FINISH
(
ASYNC
(
...
...
@@ -63,9 +62,9 @@ static void main_and_loop(void)
*/
ASYNC
(
//
ret = dispatch_
fs_channel
(nullnet_async_chnl, msg,
//
nullnet_cspace,
//
nullnet_sync_endpoint);
ret
=
dispatch_
async_loop
(
nullnet_async_chnl
,
msg
,
nullnet_cspace
,
nullnet_sync_endpoint
);
if
(
ret
)
{
LIBLCD_ERR
(
"async dispatch failed"
);
stop
=
1
;
...
...
@@ -83,6 +82,7 @@ static void main_and_loop(void)
* to just run this without a loop (it's effectively polling since
* only one awe will run in this do-finish).
*/
if
(
1
)
DO_FINISH
(
ASYNC
(
dummy_cleanup_module
();
...
...
@@ -98,7 +98,7 @@ static void main_and_loop(void)
return
;
}
static
int
dummy_lcd_init
(
void
)
static
int
__noreturn
dummy_lcd_init
(
void
)
{
int
r
=
0
;
...
...
@@ -110,10 +110,11 @@ static int dummy_lcd_init(void)
* Get the nullnet channel cptr from boot info
*/
nullnet_register_channel
=
lcd_get_boot_info
()
->
cptrs
[
0
];
printk
(
"nullnet reg channel %lu
\n
"
,
nullnet_register_channel
.
cptr
);
/*
* Initialize nullnet glue
*/
//
r = glue_nullnet_init();
r
=
glue_nullnet_init
();
if
(
r
)
{
LIBLCD_ERR
(
"nullnet init"
);
goto
fail2
;
...
...
@@ -125,11 +126,9 @@ static int dummy_lcd_init(void)
/* DONE -------------------------------------------------- */
//
glue_nullnet_exit();
glue_nullnet_exit
();
lcd_exit
(
0
);
/* doesn't return */
return
0
;
fail2:
fail1:
lcd_exit
(
r
);
...
...
@@ -150,10 +149,6 @@ static int __dummy_lcd_init(void)
static
void
__exit
dummy_lcd_exit
(
void
)
{
//glue_nullnet_exit();
lcd_exit
(
0
);
return
;
}
...
...
lcd-domains/test_mods/nullnet/dummy_lcd/nullnet_caller.h
View file @
6abf74b2
...
...
@@ -3,17 +3,18 @@
#include "../glue_helper.h"
int
dispatch_async_loop
(
struct
thc_channel
*
channel
,
struct
fipc_message
*
request
,
struct
glue_cspace
*
cspace
,
struct
cptr
sync_ep
);
int
glue_nullnet_init
(
void
);
void
glue_nullnet_exit
(
void
);
int
ndo_init_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_uninit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_start_xmit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_validate_addr_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_set_rx_mode_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_set_mac_address_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_get_stats64_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_change_carrier_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
setup_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
validate_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_init_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_uninit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_start_xmit_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_validate_addr_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_set_rx_mode_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_set_mac_address_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_get_stats64_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
ndo_change_carrier_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
setup_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
int
validate_callee
(
struct
fipc_message
*
request
,
struct
thc_channel
*
channel
,
struct
glue_
cspace
*
cspace
,
struct
cptr
sync_ep
);
#endif
/* __NULLNET_CALLER_H__ */
lcd-domains/test_mods/nullnet/glue_helper.h
View file @
6abf74b2
...
...
@@ -63,6 +63,7 @@ struct rtnl_link_ops_container {
struct
rtnl_link_ops
rtnl_link_ops
;
cptr_t
other_ref
;
cptr_t
my_ref
;
void
*
fs_info
;
};
struct
rtnl_link_stats64_container
{
struct
rtnl_link_stats64
rtnl_link_stats64
;
...
...
lcd-domains/test_mods/nullnet/net_klcd/glue/dispatch.c
View file @
6abf74b2
...
...
@@ -10,17 +10,17 @@
#include <lcd_config/post_hook.h>
int
dispatch_sync_net_channel
(
void
)
#define trace(x) LIBLCD_MSG("net got " #x " msg")
int
dispatch_sync_loop
(
void
)
{
int
fn_type
=
lcd_r0
();
switch
(
fn_type
)
{
case
__RTNL_LINK_REGISTER
:
// return __rtnl_link_register_callee(message, channel, cspace,
// sync_endpoint);
break
;
trace
(
RTNL_LINK_REGISTER
);
return
__rtnl_link_register_callee
();
default:
LIBLCD_ERR
(
"unexpected function label %d"
,
fn_type
);
return
-
EINVAL
;
...
...
@@ -29,11 +29,10 @@ int dispatch_sync_net_channel(void)
return
0
;
}
#define trace(x) LIBLIBLCD_MSG("net got " #x " msg")
int
dispatch_async_
net_channel
(
struct
thc_channel
*
channel
,
int
dispatch_async_
loop
(
struct
thc_channel
*
channel
,
struct
fipc_message
*
message
,
struct
cspace
*
cspace
,
struct
glue_
cspace
*
cspace
,
cptr_t
sync_endpoint
)
{
int
ret
;
...
...
lcd-domains/test_mods/nullnet/net_klcd/glue/nullnet_callee.c
View file @
6abf74b2
...
...
@@ -6,8 +6,10 @@
#include "../../glue_helper.h"
#include "../nullnet_callee.h"
#include <asm/cacheflush.h>
struct
thc_channel
*
net_async
;
//struct cspace *c_cspace;
//struct
glue_
cspace *c_cspace;
struct
cptr
sync_ep
;
struct
trampoline_hidden_args
{
...
...
@@ -48,6 +50,127 @@ void glue_nullnet_exit()
}
static
void
destroy_async_fs_ring_channel
(
struct
thc_channel
*
chnl
)
{
cptr_t
tx
,
rx
;
gva_t
tx_gva
,
rx_gva
;
unsigned
long
unused1
,
unused2
;
int
ret
;
unsigned
int
pg_order
=
PMFS_ASYNC_RPC_BUFFER_ORDER
-
PAGE_SHIFT
;
/*
* Translate ring buffers to cptrs
*/
tx_gva
=
__gva
((
unsigned
long
)
thc_channel_to_fipc
(
chnl
)
->
tx
.
buffer
);
rx_gva
=
__gva
((
unsigned
long
)
thc_channel_to_fipc
(
chnl
)
->
rx
.
buffer
);
ret
=
lcd_virt_to_cptr
(
tx_gva
,
&
tx
,
&
unused1
,
&
unused2
);
if
(
ret
)
{
LIBLCD_ERR
(
"failed to translate tx to cptr"
);
goto
fail1
;
}
ret
=
lcd_virt_to_cptr
(
rx_gva
,
&
rx
,
&
unused1
,
&
unused2
);