Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xcap-capability-linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xcap
xcap-capability-linux
Commits
215b2524
Commit
215b2524
authored
Apr 02, 2017
by
Vikram Narayanan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lcd/ixgbe: Refactor glue helpers
Signed-off-by:
Vikram Narayanan
<
vikram186@gmail.com
>
parent
06f14653
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
348 additions
and
187 deletions
+348
-187
lcd-domains/test_mods/ixgbe/ixgbe_cap.c
lcd-domains/test_mods/ixgbe/ixgbe_cap.c
+32
-117
lcd-domains/test_mods/ixgbe/ixgbe_common.h
lcd-domains/test_mods/ixgbe/ixgbe_common.h
+39
-70
lcd-domains/test_mods/ixgbe/ixgbe_glue_helper.c
lcd-domains/test_mods/ixgbe/ixgbe_glue_helper.c
+177
-0
lcd-domains/test_mods/ixgbe/ixgbe_glue_helper.h
lcd-domains/test_mods/ixgbe/ixgbe_glue_helper.h
+100
-0
No files found.
lcd-domains/test_mods/ixgbe/ixgbe_cap.c
View file @
215b2524
...
...
@@ -16,22 +16,33 @@ struct type_ops_id {
cap_type_t
libcap_type
;
};
static
int
dummy_func
(
struct
cspace
*
cspace
,
struct
cnode
*
cnode
,
void
*
object
)
{
return
0
;
}
enum
glue_type
{
GLUE_TYPE_DEVICE_CONTAINER
,
GLUE_TYPE_MODULE_CONTAINER
,
GLUE_TYPE_NET_DEVICE_CONTAINER
,
GLUE_TYPE_PCI_BUS_CONTAINER
,
GLUE_TYPE_PCI_DEV_CONTAINER
,
GLUE_TYPE_PCI_DEVICE_ID_CONTAINER
,
GLUE_TYPE_PCI_DRIVER_CONTAINER
,
GLUE_TYPE_SK_BUFF_CONTAINER
,
GLUE_NR_TYPES
,
};
static
int
dummy_func
(
struct
cspace
*
cspace
,
struct
cnode
*
cnode
,
void
*
object
)
{
return
0
;
}
};
static
struct
type_ops_id
glue_libcap_type_ops
[
GLUE_NR_TYPES
]
=
{
{
{
.
name
=
"struct device"
,
.
delete
=
dummy_func
,
.
revoke
=
dummy_func
,
}
},
{
{
.
name
=
"struct module"
,
...
...
@@ -46,6 +57,13 @@ static struct type_ops_id glue_libcap_type_ops[GLUE_NR_TYPES] = {
.
revoke
=
dummy_func
,
}
},
{
{
.
name
=
"struct pci_bus"
,
.
delete
=
dummy_func
,
.
revoke
=
dummy_func
,
}
},
{
{
.
name
=
"struct pci_dev"
,
...
...
@@ -67,6 +85,13 @@ static struct type_ops_id glue_libcap_type_ops[GLUE_NR_TYPES] = {
.
revoke
=
dummy_func
,
}
},
{
{
.
name
=
"struct sk_buff"
,
.
delete
=
dummy_func
,
.
revoke
=
dummy_func
,
}
},
};
int
glue_cap_init
(
void
)
...
...
@@ -145,114 +170,4 @@ void glue_cap_exit(void)
}
}
int
glue_cap_insert_module_type
(
struct
glue_cspace
*
cspace
,
struct
module_container
*
module_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
module_container
,
glue_libcap_type_ops
[
GLUE_TYPE_MODULE_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_module_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
module_container
**
module_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_MODULE_CONTAINER
].
libcap_type
,
(
void
**
)
module_container
);
}
int
glue_cap_insert_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
pci_dev_container
*
pci_dev_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
pci_dev_container
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEV_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_dev_container
**
pci_dev_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEV_CONTAINER
].
libcap_type
,
(
void
**
)
pci_dev_container
);
}
int
glue_cap_insert_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
pci_device_id_container
*
pci_device_id_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
pci_device_id_container
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEVICE_ID_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_device_id_container
**
pci_device_id_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEVICE_ID_CONTAINER
].
libcap_type
,
(
void
**
)
pci_device_id_container
);
}
int
glue_cap_insert_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
pci_driver_container
*
pci_driver_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
pci_driver_container
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DRIVER_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_driver_container
**
pci_driver_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DRIVER_CONTAINER
].
libcap_type
,
(
void
**
)
pci_driver_container
);
}
int
glue_cap_insert_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
net_device_container
*
net_device_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
net_device_container
,
glue_libcap_type_ops
[
GLUE_TYPE_NET_DEVICE_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
net_device_container
**
net_device_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_NET_DEVICE_CONTAINER
].
libcap_type
,
(
void
**
)
net_device_container
);
}
#include "ixgbe_glue_helper.c"
lcd-domains/test_mods/ixgbe/ixgbe_common.h
View file @
215b2524
...
...
@@ -14,49 +14,50 @@
#include <liblcd/liblcd.h>
#include <liblcd/sync_ipc_poll.h>
#
define PCI_REGIONS
#
include "ixgbe_glue_helper.h"
#define PCI_REGIONS
enum
dispatch_t
{
__PCI_REGISTER_DRIVER
,
PROBE
,
REMOVE
,
PCI_UNREGISTER_DRIVER
,
ALLOC_ETHERDEV_MQS
,
};
struct
module_container
{
struct
module
module
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
net_device_container
{
struct
net_device
net_device
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
pci_dev_container
{
struct
pci_dev
pci_dev
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
pci_device_id_container
{
struct
pci_device_id
pci_device_id
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
pci_driver_container
{
struct
pci_driver
pci_driver
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
trampoline_hidden_args
{
void
*
struct_container
;
struct
glue_cspace
*
cspace
;
struct
lcd_trampoline_handle
*
t_handle
;
struct
thc_channel
*
async_chnl
;
struct
cptr
sync_ep
;
REGISTER_NETDEVICE
,
ETHER_SETUP
,
ETH_MAC_ADDR
,
ETH_VALIDATE_ADDR
,
FREE_NETDEV
,
NETIF_CARRIER_OFF
,
NETIF_CARRIER_ON
,
NETIF_DEVICE_ATTACH
,
NETIF_DEVICE_DETACH
,
NETIF_SET_REAL_NUM_RX_QUEUES
,
NETIF_SET_REAL_NUM_TX_QUEUES
,
CONSUME_SKB
,
UNREGISTER_NETDEV
,
ETH_PLATFORM_GET_MAC_ADDRESS
,
DEV_ADDR_DEL
,
DEVICE_SET_WAKEUP_ENABLE
,
ETH_GET_HEADLEN
,
NETIF_TX_STOP_ALL_QUEUES
,
PCI_DISABLE_PCIE_ERROR_REPORTING
,
PCI_BUS_READ_CONFIG_WORD
,
PCI_BUS_WRITE_CONFIG_WORD
,
PCI_CLEANUP_AER_UNCORRECT_ERROR_STATUS
,
PCI_DISABLE_DEVICE
,
PCI_ENABLE_PCIE_ERROR_REPORTING
,
PCIE_CAPABILITY_READ_WORD
,
PCIE_GET_MINIMUM_LINK
,
PCI_ENABLE_DEVICE_MEM
,
PCI_REQUEST_SELECTED_REGIONS
,
PCI_REQUEST_SELECTED_REGIONS_EXCLUSIVE
,
PCI_SET_MASTER
,
PCI_SAVE_STATE
,
PCI_RELEASE_SELECTED_REGIONS
,
PCI_SELECT_BARS
,
PCI_WAKE_FROM_D3
,
PROBE
,
REMOVE
,
TRIGGER_EXIT
,
};
#define ASYNC_RPC_BUFFER_ORDER 12
...
...
@@ -74,38 +75,6 @@ void glue_cap_remove(
struct
glue_cspace
*
cspace
,
cptr_t
c
);
int
glue_cap_insert_module_type
(
struct
glue_cspace
*
cspace
,
struct
module_container
*
module_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
pci_dev_container
*
pci_dev_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
pci_device_id_container
*
pci_device_id_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
pci_driver_container
*
pci_driver_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
net_device_container
*
net_device_container
,
struct
cptr
*
c_out
);
int
glue_cap_lookup_module_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
module_container
**
module_container
);
int
glue_cap_lookup_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_dev_container
**
pci_dev_container
);
int
glue_cap_lookup_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_device_id_container
**
pci_device_id_container
);
int
glue_cap_lookup_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_driver_container
**
pci_driver_container
);
int
glue_cap_lookup_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
net_device_container
**
net_device_container
);
/* ASYNC HELPERS -------------------------------------------------- */
static
inline
...
...
lcd-domains/test_mods/ixgbe/ixgbe_glue_helper.c
0 → 100644
View file @
215b2524
int
glue_cap_insert_device_type
(
struct
glue_cspace
*
cspace
,
struct
device_container
*
device_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
device_container
,
glue_libcap_type_ops
[
GLUE_TYPE_DEVICE_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_device_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
device_container
**
device_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_DEVICE_CONTAINER
].
libcap_type
,
(
void
**
)
device_container
);
}
int
glue_cap_insert_module_type
(
struct
glue_cspace
*
cspace
,
struct
module_container
*
module_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
module_container
,
glue_libcap_type_ops
[
GLUE_TYPE_MODULE_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_module_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
module_container
**
module_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_MODULE_CONTAINER
].
libcap_type
,
(
void
**
)
module_container
);
}
int
glue_cap_insert_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
net_device_container
*
net_device_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
net_device_container
,
glue_libcap_type_ops
[
GLUE_TYPE_NET_DEVICE_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
net_device_container
**
net_device_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_NET_DEVICE_CONTAINER
].
libcap_type
,
(
void
**
)
net_device_container
);
}
int
glue_cap_insert_pci_bus_type
(
struct
glue_cspace
*
cspace
,
struct
pci_bus_container
*
pci_bus_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
pci_bus_container
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_BUS_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_pci_bus_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_bus_container
**
pci_bus_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_BUS_CONTAINER
].
libcap_type
,
(
void
**
)
pci_bus_container
);
}
int
glue_cap_insert_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
pci_dev_container
*
pci_dev_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
pci_dev_container
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEV_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_dev_container
**
pci_dev_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEV_CONTAINER
].
libcap_type
,
(
void
**
)
pci_dev_container
);
}
int
glue_cap_insert_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
pci_device_id_container
*
pci_device_id_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
pci_device_id_container
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEVICE_ID_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_device_id_container
**
pci_device_id_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DEVICE_ID_CONTAINER
].
libcap_type
,
(
void
**
)
pci_device_id_container
);
}
int
glue_cap_insert_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
pci_driver_container
*
pci_driver_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
pci_driver_container
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DRIVER_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_driver_container
**
pci_driver_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_PCI_DRIVER_CONTAINER
].
libcap_type
,
(
void
**
)
pci_driver_container
);
}
int
glue_cap_insert_sk_buff_type
(
struct
glue_cspace
*
cspace
,
struct
sk_buff_container
*
sk_buff_container
,
struct
cptr
*
c_out
)
{
return
glue_cspace_insert
(
cspace
,
sk_buff_container
,
glue_libcap_type_ops
[
GLUE_TYPE_SK_BUFF_CONTAINER
].
libcap_type
,
c_out
);
}
int
glue_cap_lookup_sk_buff_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
sk_buff_container
**
sk_buff_container
)
{
return
glue_cspace_lookup
(
cspace
,
c
,
glue_libcap_type_ops
[
GLUE_TYPE_SK_BUFF_CONTAINER
].
libcap_type
,
(
void
**
)
sk_buff_container
);
}
lcd-domains/test_mods/ixgbe/ixgbe_glue_helper.h
0 → 100644
View file @
215b2524
#ifndef __IXGBE_GLUE_HELPER_H__
#define __IXGBE_GLUE_HELPER_H__
struct
device_container
{
struct
device
device
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
module_container
{
struct
module
module
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
net_device_container
{
struct
net_device
net_device
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
pci_bus_container
{
struct
pci_bus
pci_bus
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
pci_dev_container
{
struct
pci_dev
pci_dev
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
pci_device_id_container
{
struct
pci_device_id
pci_device_id
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
pci_driver_container
{
struct
pci_driver
pci_driver
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
sk_buff_container
{
struct
sk_buff
sk_buff
;
struct
cptr
other_ref
;
struct
cptr
my_ref
;
};
struct
trampoline_hidden_args
{
void
*
struct_container
;
struct
glue_cspace
*
cspace
;
struct
lcd_trampoline_handle
*
t_handle
;
struct
thc_channel
*
async_chnl
;
struct
cptr
sync_ep
;
};
int
glue_cap_insert_device_type
(
struct
glue_cspace
*
cspace
,
struct
device_container
*
device_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_module_type
(
struct
glue_cspace
*
cspace
,
struct
module_container
*
module_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
net_device_container
*
net_device_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_pci_bus_type
(
struct
glue_cspace
*
cspace
,
struct
pci_bus_container
*
pci_bus_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
pci_dev_container
*
pci_dev_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
pci_device_id_container
*
pci_device_id_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
pci_driver_container
*
pci_driver_container
,
struct
cptr
*
c_out
);
int
glue_cap_insert_sk_buff_type
(
struct
glue_cspace
*
cspace
,
struct
sk_buff_container
*
sk_buff_container
,
struct
cptr
*
c_out
);
int
glue_cap_lookup_device_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
device_container
**
device_container
);
int
glue_cap_lookup_module_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
module_container
**
module_container
);
int
glue_cap_lookup_net_device_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
net_device_container
**
net_device_container
);
int
glue_cap_lookup_pci_bus_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_bus_container
**
pci_bus_container
);
int
glue_cap_lookup_pci_dev_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_dev_container
**
pci_dev_container
);
int
glue_cap_lookup_pci_device_id_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_device_id_container
**
pci_device_id_container
);
int
glue_cap_lookup_pci_driver_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
pci_driver_container
**
pci_driver_container
);
int
glue_cap_lookup_sk_buff_type
(
struct
glue_cspace
*
cspace
,
struct
cptr
c
,
struct
sk_buff_container
**
sk_buff_container
);
#endif
/* __IXGBE_GLUE_HELPER_H__ */
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