From: Serhii Iliushyk <sil-plv@napatech.com>
To: dev@dpdk.org
Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com,
stephen@networkplumber.org,
Danylo Vodopianov <dvo-plv@napatech.com>
Subject: [PATCH v1 19/31] net/ntnic: remove convert error func
Date: Tue, 21 Jan 2025 18:07:57 +0100 [thread overview]
Message-ID: <20250121170814.3252171-20-sil-plv@napatech.com> (raw)
In-Reply-To: <20250121170814.3252171-1-sil-plv@napatech.com>
From: Danylo Vodopianov <dvo-plv@napatech.com>
convert_error func was removed as far as this approach was deprecated.
Coverity issue: 448973
Fixes: e526adf1fdef ("net/ntnic: add minimal create/destroy flow operations")
Signed-off-by: Danylo Vodopianov <dvo-plv@napatech.com>
---
drivers/net/ntnic/include/create_elements.h | 1 -
drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 151 ++++++------------
2 files changed, 53 insertions(+), 99 deletions(-)
diff --git a/drivers/net/ntnic/include/create_elements.h b/drivers/net/ntnic/include/create_elements.h
index 1456977837..f0b9410cb9 100644
--- a/drivers/net/ntnic/include/create_elements.h
+++ b/drivers/net/ntnic/include/create_elements.h
@@ -61,7 +61,6 @@ enum nt_rte_flow_item_type {
extern rte_spinlock_t flow_lock;
int interpret_raw_data(uint8_t *data, uint8_t *preserve, int size, struct rte_flow_item *out);
-int convert_error(struct rte_flow_error *error, struct rte_flow_error *rte_flow_error);
int create_attr(struct cnv_attr_s *attribute, const struct rte_flow_attr *attr);
int create_match_elements(struct cnv_match_s *match, const struct rte_flow_item items[],
int max_elem);
diff --git a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
index b07e16c1d3..70bff776be 100644
--- a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
+++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
@@ -246,23 +246,6 @@ int interpret_raw_data(uint8_t *data, uint8_t *preserve, int size, struct rte_fl
return hdri + 1;
}
-int convert_error(struct rte_flow_error *error, struct rte_flow_error *rte_flow_error)
-{
- if (error) {
- error->cause = NULL;
- error->message = rte_flow_error->message;
-
- if (rte_flow_error->type == RTE_FLOW_ERROR_TYPE_NONE ||
- rte_flow_error->type == RTE_FLOW_ERROR_TYPE_NONE)
- error->type = RTE_FLOW_ERROR_TYPE_NONE;
-
- else
- error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED;
- }
-
- return 0;
-}
-
int create_attr(struct cnv_attr_s *attribute, const struct rte_flow_attr *attr)
{
memset(&attribute->attr, 0x0, sizeof(struct rte_flow_attr));
@@ -497,13 +480,10 @@ static int convert_flow(struct rte_eth_dev *eth_dev,
struct pmd_internals *internals = eth_dev->data->dev_private;
struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info;
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
uint32_t queue_offset = 0;
- /* Set initial error */
- convert_error(error, &flow_error);
-
if (!internals) {
rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
"Missing eth_dev");
@@ -559,23 +539,19 @@ eth_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *flow, struct rte_
struct pmd_internals *internals = eth_dev->data->dev_private;
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = 0;
- /* Set initial error */
- convert_error(error, &flow_error);
if (!flow)
return 0;
if (is_flow_handle_typecast(flow)) {
- res = flow_filter_ops->flow_destroy(internals->flw_dev, (void *)flow, &flow_error);
- convert_error(error, &flow_error);
+ res = flow_filter_ops->flow_destroy(internals->flw_dev, (void *)flow, error);
} else {
res = flow_filter_ops->flow_destroy(internals->flw_dev, flow->flw_hdl,
- &flow_error);
- convert_error(error, &flow_error);
+ error);
rte_spinlock_lock(&flow_lock);
flow->used = 0;
@@ -606,8 +582,8 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,
struct cnv_match_s match = { 0 };
struct cnv_action_s action = { 0 };
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
uint32_t flow_stat_id = 0;
if (convert_flow(eth_dev, attr, items, actions, &attribute, &match, &action, error) < 0)
@@ -620,8 +596,7 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,
void *flw_hdl = flow_filter_ops->flow_create(internals->flw_dev, &attribute.attr,
attribute.forced_vlan_vid, attribute.caller_id,
match.rte_flow_item, action.flow_actions,
- &flow_error);
- convert_error(error, &flow_error);
+ error);
return (struct rte_flow *)flw_hdl;
}
@@ -648,8 +623,7 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,
flow->flw_hdl = flow_filter_ops->flow_create(internals->flw_dev, &attribute.attr,
attribute.forced_vlan_vid, attribute.caller_id,
match.rte_flow_item, action.flow_actions,
- &flow_error);
- convert_error(error, &flow_error);
+ error);
if (!flow->flw_hdl) {
rte_spinlock_lock(&flow_lock);
@@ -678,14 +652,14 @@ static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *er
struct pmd_internals *internals = eth_dev->data->dev_private;
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = 0;
/* Main application caller_id is port_id shifted above VDPA ports */
uint16_t caller_id = get_caller_id(eth_dev->data->port_id);
if (internals->flw_dev) {
- res = flow_filter_ops->flow_flush(internals->flw_dev, caller_id, &flow_error);
+ res = flow_filter_ops->flow_flush(internals->flw_dev, caller_id, error);
rte_spinlock_lock(&flow_lock);
for (int flow = 0; flow < MAX_RTE_FLOWS; flow++) {
@@ -702,8 +676,6 @@ static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *er
rte_spinlock_unlock(&flow_lock);
}
- convert_error(error, &flow_error);
-
return res;
}
@@ -721,8 +693,8 @@ static int eth_flow_actions_update(struct rte_eth_dev *eth_dev,
struct pmd_internals *internals = eth_dev->data->dev_private;
- static struct rte_flow_error flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = -1;
if (internals->flw_dev) {
@@ -756,18 +728,16 @@ static int eth_flow_actions_update(struct rte_eth_dev *eth_dev,
res = flow_filter_ops->flow_actions_update(internals->flw_dev,
(void *)flow,
action.flow_actions,
- &flow_error);
+ error);
} else {
res = flow_filter_ops->flow_actions_update(internals->flw_dev,
flow->flw_hdl,
action.flow_actions,
- &flow_error);
+ error);
}
}
- convert_error(error, &flow_error);
-
return res;
}
@@ -785,17 +755,16 @@ static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,
struct pmd_internals *internals = eth_dev->data->dev_private;
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
uint16_t caller_id = get_caller_id(eth_dev->data->port_id);
int res = flow_filter_ops->flow_dev_dump(internals->flw_dev,
is_flow_handle_typecast(flow) ? (void *)flow
: flow->flw_hdl,
- caller_id, file, &flow_error);
+ caller_id, file, error);
- convert_error(error, &flow_error);
return res;
}
@@ -813,16 +782,14 @@ static int eth_flow_get_aged_flows(struct rte_eth_dev *eth_dev,
struct pmd_internals *internals = eth_dev->data->dev_private;
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
uint16_t caller_id = get_caller_id(eth_dev->data->port_id);
int res = flow_filter_ops->flow_get_aged_flows(internals->flw_dev, caller_id, context,
- nb_contexts, &flow_error);
+ nb_contexts, error);
- convert_error(error, &flow_error);
return res;
}
@@ -842,17 +809,15 @@ static int eth_flow_info_get(struct rte_eth_dev *dev, struct rte_flow_port_info
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = flow_filter_ops->flow_info_get(internals->flw_dev,
get_caller_id(dev->data->port_id),
(struct rte_flow_port_info *)port_info,
(struct rte_flow_queue_info *)queue_info,
- &flow_error);
+ error);
- convert_error(error, &flow_error);
return res;
}
@@ -869,18 +834,16 @@ static int eth_flow_configure(struct rte_eth_dev *dev, const struct rte_flow_por
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error flow_error = {
- .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = flow_filter_ops->flow_configure(internals->flw_dev,
get_caller_id(dev->data->port_id),
(const struct rte_flow_port_attr *)port_attr,
nb_queue,
(const struct rte_flow_queue_attr **)queue_attr,
- &flow_error);
+ error);
- convert_error(error, &flow_error);
return res;
}
@@ -897,8 +860,8 @@ static struct rte_flow_pattern_template *eth_flow_pattern_template_create(struct
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
struct cnv_match_s match = { 0 };
struct rte_flow_pattern_template_attr attr = {
@@ -918,9 +881,8 @@ static struct rte_flow_pattern_template *eth_flow_pattern_template_create(struct
struct flow_pattern_template *res =
flow_filter_ops->flow_pattern_template_create(internals->flw_dev, &attr, caller_id,
- match.rte_flow_item, &flow_error);
+ match.rte_flow_item, error);
- convert_error(error, &flow_error);
return (struct rte_flow_pattern_template *)res;
}
@@ -937,15 +899,14 @@ static int eth_flow_pattern_template_destroy(struct rte_eth_dev *dev,
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = flow_filter_ops->flow_pattern_template_destroy(internals->flw_dev,
(struct flow_pattern_template *)
pattern_template,
- &rte_flow_error);
+ error);
- convert_error(error, &rte_flow_error);
return res;
}
@@ -964,8 +925,8 @@ static struct rte_flow_actions_template *eth_flow_actions_template_create(struct
struct pmd_internals *internals = dev->data->dev_private;
struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info;
- static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
struct cnv_action_s action = { 0 };
struct cnv_action_s mask = { 0 };
@@ -1004,9 +965,8 @@ static struct rte_flow_actions_template *eth_flow_actions_template_create(struct
struct flow_actions_template *res =
flow_filter_ops->flow_actions_template_create(internals->flw_dev, &attr, caller_id,
action.flow_actions,
- mask.flow_actions, &rte_flow_error);
+ mask.flow_actions, error);
- convert_error(error, &rte_flow_error);
return (struct rte_flow_actions_template *)res;
}
@@ -1023,15 +983,14 @@ static int eth_flow_actions_template_destroy(struct rte_eth_dev *dev,
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = flow_filter_ops->flow_actions_template_destroy(internals->flw_dev,
(struct flow_actions_template *)
actions_template,
- &rte_flow_error);
+ error);
- convert_error(error, &rte_flow_error);
return res;
}
@@ -1050,8 +1009,8 @@ static struct rte_flow_template_table *eth_flow_template_table_create(struct rte
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
struct rte_flow_template_table_attr attr = {
.flow_attr = {
@@ -1071,9 +1030,8 @@ static struct rte_flow_template_table *eth_flow_template_table_create(struct rte
forced_vlan_vid, caller_id,
(struct flow_pattern_template **)pattern_templates,
nb_pattern_templates, (struct flow_actions_template **)actions_templates,
- nb_actions_templates, &rte_flow_error);
+ nb_actions_templates, error);
- convert_error(error, &rte_flow_error);
return (struct rte_flow_template_table *)res;
}
@@ -1090,15 +1048,14 @@ static int eth_flow_template_table_destroy(struct rte_eth_dev *dev,
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = flow_filter_ops->flow_template_table_destroy(internals->flw_dev,
(struct flow_template_table *)
template_table,
- &rte_flow_error);
+ error);
- convert_error(error, &rte_flow_error);
return res;
}
@@ -1118,8 +1075,8 @@ static struct rte_flow *eth_flow_async_create(struct rte_eth_dev *dev, uint32_t
struct pmd_internals *internals = dev->data->dev_private;
struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info;
- static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
struct cnv_action_s action = { 0 };
struct cnv_match_s match = { 0 };
@@ -1159,9 +1116,8 @@ static struct rte_flow *eth_flow_async_create(struct rte_eth_dev *dev, uint32_t
action.flow_actions,
actions_template_index,
user_data,
- &rte_flow_error);
+ error);
- convert_error(error, &rte_flow_error);
return (struct rte_flow *)res;
}
@@ -1178,17 +1134,16 @@ static int eth_flow_async_destroy(struct rte_eth_dev *dev, uint32_t queue_id,
struct pmd_internals *internals = dev->data->dev_private;
- static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
- .message = "none" };
+ error->type = RTE_FLOW_ERROR_TYPE_NONE;
+ error->message = "none";
int res = flow_filter_ops->flow_async_destroy(internals->flw_dev,
queue_id,
(const struct rte_flow_op_attr *)op_attr,
(struct flow_handle *)flow,
user_data,
- &rte_flow_error);
+ error);
- convert_error(error, &rte_flow_error);
return res;
}
--
2.45.0
next prev parent reply other threads:[~2025-01-21 17:10 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 17:07 [PATCH v1 00/31] net/ntnic: bugfixes and refactoring Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 01/31] net/ntnic: fix index verification Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 02/31] net/ntnic: add thread check return code Serhii Iliushyk
2025-01-21 18:24 ` Stephen Hemminger
2025-01-21 17:07 ` [PATCH v1 03/31] net/ntnic: add return code handling Serhii Iliushyk
2025-01-21 18:30 ` Stephen Hemminger
2025-01-21 17:07 ` [PATCH v1 04/31] net/ntnic: add array index verification Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 05/31] net/ntnic: fix realloc memory leak Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 06/31] net/ntnic: fix array index verification Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 07/31] net/ntnic: add var definition transparently Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 08/31] net/ntnic: add proper var freed Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 09/31] net/ntnic: remove deadcode Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 10/31] net/ntnic: fix potentially overflow Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 11/31] net/ntnic: add null checking Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 12/31] net/ntnic: fix overflow issue Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 13/31] net/ntnic: fix untrusted loop bound Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 14/31] net/ntnic: add null checking Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 15/31] net/ntnic: move " Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 16/31] net/ntnic: fix var size Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 17/31] net/ntnic: fix var overflow Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 18/31] net/ntnic: remove dead code Serhii Iliushyk
2025-01-21 17:07 ` Serhii Iliushyk [this message]
2025-01-21 17:07 ` [PATCH v1 20/31] net/ntnic: fix array verification Serhii Iliushyk
2025-01-21 17:07 ` [PATCH v1 21/31] net/ntnic: fix memory leak Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 22/31] net/ntnic: remove extra address-of operator Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 23/31] net/ntnic: remove extra check for null Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 24/31] net/ntnic: remove unused code Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 25/31] net/ntnic: refactor RSS implementation Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 26/31] net/ntnic: fix age timeout recalculation into fpga unit Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 27/31] net/ntnic: rework age event generation Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 28/31] net/ntnic: fix group print Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 29/31] net/ntnic: extend module mapping Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 30/31] net/ntnic: refactoring of the FPGA initialization Serhii Iliushyk
2025-01-21 17:08 ` [PATCH v1 31/31] net/ntnic: remove tag EXPERIMENTAL Serhii Iliushyk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250121170814.3252171-20-sil-plv@napatech.com \
--to=sil-plv@napatech.com \
--cc=ckm@napatech.com \
--cc=dev@dpdk.org \
--cc=dvo-plv@napatech.com \
--cc=mko-plv@napatech.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).