X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fmlx5%2Fmlx5_flow_dv.c;h=1b3160280dfd167f603f706e800f399dd182897f;hb=7b4f1e6bd367;hp=4b6a92c83ce37f12cee59686c4f3d85f66817096;hpb=5a2ab34d81c2bd07539ae7cb5167498617909d42;p=dpdk.git diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 4b6a92c83c..1b3160280d 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -29,11 +29,13 @@ #include #include -#include "mlx5.h" +#include +#include +#include + #include "mlx5_defs.h" -#include "mlx5_glue.h" +#include "mlx5.h" #include "mlx5_flow.h" -#include "mlx5_prm.h" #include "mlx5_rxtx.h" #ifdef HAVE_IBV_FLOW_DV_SUPPORT @@ -1077,7 +1079,7 @@ flow_dv_convert_action_mark(struct rte_eth_dev *dev, {4, 0, 0}, /* dynamic instead of MLX5_MODI_META_REG_C_1. */ {0, 0, 0}, }; - enum modify_reg reg; + int reg; if (!mask) return rte_flow_error_set(error, EINVAL, @@ -1119,7 +1121,7 @@ flow_dv_get_metadata_reg(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, struct rte_flow_error *error) { - enum modify_reg reg = + int reg = mlx5_flow_get_reg_id(dev, attr->transfer ? MLX5_METADATA_FDB : attr->egress ? @@ -1167,7 +1169,7 @@ flow_dv_convert_action_set_meta struct field_modify_info reg_c_x[] = { [1] = {0, 0, 0}, }; - enum modify_reg reg = flow_dv_get_metadata_reg(dev, attr, error); + int reg = flow_dv_get_metadata_reg(dev, attr, error); if (reg < 0) return reg; @@ -1370,7 +1372,7 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused, struct rte_flow_item_meta nic_mask = { .data = UINT32_MAX }; - enum modify_reg reg; + int reg; int ret; if (!spec) @@ -1662,14 +1664,10 @@ flow_dv_validate_action_pop_vlan(struct rte_eth_dev *dev, /** * Get VLAN default info from vlan match info. * - * @param[in] dev - * Pointer to the rte_eth_dev structure. - * @param[in] item + * @param[in] items * the list of item specifications. * @param[out] vlan * pointer VLAN info to fill to. - * @param[out] error - * Pointer to error structure. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. @@ -1721,8 +1719,10 @@ flow_dev_get_vlan_info_from_items(const struct rte_flow_item *items, * * @param[in] action_flags * Holds the actions detected until now. + * @param[in] item_flags + * The items found in this flow rule. * @param[in] action - * Pointer to the encap action. + * Pointer to the action structure. * @param[in] attr * Pointer to flow attributes * @param[out] error @@ -1772,8 +1772,6 @@ flow_dv_validate_action_push_vlan(uint64_t action_flags, * Holds the actions detected until now. * @param[in] actions * Pointer to the list of actions remaining in the flow rule. - * @param[in] attr - * Pointer to flow attributes * @param[out] error * Pointer to error structure. * @@ -1988,7 +1986,7 @@ flow_dv_validate_action_mark(struct rte_eth_dev *dev, * @param[in] dev * Pointer to the rte_eth_dev structure. * @param[in] action - * Pointer to the encap action. + * Pointer to the action structure. * @param[in] action_flags * Holds the actions detected until now. * @param[in] attr @@ -2008,7 +2006,7 @@ flow_dv_validate_action_set_meta(struct rte_eth_dev *dev, { const struct rte_flow_action_set_meta *conf; uint32_t nic_mask = UINT32_MAX; - enum modify_reg reg; + int reg; if (!mlx5_flow_ext_mreg_supported(dev)) return rte_flow_error_set(error, ENOTSUP, @@ -2049,7 +2047,7 @@ flow_dv_validate_action_set_meta(struct rte_eth_dev *dev, * @param[in] dev * Pointer to the rte_eth_dev structure. * @param[in] action - * Pointer to the encap action. + * Pointer to the action structure. * @param[in] action_flags * Holds the actions detected until now. * @param[in] attr @@ -2103,7 +2101,7 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev, * Validate count action. * * @param[in] dev - * device otr. + * Pointer to rte_eth_dev structure. * @param[out] error * Pointer to error structure. * @@ -2135,7 +2133,7 @@ notsup_err: * @param[in] action_flags * Holds the actions detected until now. * @param[in] action - * Pointer to the encap action. + * Pointer to the action structure. * @param[in] attr * Pointer to flow attributes * @param[out] error @@ -2887,8 +2885,6 @@ flow_dv_create_action_l2_encap(struct rte_eth_dev *dev, (const struct rte_flow_action_raw_encap *)action->conf; res.size = raw_encap_data->size; memcpy(res.buf, raw_encap_data->data, res.size); - if (flow_dv_zero_encap_udp_csum(res.buf, error)) - return -rte_errno; } else { if (action->type == RTE_FLOW_ACTION_TYPE_VXLAN_ENCAP) encap_data = @@ -2902,6 +2898,8 @@ flow_dv_create_action_l2_encap(struct rte_eth_dev *dev, &res.size, error)) return -rte_errno; } + if (flow_dv_zero_encap_udp_csum(res.buf, error)) + return -rte_errno; if (flow_dv_encap_decap_resource_register(dev, &res, dev_flow, error)) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, @@ -2995,12 +2993,12 @@ flow_dv_create_action_raw_encap(struct rte_eth_dev *dev, * * @param[in] dev * Pointer to rte_eth_dev structure. - * @param[in] vlan_tag - * the vlan tag to push to the Ethernet header. - * @param[in, out] dev_flow - * Pointer to the mlx5_flow. * @param[in] attr * Pointer to the flow attributes. + * @param[in] vlan + * Pointer to the vlan to push to the Ethernet header. + * @param[in, out] dev_flow + * Pointer to the mlx5_flow. * @param[out] error * Pointer to the error structure. * @@ -4406,6 +4404,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, uint8_t next_protocol = 0xff; uint16_t ether_type = 0; int actions_n = 0; + uint8_t item_ipv6_proto = 0; const struct rte_flow_item *gre_item = NULL; struct rte_flow_item_tcp nic_tcp_mask = { .hdr = { @@ -4513,6 +4512,9 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, if (items->mask != NULL && ((const struct rte_flow_item_ipv6 *) items->mask)->hdr.proto) { + item_ipv6_proto = + ((const struct rte_flow_item_ipv6 *) + items->spec)->hdr.proto; next_protocol = ((const struct rte_flow_item_ipv6 *) items->spec)->hdr.proto; @@ -4885,6 +4887,12 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; + if (item_ipv6_proto == IPPROTO_ICMPV6) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, + actions, + "Can't change header " + "with ICMPv6 proto"); /* Count all modify-header actions as one action. */ if (!(action_flags & MLX5_FLOW_MODIFY_HDR_ACTIONS)) ++actions_n; @@ -6085,7 +6093,7 @@ flow_dv_translate_item_meta(struct rte_eth_dev *dev, meta_m = &rte_flow_item_meta_mask; meta_v = (const void *)item->spec; if (meta_v) { - enum modify_reg reg; + int reg; uint32_t value = meta_v->data; uint32_t mask = meta_m->data; @@ -7606,13 +7614,13 @@ cnt_err: item_flags |= last_item; } /* - * In case of ingress traffic when E-Switch mode is enabled, - * we have two cases where we need to set the source port manually. + * When E-Switch mode is enabled, we have two cases where we need to + * set the source port manually. * The first one, is in case of Nic steering rule, and the second is * E-Switch rule where no port_id item was found. In both cases * the source port is set according the current port in use. */ - if ((attr->ingress && !(item_flags & MLX5_FLOW_ITEM_PORT_ID)) && + if (!(item_flags & MLX5_FLOW_ITEM_PORT_ID) && (priv->representor || priv->master)) { if (flow_dv_translate_item_port_id(dev, match_mask, match_value, NULL)) @@ -8265,7 +8273,7 @@ flow_dv_prepare_mtr_tables(struct rte_eth_dev *dev, dv_attr.match_criteria_enable = 1 << MLX5_MATCH_CRITERIA_ENABLE_MISC2_BIT; flow_dv_match_meta_reg(mask.buf, value.buf, color_reg_c_idx, - rte_col_2_mlx5_col(RTE_COLORS), UINT32_MAX); + rte_col_2_mlx5_col(RTE_COLORS), UINT8_MAX); dtb->color_matcher = mlx5_glue->dv_create_flow_matcher(sh->ctx, &dv_attr, dtb->tbl->obj); @@ -8459,7 +8467,7 @@ flow_dv_create_policer_forward_rule(struct mlx5_flow_meter *fm, int j = 0; flow_dv_match_meta_reg(matcher.buf, value.buf, mtr_reg_c, - rte_col_2_mlx5_col(i), UINT32_MAX); + rte_col_2_mlx5_col(i), UINT8_MAX); if (mtb->count_actns[i]) actions[j++] = mtb->count_actns[i]; if (fm->params.action[i] == MTR_POLICER_ACTION_DROP)