ipa-kernel-tests: Pull latest changes
Updating the kernel tests to the latest sha1 form the old project: 367590c22ab9d77f22290f0b11bd55b8c9e050cd Specifically porting the changes: 1. I93a09b45ac1e04107ddf0f5af0782251e45dfaaf 2. Ic816ed3da12cb82a23a745467d6ed818ce569492 Change-Id: I71fe69ba02f3134d3ab9d2a8d5cf6b95ef7694ef Signed-off-by: Ilia Lin <ilialin@codeaurora.org>
This commit is contained in:
@@ -532,14 +532,14 @@ int create_channel_device_by_type(
|
|||||||
/* Add a pointer from the channel device to the test context info */
|
/* Add a pointer from the channel device to the test context info */
|
||||||
channel_dev->test = ipa_test;
|
channel_dev->test = ipa_test;
|
||||||
|
|
||||||
channel_dev->class = class_create(THIS_MODULE, name);
|
channel_dev->class = class_create(THIS_MODULE, channel_dev->name);
|
||||||
if (IS_ERR(channel_dev->class)) {
|
if (IS_ERR(channel_dev->class)) {
|
||||||
IPATEST_ERR(":class_create() err.\n");
|
IPATEST_ERR(":class_create() err.\n");
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
goto create_class_failure;
|
goto create_class_failure;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = alloc_chrdev_region(&channel_dev->dev_num, 0, 1, name);
|
ret = alloc_chrdev_region(&channel_dev->dev_num, 0, 1, channel_dev->name);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
IPATEST_ERR("alloc_chrdev_region err.\n");
|
IPATEST_ERR("alloc_chrdev_region err.\n");
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
@@ -547,7 +547,7 @@ int create_channel_device_by_type(
|
|||||||
}
|
}
|
||||||
|
|
||||||
channel_dev->dev = device_create(channel_dev->class, NULL,
|
channel_dev->dev = device_create(channel_dev->class, NULL,
|
||||||
channel_dev->dev_num, channel_dev, name);
|
channel_dev->dev_num, channel_dev, channel_dev->name);
|
||||||
if (IS_ERR(channel_dev->dev)) {
|
if (IS_ERR(channel_dev->dev)) {
|
||||||
IPATEST_ERR("device_create err.\n");
|
IPATEST_ERR("device_create err.\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
@@ -576,7 +576,7 @@ int create_channel_device_by_type(
|
|||||||
|
|
||||||
if (!ret)
|
if (!ret)
|
||||||
IPATEST_DBG("Channel device:%d, name:%s created, address:0x%px.\n",
|
IPATEST_DBG("Channel device:%d, name:%s created, address:0x%px.\n",
|
||||||
index, name, channel_dev);
|
index, channel_dev->name, channel_dev);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -593,7 +593,7 @@ create_class_failure:
|
|||||||
create_channel_device_failure:
|
create_channel_device_failure:
|
||||||
kfree(channel_dev);
|
kfree(channel_dev);
|
||||||
IPATEST_ERR("Channel device %d, name %s creation FAILED.\n",
|
IPATEST_ERR("Channel device %d, name %s creation FAILED.\n",
|
||||||
index, name);
|
index, channel_dev->name);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@@ -38,6 +38,8 @@
|
|||||||
#define IPA_IPV6CT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/ipv6ct"
|
#define IPA_IPV6CT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/ipv6ct"
|
||||||
#define IPA_UC_ACT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/uc_act_table"
|
#define IPA_UC_ACT_DEBUG_FILE_PATH "/sys/kernel/debug/ipa/uc_act_table"
|
||||||
#define IPA_IPV6CT_TABLE_NAME "IPA IPv6CT table"
|
#define IPA_IPV6CT_TABLE_NAME "IPA IPv6CT table"
|
||||||
|
#define IPA_MAX_DMA_ENTRIES_FOR_ADD 2
|
||||||
|
#define IPA_MAX_DMA_ENTRIES_FOR_DEL 2
|
||||||
|
|
||||||
static int ipa_ipv6ct_create_table(ipa_ipv6ct_table* ipv6ct_table, uint16_t number_of_entries, uint8_t table_index);
|
static int ipa_ipv6ct_create_table(ipa_ipv6ct_table* ipv6ct_table, uint16_t number_of_entries, uint8_t table_index);
|
||||||
static int ipa_ipv6ct_destroy_table(ipa_ipv6ct_table* ipv6ct_table);
|
static int ipa_ipv6ct_destroy_table(ipa_ipv6ct_table* ipv6ct_table);
|
||||||
@@ -213,6 +215,9 @@ int ipa_ipv6ct_add_rule(uint32_t table_handle, const ipa_ipv6ct_rule* user_rule,
|
|||||||
ipa_ipv6ct_table* ipv6ct_table;
|
ipa_ipv6ct_table* ipv6ct_table;
|
||||||
uint16_t new_entry_index;
|
uint16_t new_entry_index;
|
||||||
uint32_t new_entry_handle;
|
uint32_t new_entry_handle;
|
||||||
|
uint32_t cmd_sz = sizeof(struct ipa_ioc_nat_dma_cmd) +
|
||||||
|
(IPA_MAX_DMA_ENTRIES_FOR_ADD * sizeof(struct ipa_ioc_nat_dma_one));
|
||||||
|
char cmd_buf[cmd_sz];
|
||||||
struct ipa_ioc_nat_dma_cmd* cmd;
|
struct ipa_ioc_nat_dma_cmd* cmd;
|
||||||
|
|
||||||
IPADBG("\n");
|
IPADBG("\n");
|
||||||
@@ -252,24 +257,16 @@ int ipa_ipv6ct_add_rule(uint32_t table_handle, const ipa_ipv6ct_rule* user_rule,
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = (struct ipa_ioc_nat_dma_cmd *)calloc(1,
|
memset(cmd_buf, 0, sizeof(cmd_buf));
|
||||||
sizeof(struct ipa_ioc_nat_dma_cmd) +
|
cmd = (struct ipa_ioc_nat_dma_cmd*) cmd_buf;
|
||||||
(MAX_DMA_ENTRIES_FOR_ADD * sizeof(struct ipa_ioc_nat_dma_one)));
|
|
||||||
if (cmd == NULL)
|
|
||||||
{
|
|
||||||
IPAERR("unable to allocate memory for Talbe DMA command\n");
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
cmd->entries = 0;
|
cmd->entries = 0;
|
||||||
|
|
||||||
new_entry_index = ipa_ipv6ct_hash(user_rule, ipv6ct_table->table.table_entries - 1);
|
new_entry_index = ipa_ipv6ct_hash(user_rule, ipv6ct_table->table.table_entries - 1);
|
||||||
|
|
||||||
ret = ipa_table_add_entry(&ipv6ct_table->table, (void*)user_rule, &new_entry_index, &new_entry_handle, cmd);
|
ret = ipa_table_add_entry(&ipv6ct_table->table, (void*)user_rule, &new_entry_index, &new_entry_handle, cmd);
|
||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
IPAERR("failed to add a new IPV6CT entry\n");
|
IPAERR("failed to add a new IPV6CT entry\n");
|
||||||
goto fail_add_entry;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = ipa_ipv6ct_post_dma_cmd(cmd);
|
ret = ipa_ipv6ct_post_dma_cmd(cmd);
|
||||||
@@ -278,7 +275,6 @@ int ipa_ipv6ct_add_rule(uint32_t table_handle, const ipa_ipv6ct_rule* user_rule,
|
|||||||
IPAERR("unable to post dma command\n");
|
IPAERR("unable to post dma command\n");
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
free(cmd);
|
|
||||||
|
|
||||||
if (pthread_mutex_unlock(&ipv6ct_mutex))
|
if (pthread_mutex_unlock(&ipv6ct_mutex))
|
||||||
{
|
{
|
||||||
@@ -293,8 +289,6 @@ int ipa_ipv6ct_add_rule(uint32_t table_handle, const ipa_ipv6ct_rule* user_rule,
|
|||||||
|
|
||||||
bail:
|
bail:
|
||||||
ipa_table_erase_entry(&ipv6ct_table->table, new_entry_index);
|
ipa_table_erase_entry(&ipv6ct_table->table, new_entry_index);
|
||||||
fail_add_entry:
|
|
||||||
free(cmd);
|
|
||||||
unlock:
|
unlock:
|
||||||
if (pthread_mutex_unlock(&ipv6ct_mutex))
|
if (pthread_mutex_unlock(&ipv6ct_mutex))
|
||||||
IPAERR("unable to unlock the ipv6ct mutex\n");
|
IPAERR("unable to unlock the ipv6ct mutex\n");
|
||||||
@@ -304,9 +298,12 @@ unlock:
|
|||||||
int ipa_ipv6ct_del_rule(uint32_t table_handle, uint32_t rule_handle)
|
int ipa_ipv6ct_del_rule(uint32_t table_handle, uint32_t rule_handle)
|
||||||
{
|
{
|
||||||
ipa_ipv6ct_table* ipv6ct_table;
|
ipa_ipv6ct_table* ipv6ct_table;
|
||||||
struct ipa_ioc_nat_dma_cmd* cmd;
|
|
||||||
ipa_table_iterator table_iterator;
|
ipa_table_iterator table_iterator;
|
||||||
ipa_ipv6ct_hw_entry* entry;
|
ipa_ipv6ct_hw_entry* entry;
|
||||||
|
uint32_t cmd_sz = sizeof(struct ipa_ioc_nat_dma_cmd) +
|
||||||
|
(IPA_MAX_DMA_ENTRIES_FOR_DEL * sizeof(struct ipa_ioc_nat_dma_one));
|
||||||
|
char cmd_buf[cmd_sz];
|
||||||
|
struct ipa_ioc_nat_dma_cmd* cmd;
|
||||||
uint16_t index;
|
uint16_t index;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -356,15 +353,8 @@ int ipa_ipv6ct_del_rule(uint32_t table_handle, uint32_t rule_handle)
|
|||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd = (struct ipa_ioc_nat_dma_cmd *)calloc(1,
|
memset(cmd_buf, 0, sizeof(cmd_buf));
|
||||||
sizeof(struct ipa_ioc_nat_dma_cmd) +
|
cmd = (struct ipa_ioc_nat_dma_cmd*) cmd_buf;
|
||||||
(MAX_DMA_ENTRIES_FOR_DEL * sizeof(struct ipa_ioc_nat_dma_one)));
|
|
||||||
if (cmd == NULL)
|
|
||||||
{
|
|
||||||
IPAERR("unable to allocate memory for Talbe DMA command\n");
|
|
||||||
ret = -ENOMEM;
|
|
||||||
goto unlock;
|
|
||||||
}
|
|
||||||
cmd->entries = 0;
|
cmd->entries = 0;
|
||||||
|
|
||||||
ipa_table_create_delete_command(&ipv6ct_table->table, cmd, &table_iterator);
|
ipa_table_create_delete_command(&ipv6ct_table->table, cmd, &table_iterator);
|
||||||
@@ -373,7 +363,7 @@ int ipa_ipv6ct_del_rule(uint32_t table_handle, uint32_t rule_handle)
|
|||||||
if (ret)
|
if (ret)
|
||||||
{
|
{
|
||||||
IPAERR("unable to post dma command\n");
|
IPAERR("unable to post dma command\n");
|
||||||
goto fail;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!ipa_table_iterator_is_head_with_tail(&table_iterator))
|
if (!ipa_table_iterator_is_head_with_tail(&table_iterator))
|
||||||
@@ -384,9 +374,6 @@ int ipa_ipv6ct_del_rule(uint32_t table_handle, uint32_t rule_handle)
|
|||||||
ipa_table_delete_entry(&ipv6ct_table->table, &table_iterator, is_prev_empty);
|
ipa_table_delete_entry(&ipv6ct_table->table, &table_iterator, is_prev_empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
|
||||||
free(cmd);
|
|
||||||
|
|
||||||
unlock:
|
unlock:
|
||||||
if (pthread_mutex_unlock(&ipv6ct_mutex))
|
if (pthread_mutex_unlock(&ipv6ct_mutex))
|
||||||
{
|
{
|
||||||
|
@@ -145,7 +145,7 @@ static int MapMemory(
|
|||||||
if (ipa_dev_dir_path_len >= IPA_RESOURCE_NAME_MAX)
|
if (ipa_dev_dir_path_len >= IPA_RESOURCE_NAME_MAX)
|
||||||
{
|
{
|
||||||
IPAERR("Unable to copy a string with size %d to buffer with size %d\n",
|
IPAERR("Unable to copy a string with size %d to buffer with size %d\n",
|
||||||
ipa_dev_dir_path_len, IPA_RESOURCE_NAME_MAX);
|
(int)ipa_dev_dir_path_len, IPA_RESOURCE_NAME_MAX);
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
@@ -203,13 +203,19 @@ uint8_t* ipa_table_calculate_addresses(
|
|||||||
void ipa_table_reset(
|
void ipa_table_reset(
|
||||||
ipa_table* table)
|
ipa_table* table)
|
||||||
{
|
{
|
||||||
|
uint32_t i,tot;
|
||||||
|
|
||||||
IPADBG("In\n");
|
IPADBG("In\n");
|
||||||
|
|
||||||
IPADBG("memset %s table to 0, %pK\n", table->name, table->table_addr);
|
IPADBG("memset %s table to 0, %pK\n", table->name, table->table_addr);
|
||||||
memset(table->table_addr, 0, table->entry_size * table->table_entries);
|
tot = table->entry_size * table->table_entries;
|
||||||
|
for (i = 0; i < tot; i++)
|
||||||
|
table->table_addr[i] = '\0';
|
||||||
|
|
||||||
IPADBG("memset %s expn table to 0, %pK\n", table->name, table->expn_table_addr);
|
IPADBG("memset %s expn table to 0, %pK\n", table->name, table->expn_table_addr);
|
||||||
memset(table->expn_table_addr, 0, table->entry_size * table->expn_table_entries);
|
tot = table->entry_size * table->expn_table_entries;
|
||||||
|
for (i = 0; i < tot; i++)
|
||||||
|
table->expn_table_addr[i] = '\0';
|
||||||
|
|
||||||
IPADBG("Out\n");
|
IPADBG("Out\n");
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,7 @@ public:
|
|||||||
LOG_MSG_DEBUG("Entering %s\n", __func__);
|
LOG_MSG_DEBUG("Entering %s\n", __func__);
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char *input, *output;
|
unsigned char *input, *output;
|
||||||
char pkt[PACKET_SIZE] = {
|
unsigned char pkt[PACKET_SIZE] = {
|
||||||
0x59, 0x61, 0x6e, 0x69,
|
0x59, 0x61, 0x6e, 0x69,
|
||||||
0x76, 0x5f, 0x48 ,0x61,
|
0x76, 0x5f, 0x48 ,0x61,
|
||||||
0x73 ,0x62 ,0x61 ,0x6e,
|
0x73 ,0x62 ,0x61 ,0x6e,
|
||||||
@@ -142,7 +142,7 @@ public:
|
|||||||
LOG_MSG_DEBUG("Entering %s\n", __func__);
|
LOG_MSG_DEBUG("Entering %s\n", __func__);
|
||||||
int ret;
|
int ret;
|
||||||
unsigned char *input, *output;
|
unsigned char *input, *output;
|
||||||
char pkt[PACKET_SIZE] = {
|
unsigned char pkt[PACKET_SIZE] = {
|
||||||
0x59, 0x61, 0x6e, 0x69,
|
0x59, 0x61, 0x6e, 0x69,
|
||||||
0x76, 0x5f, 0x48 ,0x61,
|
0x76, 0x5f, 0x48 ,0x61,
|
||||||
0x73 ,0x62 ,0x61 ,0x6e,
|
0x73 ,0x62 ,0x61 ,0x6e,
|
||||||
|
@@ -91,6 +91,7 @@ const char *ipa_hw_type_name[] = {
|
|||||||
"4.5",
|
"4.5",
|
||||||
"4.9",
|
"4.9",
|
||||||
"5.0",
|
"5.0",
|
||||||
|
"5.1",
|
||||||
"MAX"
|
"MAX"
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -199,10 +200,15 @@ int chooserMode() {
|
|||||||
const char* res;
|
const char* res;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char input_str[4];
|
char input_str[4];
|
||||||
|
char* temp;
|
||||||
|
|
||||||
printf("Welcome to the ip_accelerator\nChoose an option:\n");
|
printf("Welcome to the ip_accelerator\nChoose an option:\n");
|
||||||
printf("1) Run tests\n2) Run suites\n3) Exit\nChoose an option: ");
|
printf("1) Run tests\n2) Run suites\n3) Exit\nChoose an option: ");
|
||||||
res = fgets(input_str, sizeof(input_str), stdin);
|
temp = fgets(input_str, sizeof(input_str), stdin);
|
||||||
|
if (!temp) {
|
||||||
|
printf("Error: fgets returned nullptr !!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
type = atoi(input_str);
|
type = atoi(input_str);
|
||||||
switch((enum ipa_test_type)type) {
|
switch((enum ipa_test_type)type) {
|
||||||
case TEST:
|
case TEST:
|
||||||
@@ -210,7 +216,11 @@ int chooserMode() {
|
|||||||
showTests();
|
showTests();
|
||||||
printf("Choose which test you wish to run: \n");
|
printf("Choose which test you wish to run: \n");
|
||||||
fflush(stdin);
|
fflush(stdin);
|
||||||
res = fgets(input_str, sizeof(input_str), stdin);
|
temp = fgets(input_str, sizeof(input_str), stdin);
|
||||||
|
if (!temp) {
|
||||||
|
printf("Error: fgets returned nullptr !!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
test_num = atoi(input_str);
|
test_num = atoi(input_str);
|
||||||
if ( test_num > testmanager->m_testList.size()) {
|
if ( test_num > testmanager->m_testList.size()) {
|
||||||
printf("Invalid test number. Try again\n");
|
printf("Invalid test number. Try again\n");
|
||||||
@@ -231,7 +241,11 @@ int chooserMode() {
|
|||||||
showSuits();
|
showSuits();
|
||||||
printf("Choose which suite you wish to run: \n");
|
printf("Choose which suite you wish to run: \n");
|
||||||
fflush(stdin);
|
fflush(stdin);
|
||||||
res = fgets(input_str, sizeof(input_str), stdin);
|
temp = fgets(input_str, sizeof(input_str), stdin);
|
||||||
|
if (!temp) {
|
||||||
|
printf("Error: fgets returned nullptr !!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
suite_num = atoi(input_str);
|
suite_num = atoi(input_str);
|
||||||
if (suite_num < 0 || suite_num > MAX_SUITES) {
|
if (suite_num < 0 || suite_num > MAX_SUITES) {
|
||||||
printf("Invalid test number. Try again\n");
|
printf("Invalid test number. Try again\n");
|
||||||
|
Reference in New Issue
Block a user