X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fbnxt%2Ftf_ulp%2Fulp_rte_parser.c;h=073b3537f77016a4d6af72615a2daf6cf98e970a;hb=afa8eeffec6998d3313c36ed10484407ae594730;hp=842466da963733265a798210ed7253f34458af35;hpb=52799debdf1c3d9c25a5585c591e8b8959495c23;p=dpdk.git diff --git a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c index 842466da96..073b3537f7 100644 --- a/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c +++ b/drivers/net/bnxt/tf_ulp/ulp_rte_parser.c @@ -4,7 +4,7 @@ */ #include "bnxt.h" -#include "ulp_template_db.h" +#include "ulp_template_db_enum.h" #include "ulp_template_struct.h" #include "bnxt_tf_common.h" #include "ulp_rte_parser.h" @@ -166,6 +166,8 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params, uint16_t port_id = svif; uint32_t dir = 0; struct ulp_rte_hdr_field *hdr_field; + enum bnxt_ulp_svif_type svif_type; + enum bnxt_ulp_intf_type if_type; uint32_t ifindex; int32_t rc; @@ -187,7 +189,18 @@ ulp_rte_parser_svif_set(struct ulp_rte_parser_params *params, "Invalid port id\n"); return BNXT_TF_RC_ERROR; } - ulp_port_db_svif_get(params->ulp_ctx, ifindex, dir, &svif); + + if (dir == ULP_DIR_INGRESS) { + svif_type = BNXT_ULP_PHY_PORT_SVIF; + } else { + if_type = bnxt_get_interface_type(port_id); + if (if_type == BNXT_ULP_INTF_TYPE_VF_REP) + svif_type = BNXT_ULP_VF_FUNC_SVIF; + else + svif_type = BNXT_ULP_DRV_FUNC_SVIF; + } + ulp_port_db_svif_get(params->ulp_ctx, ifindex, svif_type, + &svif); svif = rte_cpu_to_be_16(svif); } hdr_field = ¶ms->hdr_field[BNXT_ULP_PROTO_HDR_FIELD_SVIF_IDX]; @@ -230,6 +243,9 @@ ulp_rte_parser_vnic_process(struct ulp_rte_parser_params *params) /* Update the vnic details */ ulp_rte_pf_act_handler(NULL, params); + /* Reset the hdr_bitmap with vnic bit */ + ULP_BITMAP_RESET(params->act_bitmap.bits, BNXT_ULP_ACTION_BIT_VNIC); + return BNXT_TF_RC_SUCCESS; } @@ -598,6 +614,7 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, uint32_t idx = params->field_idx; uint32_t size; uint32_t inner_l3, outer_l3; + uint32_t vtcf, vtcf_mask; inner_l3 = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_I_L3); if (inner_l3) { @@ -606,14 +623,27 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, } /* - * Copy the rte_flow_item for ipv4 into hdr_field using ipv4 + * Copy the rte_flow_item for ipv6 into hdr_field using ipv6 * header fields */ if (ipv6_spec) { size = sizeof(ipv6_spec->hdr.vtc_flow); + + vtcf = BNXT_ULP_GET_IPV6_VER(ipv6_spec->hdr.vtc_flow); field = ulp_rte_parser_fld_copy(¶ms->hdr_field[idx], - &ipv6_spec->hdr.vtc_flow, + &vtcf, + size); + + vtcf = BNXT_ULP_GET_IPV6_TC(ipv6_spec->hdr.vtc_flow); + field = ulp_rte_parser_fld_copy(field, + &vtcf, + size); + + vtcf = BNXT_ULP_GET_IPV6_FLOWLABEL(ipv6_spec->hdr.vtc_flow); + field = ulp_rte_parser_fld_copy(field, + &vtcf, size); + size = sizeof(ipv6_spec->hdr.payload_len); field = ulp_rte_parser_fld_copy(field, &ipv6_spec->hdr.payload_len, @@ -636,9 +666,24 @@ ulp_rte_ipv6_hdr_handler(const struct rte_flow_item *item, size); } if (ipv6_mask) { + size = sizeof(ipv6_mask->hdr.vtc_flow); + + vtcf_mask = BNXT_ULP_GET_IPV6_VER(ipv6_mask->hdr.vtc_flow); + ulp_rte_prsr_mask_copy(params, &idx, + &vtcf_mask, + size); + + vtcf_mask = BNXT_ULP_GET_IPV6_TC(ipv6_mask->hdr.vtc_flow); ulp_rte_prsr_mask_copy(params, &idx, - &ipv6_mask->hdr.vtc_flow, - sizeof(ipv6_mask->hdr.vtc_flow)); + &vtcf_mask, + size); + + vtcf_mask = + BNXT_ULP_GET_IPV6_FLOWLABEL(ipv6_mask->hdr.vtc_flow); + ulp_rte_prsr_mask_copy(params, &idx, + &vtcf_mask, + size); + ulp_rte_prsr_mask_copy(params, &idx, &ipv6_mask->hdr.payload_len, sizeof(ipv6_mask->hdr.payload_len)); @@ -1096,6 +1141,10 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, memcpy(&ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_L3_TYPE], &ip_type, sizeof(uint32_t)); + /* update the computed field to notify it is ipv4 header */ + ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_ENCAP_IPV4_FLAG, + 1); + if (!ulp_rte_item_skip_void(&item, 1)) return BNXT_TF_RC_ERROR; } else if (item->type == RTE_FLOW_ITEM_TYPE_IPV6) { @@ -1116,6 +1165,10 @@ ulp_rte_vxlan_encap_act_handler(const struct rte_flow_action *action_item, memcpy(&ap->act_details[BNXT_ULP_ACT_PROP_IDX_ENCAP_L3_TYPE], &ip_type, sizeof(uint32_t)); + /* update the computed field to notify it is ipv6 header */ + ULP_COMP_FLD_IDX_WR(params, BNXT_ULP_CF_IDX_ACT_ENCAP_IPV6_FLAG, + 1); + if (!ulp_rte_item_skip_void(&item, 1)) return BNXT_TF_RC_ERROR; } else { @@ -1216,7 +1269,7 @@ ulp_rte_pf_act_handler(const struct rte_flow_action *action_item __rte_unused, /* copy the PF of the current device into VNIC Property */ svif = ULP_COMP_FLD_IDX_RD(params, BNXT_ULP_CF_IDX_INCOMING_IF); - svif = bnxt_get_vnic_id(svif); + svif = bnxt_get_vnic_id(svif, BNXT_ULP_INTF_TYPE_INVALID); svif = rte_cpu_to_be_32(svif); memcpy(¶ms->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC], &svif, BNXT_ULP_ACT_PROP_SZ_VNIC); @@ -1240,7 +1293,8 @@ ulp_rte_vf_act_handler(const struct rte_flow_action *action_item, return BNXT_TF_RC_PARSE_ERR; } /* TBD: Update the computed VNIC using VF conversion */ - pid = bnxt_get_vnic_id(vf_action->id); + pid = bnxt_get_vnic_id(vf_action->id, + BNXT_ULP_INTF_TYPE_INVALID); pid = rte_cpu_to_be_32(pid); memcpy(¶m->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC], &pid, BNXT_ULP_ACT_PROP_SZ_VNIC); @@ -1267,7 +1321,7 @@ ulp_rte_port_id_act_handler(const struct rte_flow_action *act_item, return BNXT_TF_RC_PARSE_ERR; } /* TBD: Update the computed VNIC using port conversion */ - pid = bnxt_get_vnic_id(port_id->id); + pid = bnxt_get_vnic_id(port_id->id, BNXT_ULP_INTF_TYPE_INVALID); pid = rte_cpu_to_be_32(pid); memcpy(¶m->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VNIC], &pid, BNXT_ULP_ACT_PROP_SZ_VNIC); @@ -1284,7 +1338,7 @@ ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item, struct ulp_rte_parser_params *prm) { const struct rte_flow_action_phy_port *phy_port; - uint32_t pid; + uint32_t vport; phy_port = action_item->conf; if (phy_port) { @@ -1293,10 +1347,12 @@ ulp_rte_phy_port_act_handler(const struct rte_flow_action *action_item, "Parse Err:Port Original not supported\n"); return BNXT_TF_RC_PARSE_ERR; } - pid = bnxt_get_vnic_id(phy_port->index); - pid = rte_cpu_to_be_32(pid); + /* Get the vport of the physical port */ + /* TBD: shall be changed later to portdb call */ + vport = 1 << phy_port->index; + vport = rte_cpu_to_be_32(vport); memcpy(&prm->act_prop.act_details[BNXT_ULP_ACT_PROP_IDX_VPORT], - &pid, BNXT_ULP_ACT_PROP_SZ_VPORT); + &vport, BNXT_ULP_ACT_PROP_SZ_VPORT); } /* Update the hdr_bitmap with count */