From aa0fa4d9f4ce3144c9ca31044deafc16f54c5604 Mon Sep 17 00:00:00 2001 From: Mike Baucom Date: Wed, 15 Apr 2020 20:19:11 +0530 Subject: [PATCH] net/bnxt: aggregate ULP mapper create arguments The changes are to the ulp mapper flow_create, the API changed to take the bnxt_ulp_mapper_create_parms structure instead of individual fields. Reviewed-by: Venkat Duvvuru Reviewed-by: Ajit Khaparde Signed-off-by: Mike Baucom Signed-off-by: Venkat Duvvuru --- drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c | 19 +++++++------- drivers/net/bnxt/tf_ulp/ulp_mapper.c | 33 +++++++++++-------------- drivers/net/bnxt/tf_ulp/ulp_mapper.h | 20 +++++++++------ 3 files changed, 37 insertions(+), 35 deletions(-) diff --git a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c index 026f33f660..9326401b4d 100644 --- a/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c +++ b/drivers/net/bnxt/tf_ulp/bnxt_ulp_flow.c @@ -67,11 +67,11 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, const struct rte_flow_action actions[], struct rte_flow_error *error) { + struct bnxt_ulp_mapper_create_parms mapper_cparms = { 0 }; struct ulp_rte_parser_params params; struct bnxt_ulp_context *ulp_ctx = NULL; uint32_t class_id, act_tmpl; struct rte_flow *flow_id; - uint32_t app_priority; uint32_t fid; uint8_t *buffer; uint32_t vnic; @@ -125,16 +125,17 @@ bnxt_ulp_flow_create(struct rte_eth_dev *dev, if (ret != BNXT_TF_RC_SUCCESS) goto parse_error; - app_priority = attr->priority; + mapper_cparms.app_priority = attr->priority; + mapper_cparms.hdr_bitmap = ¶ms.hdr_bitmap; + mapper_cparms.hdr_field = params.hdr_field; + mapper_cparms.act = ¶ms.act_bitmap; + mapper_cparms.act_prop = ¶ms.act_prop; + mapper_cparms.class_tid = class_id; + mapper_cparms.act_tid = act_tmpl; + /* call the ulp mapper to create the flow in the hardware */ ret = ulp_mapper_flow_create(ulp_ctx, - app_priority, - ¶ms.hdr_bitmap, - params.hdr_field, - ¶ms.act_bitmap, - ¶ms.act_prop, - class_id, - act_tmpl, + &mapper_cparms, &fid); if (!ret) { flow_id = (struct rte_flow *)((uintptr_t)fid); diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.c b/drivers/net/bnxt/tf_ulp/ulp_mapper.c index f787c6e4d1..f70afa47f1 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.c +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.c @@ -1411,26 +1411,23 @@ ulp_mapper_flow_destroy(struct bnxt_ulp_context *ulp_ctx, uint32_t fid) */ int32_t ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, - uint32_t app_priority __rte_unused, - struct ulp_rte_hdr_bitmap *hdr_bitmap __rte_unused, - struct ulp_rte_hdr_field *hdr_field, - struct ulp_rte_act_bitmap *act_bitmap, - struct ulp_rte_act_prop *act_prop, - uint32_t class_tid, - uint32_t act_tid, - uint32_t *flow_id) + struct bnxt_ulp_mapper_create_parms *cparms, + uint32_t *flowid) { - struct ulp_regfile regfile; - struct bnxt_ulp_mapper_parms parms; - struct bnxt_ulp_device_params *device_params; - int32_t rc, trc; + struct bnxt_ulp_device_params *device_params; + struct bnxt_ulp_mapper_parms parms; + struct ulp_regfile regfile; + int32_t rc, trc; + + if (!ulp_ctx || !cparms) + return -EINVAL; /* Initialize the parms structure */ memset(&parms, 0, sizeof(parms)); - parms.act_prop = act_prop; - parms.act_bitmap = act_bitmap; + parms.act_prop = cparms->act_prop; + parms.act_bitmap = cparms->act; parms.regfile = ®file; - parms.hdr_field = hdr_field; + parms.hdr_field = cparms->hdr_field; parms.tfp = bnxt_ulp_cntxt_tfp_get(ulp_ctx); parms.ulp_ctx = ulp_ctx; @@ -1441,7 +1438,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, } /* Get the action table entry from device id and act context id */ - parms.act_tid = act_tid; + parms.act_tid = cparms->act_tid; parms.atbls = ulp_mapper_action_tbl_list_get(parms.dev_id, parms.act_tid, &parms.num_atbls); @@ -1452,7 +1449,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, } /* Get the class table entry from device id and act context id */ - parms.class_tid = class_tid; + parms.class_tid = cparms->class_tid; parms.ctbls = ulp_mapper_class_tbl_list_get(parms.dev_id, parms.class_tid, &parms.num_ctbls); @@ -1506,7 +1503,7 @@ ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, goto flow_error; } - *flow_id = parms.fid; + *flowid = parms.fid; return rc; diff --git a/drivers/net/bnxt/tf_ulp/ulp_mapper.h b/drivers/net/bnxt/tf_ulp/ulp_mapper.h index 5f3d46effc..24727a32dd 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_mapper.h +++ b/drivers/net/bnxt/tf_ulp/ulp_mapper.h @@ -38,20 +38,24 @@ struct bnxt_ulp_mapper_parms { enum bnxt_ulp_flow_db_tables tbl_idx; }; +struct bnxt_ulp_mapper_create_parms { + uint32_t app_priority; + struct ulp_rte_hdr_bitmap *hdr_bitmap; + struct ulp_rte_hdr_field *hdr_field; + struct ulp_rte_act_bitmap *act; + struct ulp_rte_act_prop *act_prop; + uint32_t class_tid; + uint32_t act_tid; +}; + /* * Function to handle the mapping of the Flow to be compatible * with the underlying hardware. */ int32_t ulp_mapper_flow_create(struct bnxt_ulp_context *ulp_ctx, - uint32_t app_priority, - struct ulp_rte_hdr_bitmap *hdr_bitmap, - struct ulp_rte_hdr_field *hdr_field, - struct ulp_rte_act_bitmap *act, - struct ulp_rte_act_prop *act_prop, - uint32_t class_tid, - uint32_t act_tid, - uint32_t *flow_id); + struct bnxt_ulp_mapper_create_parms *parms, + uint32_t *flowid); /* Function that frees all resources associated with the flow. */ int32_t -- 2.20.1