move map helper function prototypes to EC (#337)

* move map helper function prototypes to EC
* replace 'generic' by 'general'

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
This commit is contained in:
Shankar Seal 2021-07-22 15:31:01 -07:00 коммит произвёл GitHub
Родитель 107e28b6e3
Коммит 18456999b7
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 173 добавлений и 85 удалений

Просмотреть файл

@ -11,11 +11,11 @@
#include "ebpf_program_types.h" #include "ebpf_program_types.h"
#include "ebpf_serialize.h" #include "ebpf_serialize.h"
GUID ebpf_global_helper_function_interface_id = {/* 8d2a1d3f-9ce6-473d-b48e-17aa5c5581fe */ GUID ebpf_general_helper_function_interface_id = {/* 8d2a1d3f-9ce6-473d-b48e-17aa5c5581fe */
0x8d2a1d3f, 0x8d2a1d3f,
0x9ce6, 0x9ce6,
0x473d, 0x473d,
{0xb4, 0x8e, 0x17, 0xaa, 0x5c, 0x55, 0x81, 0xfe}}; {0xb4, 0x8e, 0x17, 0xaa, 0x5c, 0x55, 0x81, 0xfe}};
static ebpf_pinning_table_t* _ebpf_core_map_pinning_table = NULL; static ebpf_pinning_table_t* _ebpf_core_map_pinning_table = NULL;
@ -31,6 +31,24 @@ _ebpf_core_map_delete_element(ebpf_map_t* map, const uint8_t* key);
#define EBPF_CORE_GLOBAL_HELPER_EXTENSION_VERSION 0 #define EBPF_CORE_GLOBAL_HELPER_EXTENSION_VERSION 0
static ebpf_helper_function_prototype_t _ebpf_map_helper_function_prototype[] = {
{(uint32_t)(intptr_t)ebpf_map_lookup_element,
"ebpf_map_lookup_element",
EBPF_RETURN_TYPE_PTR_TO_MAP_VALUE_OR_NULL,
{EBPF_ARGUMENT_TYPE_PTR_TO_MAP, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_KEY}},
{(uint32_t)(intptr_t)ebpf_map_update_element,
"ebpf_map_update_element",
EBPF_RETURN_TYPE_INTEGER,
{EBPF_ARGUMENT_TYPE_PTR_TO_MAP, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_KEY, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_VALUE}},
{(uint32_t)(intptr_t)ebpf_map_delete_element,
"ebpf_map_delete_element",
EBPF_RETURN_TYPE_INTEGER,
{EBPF_ARGUMENT_TYPE_PTR_TO_MAP, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_KEY}}};
static ebpf_program_info_t _ebpf_global_helper_program_info = {{"global_helper", NULL, {0}},
EBPF_COUNT_OF(_ebpf_map_helper_function_prototype),
_ebpf_map_helper_function_prototype};
static const void* _ebpf_program_helpers[] = {NULL, static const void* _ebpf_program_helpers[] = {NULL,
(void*)&_ebpf_core_map_find_element, (void*)&_ebpf_core_map_find_element,
(void*)&_ebpf_core_map_update_element, (void*)&_ebpf_core_map_update_element,
@ -39,7 +57,7 @@ static const void* _ebpf_program_helpers[] = {NULL,
static ebpf_extension_provider_t* _ebpf_global_helper_function_provider_context = NULL; static ebpf_extension_provider_t* _ebpf_global_helper_function_provider_context = NULL;
static ebpf_helper_function_addresses_t _ebpf_global_helper_function_dispatch_table = { static ebpf_helper_function_addresses_t _ebpf_global_helper_function_dispatch_table = {
EBPF_COUNT_OF(_ebpf_program_helpers), (uint64_t*)_ebpf_program_helpers}; EBPF_COUNT_OF(_ebpf_program_helpers), (uint64_t*)_ebpf_program_helpers};
static ebpf_program_data_t _ebpf_global_helper_function_program_data = {NULL, static ebpf_program_data_t _ebpf_global_helper_function_program_data = {&_ebpf_global_helper_program_info,
&_ebpf_global_helper_function_dispatch_table}; &_ebpf_global_helper_function_dispatch_table};
static ebpf_extension_data_t _ebpf_global_helper_function_extension_data = { static ebpf_extension_data_t _ebpf_global_helper_function_extension_data = {
@ -72,7 +90,7 @@ ebpf_core_initiate()
return_value = ebpf_provider_load( return_value = ebpf_provider_load(
&_ebpf_global_helper_function_provider_context, &_ebpf_global_helper_function_provider_context,
&ebpf_global_helper_function_interface_id, &ebpf_general_helper_function_interface_id,
NULL, NULL,
&_ebpf_global_helper_function_extension_data, &_ebpf_global_helper_function_extension_data,
NULL, NULL,
@ -678,8 +696,7 @@ _ebpf_core_protocol_get_program_info(
ebpf_result_t retval; ebpf_result_t retval;
ebpf_program_t* program = NULL; ebpf_program_t* program = NULL;
ebpf_program_parameters_t program_parameters = {0}; ebpf_program_parameters_t program_parameters = {0};
ebpf_extension_data_t* program_info_data; ebpf_program_info_t* program_info = NULL;
ebpf_program_data_t* program_data;
size_t serialization_buffer_size; size_t serialization_buffer_size;
size_t required_length; size_t required_length;
@ -693,11 +710,10 @@ _ebpf_core_protocol_get_program_info(
if (retval != EBPF_SUCCESS) if (retval != EBPF_SUCCESS)
goto Done; goto Done;
retval = ebpf_program_get_program_info_data(program, &program_info_data); retval = ebpf_program_get_program_info(program, &program_info);
if (retval != EBPF_SUCCESS) if (retval != EBPF_SUCCESS)
goto Done; goto Done;
program_data = (ebpf_program_data_t*)program_info_data->data; if (program_info == NULL) {
if (program_data->program_info == NULL) {
retval = EBPF_INVALID_ARGUMENT; retval = EBPF_INVALID_ARGUMENT;
goto Done; goto Done;
} }
@ -706,7 +722,7 @@ _ebpf_core_protocol_get_program_info(
// Serialize program info structure onto reply data buffer. // Serialize program info structure onto reply data buffer.
retval = ebpf_serialize_program_info( retval = ebpf_serialize_program_info(
program_data->program_info, reply->data, serialization_buffer_size, &reply->size, &required_length); program_info, reply->data, serialization_buffer_size, &reply->size, &required_length);
if (retval != EBPF_SUCCESS) { if (retval != EBPF_SUCCESS) {
reply->header.length = reply->header.length =
@ -714,9 +730,8 @@ _ebpf_core_protocol_get_program_info(
goto Done; goto Done;
} }
reply->version = program_info_data->version;
Done: Done:
ebpf_program_free_program_info(program_info);
ebpf_object_release_reference((ebpf_object_t*)program); ebpf_object_release_reference((ebpf_object_t*)program);
return retval; return retval;
} }

Просмотреть файл

@ -12,7 +12,7 @@ extern "C"
#endif #endif
#include "ebpf_protocol.h" #include "ebpf_protocol.h"
extern GUID ebpf_global_helper_function_interface_id; extern GUID ebpf_general_helper_function_interface_id;
typedef uint32_t(__stdcall* ebpf_hook_function)(uint8_t*); typedef uint32_t(__stdcall* ebpf_hook_function)(uint8_t*);

Просмотреть файл

@ -31,16 +31,16 @@ typedef struct _ebpf_program
struct ubpf_vm* vm; struct ubpf_vm* vm;
} code_or_vm; } code_or_vm;
ebpf_extension_client_t* global_helper_extension_client; ebpf_extension_client_t* general_helper_extension_client;
ebpf_extension_data_t* global_helper_provider_data; ebpf_extension_data_t* general_helper_provider_data;
ebpf_extension_dispatch_table_t* global_helper_provider_dispatch_table; ebpf_extension_dispatch_table_t* general_helper_provider_dispatch_table;
ebpf_map_t** maps; ebpf_map_t** maps;
size_t count_of_maps; size_t count_of_maps;
ebpf_extension_client_t* program_info_client; ebpf_extension_client_t* program_info_client;
const void* program_info_binding_context; const void* program_info_binding_context;
const ebpf_extension_data_t* program_info_data; const ebpf_extension_data_t* program_info_provider_data;
uint32_t helper_function_count; uint32_t helper_function_count;
bool program_invalidated; bool program_invalidated;
@ -95,9 +95,9 @@ _ebpf_program_program_info_provider_changed(
} }
program->program_info_binding_context = provider_binding_context; program->program_info_binding_context = provider_binding_context;
program->program_info_data = provider_data; program->program_info_provider_data = provider_data;
Exit: Exit:
program->program_invalidated = (program->program_info_data == NULL); program->program_invalidated = (program->program_info_provider_data == NULL);
} }
/** /**
@ -129,7 +129,7 @@ _ebpf_program_epoch_free(void* context)
ebpf_program_t* program = (ebpf_program_t*)context; ebpf_program_t* program = (ebpf_program_t*)context;
size_t index; size_t index;
ebpf_extension_unload(program->global_helper_extension_client); ebpf_extension_unload(program->general_helper_extension_client);
ebpf_extension_unload(program->program_info_client); ebpf_extension_unload(program->program_info_client);
switch (program->parameters.code_type) { switch (program->parameters.code_type) {
@ -162,31 +162,31 @@ ebpf_program_load_providers(ebpf_program_t* program)
{ {
ebpf_result_t return_value; ebpf_result_t return_value;
void* provider_binding_context; void* provider_binding_context;
ebpf_program_data_t* global_helper_program_data = NULL; ebpf_program_data_t* general_helper_program_data = NULL;
program->program_invalidated = false; program->program_invalidated = false;
return_value = ebpf_extension_load( return_value = ebpf_extension_load(
&program->global_helper_extension_client, &program->general_helper_extension_client,
&ebpf_global_helper_function_interface_id, &ebpf_general_helper_function_interface_id,
program, program,
NULL, NULL,
NULL, NULL,
&provider_binding_context, &provider_binding_context,
&program->global_helper_provider_data, &program->general_helper_provider_data,
&program->global_helper_provider_dispatch_table, &program->general_helper_provider_dispatch_table,
NULL); NULL);
if (return_value != EBPF_SUCCESS) if (return_value != EBPF_SUCCESS)
goto Done; goto Done;
if (program->global_helper_provider_data == NULL) { if (program->general_helper_provider_data == NULL) {
return_value = EBPF_INVALID_ARGUMENT; return_value = EBPF_INVALID_ARGUMENT;
goto Done; goto Done;
} }
global_helper_program_data = (ebpf_program_data_t*)program->global_helper_provider_data; general_helper_program_data = (ebpf_program_data_t*)program->general_helper_provider_data->data;
if (global_helper_program_data->helper_function_addresses == NULL) { if (general_helper_program_data->helper_function_addresses == NULL) {
return_value = EBPF_INVALID_ARGUMENT; return_value = EBPF_INVALID_ARGUMENT;
goto Done; goto Done;
} }
@ -198,7 +198,7 @@ ebpf_program_load_providers(ebpf_program_t* program)
NULL, NULL,
NULL, NULL,
(void**)&program->program_info_binding_context, (void**)&program->program_info_binding_context,
&program->program_info_data, &program->program_info_provider_data,
NULL, NULL,
_ebpf_program_program_info_provider_changed); _ebpf_program_program_info_provider_changed);
@ -349,13 +349,14 @@ static ebpf_result_t
_ebpf_program_register_helpers(ebpf_program_t* program) _ebpf_program_register_helpers(ebpf_program_t* program)
{ {
size_t index = 0; size_t index = 0;
ebpf_program_data_t* global_helper_program_data = (ebpf_program_data_t*)program->global_helper_provider_data->data; ebpf_program_data_t* general_helper_program_data =
ebpf_helper_function_addresses_t* global_helper_function_addresses = (ebpf_program_data_t*)program->general_helper_provider_data->data;
global_helper_program_data->helper_function_addresses; ebpf_helper_function_addresses_t* general_helper_function_addresses =
size_t count = global_helper_function_addresses->helper_function_count; general_helper_program_data->helper_function_addresses;
size_t count = general_helper_function_addresses->helper_function_count;
for (index = 0; index < count; index++) { for (index = 0; index < count; index++) {
const void* helper = (void*)global_helper_function_addresses->helper_function_address[index]; const void* helper = (void*)general_helper_function_addresses->helper_function_address[index];
if (helper == NULL) if (helper == NULL)
continue; continue;
@ -431,7 +432,7 @@ ebpf_program_invoke(_In_ const ebpf_program_t* program, _In_ void* context, _Out
ebpf_result_t ebpf_result_t
ebpf_program_get_helper_function_address(const ebpf_program_t* program, uint32_t helper_function_id, uint64_t* address) ebpf_program_get_helper_function_address(const ebpf_program_t* program, uint32_t helper_function_id, uint64_t* address)
{ {
if (helper_function_id > EBPF_MAX_GLOBAL_HELPER_FUNCTION) { if (helper_function_id > EBPF_MAX_GENERAL_HELPER_FUNCTION) {
void* function_address; void* function_address;
ebpf_result_t return_value; ebpf_result_t return_value;
helper_function_id >>= 16; helper_function_id >>= 16;
@ -441,33 +442,111 @@ ebpf_program_get_helper_function_address(const ebpf_program_t* program, uint32_t
*address = (uint64_t)function_address; *address = (uint64_t)function_address;
} else { } else {
ebpf_assert(program->global_helper_provider_data != NULL); ebpf_assert(program->general_helper_provider_data != NULL);
ebpf_program_data_t* global_helper_program_data = ebpf_program_data_t* general_helper_program_data =
(ebpf_program_data_t*)program->global_helper_provider_data->data; (ebpf_program_data_t*)program->general_helper_provider_data->data;
ebpf_helper_function_addresses_t* global_helper_function_addresses = ebpf_helper_function_addresses_t* general_helper_function_addresses =
global_helper_program_data->helper_function_addresses; general_helper_program_data->helper_function_addresses;
ebpf_assert(global_helper_function_addresses != NULL); ebpf_assert(general_helper_function_addresses != NULL);
if (helper_function_id > global_helper_function_addresses->helper_function_count) { if (helper_function_id > general_helper_function_addresses->helper_function_count) {
return EBPF_INVALID_ARGUMENT; return EBPF_INVALID_ARGUMENT;
} }
*address = global_helper_function_addresses->helper_function_address[helper_function_id]; *address = general_helper_function_addresses->helper_function_address[helper_function_id];
} }
return EBPF_SUCCESS; return EBPF_SUCCESS;
} }
ebpf_result_t ebpf_result_t
ebpf_program_get_program_info_data(const ebpf_program_t* program, const ebpf_extension_data_t** program_info_data) ebpf_program_get_program_info(_In_ const ebpf_program_t* program, _Outptr_ ebpf_program_info_t** program_info)
{ {
if (program->program_invalidated) ebpf_result_t result = EBPF_SUCCESS;
return EBPF_EXTENSION_FAILED_TO_LOAD; ebpf_program_data_t* program_data = NULL;
ebpf_program_data_t* general_helper_program_data = NULL;
ebpf_program_info_t* local_program_info = NULL;
uint32_t total_count_of_helpers = 0;
uint32_t helper_index = 0;
if (!program->program_info_data) if (program_info == NULL) {
return EBPF_EXTENSION_FAILED_TO_LOAD; result = EBPF_INVALID_ARGUMENT;
goto Exit;
}
*program_info = NULL;
*program_info_data = program->program_info_data; if (program->program_invalidated) {
result = EBPF_EXTENSION_FAILED_TO_LOAD;
goto Exit;
}
return EBPF_SUCCESS; if (!program->program_info_provider_data) {
result = EBPF_EXTENSION_FAILED_TO_LOAD;
goto Exit;
}
program_data = (ebpf_program_data_t*)program->program_info_provider_data->data;
if (!program->general_helper_provider_data) {
result = EBPF_EXTENSION_FAILED_TO_LOAD;
goto Exit;
}
general_helper_program_data = (ebpf_program_data_t*)program->general_helper_provider_data->data;
total_count_of_helpers =
program_data->program_info->count_of_helpers + general_helper_program_data->program_info->count_of_helpers;
if ((total_count_of_helpers < program_data->program_info->count_of_helpers) ||
(total_count_of_helpers < general_helper_program_data->program_info->count_of_helpers)) {
result = EBPF_ARITHMETIC_OVERFLOW;
goto Exit;
}
// Allocate buffer and make a shallow copy of the program info.
local_program_info = (ebpf_program_info_t*)ebpf_allocate(sizeof(ebpf_program_info_t));
if (local_program_info == NULL) {
result = EBPF_NO_MEMORY;
goto Exit;
}
local_program_info->program_type_descriptor = program_data->program_info->program_type_descriptor;
local_program_info->count_of_helpers = total_count_of_helpers;
if (total_count_of_helpers > 0) {
// Allocate buffer and make a shallow copy of the combined global and program-type specific helper function
// prototypes.
local_program_info->helper_prototype = (ebpf_helper_function_prototype_t*)ebpf_allocate(
total_count_of_helpers * sizeof(ebpf_helper_function_prototype_t));
if (local_program_info->helper_prototype == NULL) {
result = EBPF_NO_MEMORY;
goto Exit;
}
for (uint32_t index = 0; index < program_data->program_info->count_of_helpers; index++) {
__analysis_assume(helper_index < total_count_of_helpers);
local_program_info->helper_prototype[helper_index++] = program_data->program_info->helper_prototype[index];
}
for (uint32_t index = 0; index < general_helper_program_data->program_info->count_of_helpers; index++) {
__analysis_assume(helper_index < total_count_of_helpers);
local_program_info->helper_prototype[helper_index++] =
general_helper_program_data->program_info->helper_prototype[index];
}
}
Exit:
if (result == EBPF_SUCCESS) {
*program_info = local_program_info;
local_program_info = NULL;
} else {
ebpf_program_free_program_info(local_program_info);
}
return result;
}
void
ebpf_program_free_program_info(_In_opt_ _Post_invalid_ ebpf_program_info_t* program_info)
{
if (program_info != NULL) {
ebpf_free(program_info->helper_prototype);
ebpf_free(program_info);
}
} }

Просмотреть файл

@ -6,6 +6,7 @@
#include "ebpf_link.h" #include "ebpf_link.h"
#include "ebpf_maps.h" #include "ebpf_maps.h"
#include "ebpf_platform.h" #include "ebpf_platform.h"
#include "ebpf_program_types.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" extern "C"
@ -71,17 +72,28 @@ extern "C"
ebpf_program_get_properties(ebpf_program_t* program, ebpf_program_parameters_t* program_parameters); ebpf_program_get_properties(ebpf_program_t* program, ebpf_program_parameters_t* program_parameters);
/** /**
* @brief Get the program info data from the program info * @brief Get the program info from the program info extension.
* extension.
* *
* @param[in] program Program that loaded the extension. * @param[in] program Program that loaded the extension.
* @param[out] program_info_data Pointer to the program info. * @param[out] program_info Pointer to the output allocated program info. Must be freed by caller by calling
* ebpf_program_free_program_info().
* @retval EBPF_SUCCESS The operation was successful. * @retval EBPF_SUCCESS The operation was successful.
* @retval EBPF_INVALID_ARGUMENT One or more arguments are invalid.
* @retval EBPF_ARITHMETIC_OVERFLOW An arithmetic overflow has occurred.
* @retval EBPF_NO_MEMORY Output program info could not be allocated.
* @retval EBPF_ERROR_EXTENSION_FAILED_TO_LOAD The program info isn't * @retval EBPF_ERROR_EXTENSION_FAILED_TO_LOAD The program info isn't
* available. * available.
*/ */
ebpf_result_t ebpf_result_t
ebpf_program_get_program_info_data(const ebpf_program_t* program, const ebpf_extension_data_t** program_info_data); ebpf_program_get_program_info(_In_ const ebpf_program_t* program, _Outptr_ ebpf_program_info_t** program_info);
/**
* @brief Free the program info allocated by ebpf_program_get_program_info().
*
* @param[in] program_info Program info to be freed.
*/
void
ebpf_program_free_program_info(_In_opt_ _Post_invalid_ ebpf_program_info_t* program_info);
/** /**
* @brief Associate a set of maps with this program instance. * @brief Associate a set of maps with this program instance.

Просмотреть файл

@ -132,7 +132,7 @@ TEST_CASE("program", "[execution_context]")
const ebpf_program_parameters_t program_parameters{EBPF_PROGRAM_TYPE_BIND, program_name, section_name}; const ebpf_program_parameters_t program_parameters{EBPF_PROGRAM_TYPE_BIND, program_name, section_name};
ebpf_program_parameters_t returned_program_parameters{}; ebpf_program_parameters_t returned_program_parameters{};
const ebpf_extension_data_t* program_info_data; ebpf_program_info_t* program_info;
REQUIRE(ebpf_program_initialize(program.get(), &program_parameters) == EBPF_SUCCESS); REQUIRE(ebpf_program_initialize(program.get(), &program_parameters) == EBPF_SUCCESS);
@ -143,9 +143,9 @@ TEST_CASE("program", "[execution_context]")
&returned_program_parameters.program_type, &returned_program_parameters.program_type,
sizeof(program_parameters.program_type)) == 0); sizeof(program_parameters.program_type)) == 0);
REQUIRE(ebpf_program_get_program_info_data(program.get(), &program_info_data) == EBPF_SUCCESS); REQUIRE(ebpf_program_get_program_info(program.get(), &program_info) == EBPF_SUCCESS);
REQUIRE(program_info != nullptr);
REQUIRE(program_info_data != nullptr); ebpf_program_free_program_info(program_info);
ebpf_map_t* maps[] = {map.get()}; ebpf_map_t* maps[] = {map.get()};

Просмотреть файл

@ -19,7 +19,7 @@ extern "C"
#define EBPF_SYMBOLIC_DEVICE_NAME L"\\GLOBAL??\\EbpfIoDevice" #define EBPF_SYMBOLIC_DEVICE_NAME L"\\GLOBAL??\\EbpfIoDevice"
#define EBPF_DEVICE_WIN32_NAME L"\\\\.\\EbpfIoDevice" #define EBPF_DEVICE_WIN32_NAME L"\\\\.\\EbpfIoDevice"
#define EBPF_MAX_GLOBAL_HELPER_FUNCTION 0xFFFF #define EBPF_MAX_GENERAL_HELPER_FUNCTION 0xFFFF
#define EBPF_UTF8_STRING_FROM_CONST_STRING(x) \ #define EBPF_UTF8_STRING_FROM_CONST_STRING(x) \
{ \ { \

Просмотреть файл

@ -53,27 +53,11 @@ static ebpf_extension_provider_t* _ebpf_bind_program_info_provider = NULL;
#define NET_EBPF_EXTENSION_NPI_PROVIDER_VERSION 0 #define NET_EBPF_EXTENSION_NPI_PROVIDER_VERSION 0
static ebpf_helper_function_prototype_t _ebpf_map_helper_function_prototype[] = {
{1,
"ebpf_map_lookup_element",
EBPF_RETURN_TYPE_PTR_TO_MAP_VALUE_OR_NULL,
{EBPF_ARGUMENT_TYPE_PTR_TO_MAP, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_KEY}},
{2,
"ebpf_map_update_element",
EBPF_RETURN_TYPE_INTEGER,
{EBPF_ARGUMENT_TYPE_PTR_TO_MAP, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_KEY, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_VALUE}},
{3,
"ebpf_map_delete_element",
EBPF_RETURN_TYPE_INTEGER,
{EBPF_ARGUMENT_TYPE_PTR_TO_MAP, EBPF_ARGUMENT_TYPE_PTR_TO_MAP_KEY}}};
static ebpf_context_descriptor_t _ebpf_xdp_context_descriptor = {sizeof(xdp_md_t), static ebpf_context_descriptor_t _ebpf_xdp_context_descriptor = {sizeof(xdp_md_t),
EBPF_OFFSET_OF(xdp_md_t, data), EBPF_OFFSET_OF(xdp_md_t, data),
EBPF_OFFSET_OF(xdp_md_t, data_end), EBPF_OFFSET_OF(xdp_md_t, data_end),
EBPF_OFFSET_OF(xdp_md_t, data_meta)}; EBPF_OFFSET_OF(xdp_md_t, data_meta)};
static ebpf_program_info_t _ebpf_xdp_program_info = {{"xdp", &_ebpf_xdp_context_descriptor, {0}}, static ebpf_program_info_t _ebpf_xdp_program_info = {{"xdp", &_ebpf_xdp_context_descriptor, {0}}, 0, NULL};
EBPF_COUNT_OF(_ebpf_map_helper_function_prototype),
_ebpf_map_helper_function_prototype};
static ebpf_program_data_t _ebpf_xdp_program_data = {&_ebpf_xdp_program_info, NULL}; static ebpf_program_data_t _ebpf_xdp_program_data = {&_ebpf_xdp_program_info, NULL};
@ -82,9 +66,7 @@ static ebpf_extension_data_t _ebpf_xdp_program_info_provider_data = {
static ebpf_context_descriptor_t _ebpf_bind_context_descriptor = { static ebpf_context_descriptor_t _ebpf_bind_context_descriptor = {
sizeof(bind_md_t), EBPF_OFFSET_OF(bind_md_t, app_id_start), EBPF_OFFSET_OF(bind_md_t, app_id_end), -1}; sizeof(bind_md_t), EBPF_OFFSET_OF(bind_md_t, app_id_start), EBPF_OFFSET_OF(bind_md_t, app_id_end), -1};
static ebpf_program_info_t _ebpf_bind_program_info = {{"bind", &_ebpf_bind_context_descriptor, {0}}, static ebpf_program_info_t _ebpf_bind_program_info = {{"bind", &_ebpf_bind_context_descriptor, {0}}, 0, NULL};
EBPF_COUNT_OF(_ebpf_map_helper_function_prototype),
_ebpf_map_helper_function_prototype};
static ebpf_program_data_t _ebpf_bind_program_data = {&_ebpf_bind_program_info, NULL}; static ebpf_program_data_t _ebpf_bind_program_data = {&_ebpf_bind_program_info, NULL};

Просмотреть файл

@ -29,15 +29,15 @@ static ebpf_context_descriptor_t _test_ebpf_context_descriptor = {sizeof(test_pr
// Test Extension Helper function prototype descriptors. // Test Extension Helper function prototype descriptors.
static ebpf_helper_function_prototype_t _test_ebpf_extension_helper_function_prototype[] = { static ebpf_helper_function_prototype_t _test_ebpf_extension_helper_function_prototype[] = {
{EBPF_MAX_GLOBAL_HELPER_FUNCTION + 1, {EBPF_MAX_GENERAL_HELPER_FUNCTION + 1,
"test_ebpf_extension_helper_function1", "test_ebpf_extension_helper_function1",
EBPF_RETURN_TYPE_INTEGER, EBPF_RETURN_TYPE_INTEGER,
{EBPF_ARGUMENT_TYPE_PTR_TO_CTX}}, {EBPF_ARGUMENT_TYPE_PTR_TO_CTX}},
{EBPF_MAX_GLOBAL_HELPER_FUNCTION + 2, {EBPF_MAX_GENERAL_HELPER_FUNCTION + 2,
"test_ebpf_extension_helper_function2", "test_ebpf_extension_helper_function2",
EBPF_RETURN_TYPE_VOID, EBPF_RETURN_TYPE_VOID,
{EBPF_ARGUMENT_TYPE_PTR_TO_MEM, EBPF_ARGUMENT_TYPE_CONST_SIZE}}, {EBPF_ARGUMENT_TYPE_PTR_TO_MEM, EBPF_ARGUMENT_TYPE_CONST_SIZE}},
{EBPF_MAX_GLOBAL_HELPER_FUNCTION + 3, {EBPF_MAX_GENERAL_HELPER_FUNCTION + 3,
"test_ebpf_extension_helper_function3", "test_ebpf_extension_helper_function3",
EBPF_RETURN_TYPE_VOID, EBPF_RETURN_TYPE_VOID,
{EBPF_ARGUMENT_TYPE_ANYTHING}}}; {EBPF_ARGUMENT_TYPE_ANYTHING}}};