net/bnxt: configure PARIF for offload miss rules
authorKishore Padmanabha <kishore.padmanabha@broadcom.com>
Thu, 23 Jul 2020 11:56:22 +0000 (17:26 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 29 Jul 2020 22:41:23 +0000 (00:41 +0200)
PARIF is handler to a partition of the physical port.
For the offload miss rules, the parif miss path needs to be
considered. The higher parif are reserved for handling this.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/tf_ulp/ulp_def_rules.c
drivers/net/bnxt/tf_ulp/ulp_port_db.h
drivers/net/bnxt/tf_ulp/ulp_rte_parser.c

index 4d4f7c4..d86e4c9 100644 (file)
@@ -12,8 +12,6 @@
 #include "ulp_flow_db.h"
 #include "ulp_mapper.h"
 
-#define BNXT_ULP_FREE_PARIF_BASE 11
-
 struct bnxt_ulp_def_param_handler {
        int32_t (*vfr_func)(struct bnxt_ulp_context *ulp_ctx,
                            struct ulp_tlv_param *param,
@@ -85,6 +83,8 @@ ulp_set_parif_in_comp_fld(struct bnxt_ulp_context *ulp_ctx,
 
        if (parif_type == BNXT_ULP_PHY_PORT_PARIF) {
                idx = BNXT_ULP_CF_IDX_PHY_PORT_PARIF;
+               /* Parif needs to be reset to a free partition */
+               parif += BNXT_ULP_FREE_PARIF_BASE;
        } else if (parif_type == BNXT_ULP_DRV_FUNC_PARIF) {
                idx = BNXT_ULP_CF_IDX_DRV_FUNC_PARIF;
                /* Parif needs to be reset to a free partition */
index 393d01b..2b323d1 100644 (file)
@@ -10,6 +10,7 @@
 
 #define BNXT_PORT_DB_MAX_INTF_LIST             256
 #define BNXT_PORT_DB_MAX_FUNC                  2048
+#define BNXT_ULP_FREE_PARIF_BASE               11
 
 enum bnxt_ulp_svif_type {
        BNXT_ULP_DRV_FUNC_SVIF = 0,
index 3891bcd..39f801b 100644 (file)
@@ -158,6 +158,43 @@ bnxt_ulp_rte_parser_act_parse(const struct rte_flow_action actions[],
        return BNXT_TF_RC_SUCCESS;
 }
 
+/*
+ * Function to handle the post processing of the computed
+ * fields for the interface.
+ */
+static void
+bnxt_ulp_comp_fld_intf_update(struct ulp_rte_parser_params *params)
+{
+       uint32_t ifindex;
+       uint16_t port_id, parif;
+       enum bnxt_ulp_direction_type dir;
+
+       /* get the direction details */
+       dir = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_DIRECTION);
+
+       if (dir == BNXT_ULP_DIR_INGRESS) {
+               /* read the port id details */
+               port_id = ULP_COMP_FLD_IDX_RD(params,
+                                             BNXT_ULP_CF_IDX_INCOMING_IF);
+               if (ulp_port_db_dev_port_to_ulp_index(params->ulp_ctx,
+                                                     port_id,
+                                                     &ifindex)) {
+                       BNXT_TF_DBG(ERR, "ParseErr:Portid is not valid\n");
+                       return;
+               }
+               /* Set port PARIF */
+               if (ulp_port_db_parif_get(params->ulp_ctx, ifindex,
+                                         BNXT_ULP_PHY_PORT_PARIF, &parif)) {
+                       BNXT_TF_DBG(ERR, "ParseErr:ifindex is not valid\n");
+                       return;
+               }
+               /* Parif needs to be reset to a free partition */
+               parif += BNXT_ULP_FREE_PARIF_BASE;
+               ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_PHY_PORT_PARIF,
+                                   parif);
+       }
+}
+
 /*
  * Function to handle the post processing of the parsing details
  */
@@ -213,6 +250,9 @@ bnxt_ulp_rte_parser_post_process(struct ulp_rte_parser_params *params)
        /* Merge the hdr_fp_bit into the proto header bit */
        params->hdr_bitmap.bits |= params->hdr_fp_bit.bits;
 
+       /* Update the computed interface parameters */
+       bnxt_ulp_comp_fld_intf_update(params);
+
        /* TBD: Handle the flow rejection scenarios */
        return 0;
 }