-
Notifications
You must be signed in to change notification settings - Fork 4
[PWCI] "[v5] acl: support custom memory allocators in rte_acl_build" #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ovsrobot
wants to merge
4
commits into
main
Choose a base branch
from
series_36819
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 25.11.0-rc4 | ||
| 25.11.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,4 +2,4 @@ | |
| # Copyright(c) 2017 Intel Corporation | ||
|
|
||
| op_type = | ||
| RTE_BBDEV_OP_NONE | ||
| RTE_BBDEV_OP_NONE | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,4 +156,4 @@ op_flags = | |
| RTE_BBDEV_TURBO_CRC_24A_ATTACH | ||
|
|
||
| expected_status = | ||
| OK | ||
| OK | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,4 +150,4 @@ op_flags = | |
| RTE_BBDEV_TURBO_CRC_24B_ATTACH | ||
|
|
||
| expected_status = | ||
| OK | ||
| OK | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1721,6 +1721,125 @@ test_u32_range(void) | |
| return rc; | ||
| } | ||
|
|
||
| struct acl_ctx_wrapper_t { | ||
| struct rte_acl_ctx *ctx; | ||
| void *running_buf; | ||
| bool running_buf_using; | ||
| }; | ||
|
|
||
| #define ACL_RUNNING_BUF_SIZE (10 * 1024 * 1024) | ||
|
|
||
| static void *running_alloc(void *udata, char *name, size_t size, | ||
| size_t align, int32_t socket_id) | ||
| { | ||
| (void)align; | ||
| (void)name; | ||
| (void)socket_id; | ||
| if (size > ACL_RUNNING_BUF_SIZE) | ||
| return NULL; | ||
| struct acl_ctx_wrapper_t *gwlb_acl_ctx = (struct acl_ctx_wrapper_t *)udata; | ||
| if (gwlb_acl_ctx->running_buf_using) | ||
| return NULL; | ||
| printf("running memory alloc for acl context, size=%zu, pointer=%p\n", | ||
| size, | ||
| gwlb_acl_ctx->running_buf); | ||
| memset(gwlb_acl_ctx->running_buf, 0, size); | ||
| gwlb_acl_ctx->running_buf_using = true; | ||
| return gwlb_acl_ctx->running_buf; | ||
| } | ||
|
|
||
| static void running_free(void *udata, void *ptr) | ||
| { | ||
| if (!ptr) | ||
| return; | ||
| struct acl_ctx_wrapper_t *gwlb_acl_ctx = (struct acl_ctx_wrapper_t *)udata; | ||
| printf("running memory free, pointer=%p\n", ptr); | ||
| gwlb_acl_ctx->running_buf_using = false; | ||
| } | ||
|
|
||
| static int | ||
| test_mem_cb(void) | ||
| { | ||
| int i, ret; | ||
| struct acl_ctx_wrapper_t g_acl_ctx_wrapper; | ||
| g_acl_ctx_wrapper.ctx = rte_acl_create(&acl_param); | ||
| if (g_acl_ctx_wrapper.ctx == NULL) { | ||
| printf("Line %i: Error creating ACL context!\n", __LINE__); | ||
| return -1; | ||
| } | ||
| g_acl_ctx_wrapper.running_buf = rte_zmalloc_socket( | ||
| "test_acl", | ||
| ACL_RUNNING_BUF_SIZE, | ||
| RTE_CACHE_LINE_SIZE, | ||
| SOCKET_ID_ANY); | ||
| if (!g_acl_ctx_wrapper.running_buf) { | ||
| printf("Line %i: Error allocing running buf for acl context!\n", __LINE__); | ||
| return 1; | ||
| } | ||
| g_acl_ctx_wrapper.running_buf_using = false; | ||
|
|
||
| struct rte_acl_mem_cb mcb = { | ||
| .zalloc = running_alloc, | ||
| .free = running_free, | ||
| .udata = &g_acl_ctx_wrapper | ||
| }; | ||
| ret = rte_acl_set_mem_cb(g_acl_ctx_wrapper.ctx, &mcb); | ||
| if (ret) { | ||
| printf("Line %i: Error set mem cb for acl context!\n", __LINE__); | ||
| return 1; | ||
| } | ||
| struct rte_acl_mem_cb new_mcb; | ||
| memset(&new_mcb, 0, sizeof(struct rte_acl_mem_cb)); | ||
| ret = rte_acl_get_mem_cb(g_acl_ctx_wrapper.ctx, &new_mcb); | ||
| if (ret) { | ||
| printf("Line %i: Error get mem cb for acl context!\n", __LINE__); | ||
| return 1; | ||
| } | ||
| if (memcmp(&mcb, &new_mcb, sizeof(struct rte_acl_mem_cb)) != 0) { | ||
| printf("Line %i: Error get mem cb for acl context!\n", __LINE__); | ||
| return 1; | ||
|
Comment on lines
+1786
to
+1800
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Inconsistent error return values and missing cleanup. Multiple return paths use ret = rte_acl_set_mem_cb(g_acl_ctx_wrapper.ctx, &mcb);
if (ret) {
printf("Line %i: Error set mem cb for acl context!\n", __LINE__);
- return 1;
+ goto err;
}
struct rte_acl_mem_cb new_mcb;
memset(&new_mcb, 0, sizeof(struct rte_acl_mem_cb));
ret = rte_acl_get_mem_cb(g_acl_ctx_wrapper.ctx, &new_mcb);
if (ret) {
printf("Line %i: Error get mem cb for acl context!\n", __LINE__);
- return 1;
+ goto err;
}
if (memcmp(&mcb, &new_mcb, sizeof(struct rte_acl_mem_cb)) != 0) {
printf("Line %i: Error get mem cb for acl context!\n", __LINE__);
- return 1;
+ goto err;
}Add an error label at the end: err:
rte_acl_free(g_acl_ctx_wrapper.ctx);
rte_free(g_acl_ctx_wrapper.running_buf);
return -1;🤖 Prompt for AI Agents |
||
| } | ||
| ret = 0; | ||
| for (i = 0; i != TEST_CLASSIFY_ITER; i++) { | ||
|
|
||
| if ((i & 1) == 0) | ||
| rte_acl_reset(g_acl_ctx_wrapper.ctx); | ||
| else | ||
| rte_acl_reset_rules(g_acl_ctx_wrapper.ctx); | ||
|
|
||
| ret = test_classify_buid(g_acl_ctx_wrapper.ctx, acl_test_rules, | ||
| RTE_DIM(acl_test_rules)); | ||
| if (ret != 0) { | ||
| printf("Line %i, iter: %d: " | ||
| "Adding rules to ACL context failed!\n", | ||
| __LINE__, i); | ||
| break; | ||
| } | ||
|
|
||
| ret = test_classify_run(g_acl_ctx_wrapper.ctx, acl_test_data, | ||
| RTE_DIM(acl_test_data)); | ||
| if (ret != 0) { | ||
| printf("Line %i, iter: %d: %s failed!\n", | ||
| __LINE__, i, __func__); | ||
| break; | ||
| } | ||
|
|
||
| /* reset rules and make sure that classify still works ok. */ | ||
| rte_acl_reset_rules(g_acl_ctx_wrapper.ctx); | ||
| ret = test_classify_run(g_acl_ctx_wrapper.ctx, acl_test_data, | ||
| RTE_DIM(acl_test_data)); | ||
| if (ret != 0) { | ||
| printf("Line %i, iter: %d: %s failed!\n", | ||
| __LINE__, i, __func__); | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| rte_acl_free(g_acl_ctx_wrapper.ctx); | ||
| rte_free(g_acl_ctx_wrapper.running_buf); | ||
| return ret; | ||
| } | ||
|
|
||
| static int | ||
| test_acl(void) | ||
| { | ||
|
|
@@ -1742,6 +1861,8 @@ test_acl(void) | |
| return -1; | ||
| if (test_u32_range() < 0) | ||
| return -1; | ||
| if (test_mem_cb() < 0) | ||
| return -1; | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,4 +20,3 @@ | |
| #include "tf_ext_flow_handle.h" | ||
| #include "hcapi_cfa.h" | ||
| #include "bnxt.h" | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -261,4 +261,3 @@ struct bnxt_ulp_act_match_info ulp_act_match_list[] = { | |
| .act_tid = 12 | ||
| } | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8362,4 +8362,3 @@ struct bnxt_ulp_class_match_info ulp_class_match_list[] = { | |
| }, | ||
| } | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,4 +85,3 @@ enum bnxt_ulp_template_id { | |
| }; | ||
|
|
||
| #endif | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4065,4 +4065,3 @@ uint32_t ulp_act_prop_map_table[] = { | |
| [BNXT_ULP_ACT_PROP_IDX_LAST] = | ||
| BNXT_ULP_ACT_PROP_SZ_LAST | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68548,4 +68548,3 @@ struct bnxt_ulp_mapper_ident_info ulp_thor2_class_ident_list[] = { | |
| .ident_bit_pos = 64 | ||
| } | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69581,4 +69581,3 @@ struct bnxt_ulp_mapper_ident_info ulp_thor_class_ident_list[] = { | |
| .ident_bit_pos = 62 | ||
| } | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18776,4 +18776,3 @@ struct bnxt_ulp_mapper_ident_info ulp_wh_plus_class_ident_list[] = { | |
| .ident_bit_pos = 0 | ||
| } | ||
| }; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1080,4 +1080,3 @@ int gve_adminq_configure_rss(struct gve_priv *priv, | |
| gve_free_dma_mem(&rss_key_dma_mem); | ||
| return err; | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent error return value.
Returns
1on allocation failure, but the test framework and other tests in this file return-1for errors.if (!g_acl_ctx_wrapper.running_buf) { printf("Line %i: Error allocing running buf for acl context!\n", __LINE__); - return 1; + rte_acl_free(g_acl_ctx_wrapper.ctx); + return -1; }Note: Also added missing cleanup of the ACL context before returning.
📝 Committable suggestion
🤖 Prompt for AI Agents