#include <rte_vxlan.h>
#include <rte_gtp.h>
-#include "mlx5.h"
+#include <mlx5_glue.h>
+#include <mlx5_devx_cmds.h>
+#include <mlx5_prm.h>
+
#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
{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,
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 ?
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;
struct rte_flow_item_meta nic_mask = {
.data = UINT32_MAX
};
- enum modify_reg reg;
+ int reg;
int ret;
if (!spec)
/**
* 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.
*
* @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
* 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.
*
*
* @param[in] item_flags
* Holds the items detected in this rule.
+ * @param[in] 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.
*
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"VLAN VID value is too big");
- /* there is an of_push_vlan action before us */
- if (action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) {
- if (mlx5_flow_find_action(actions + 1,
- RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID))
- return rte_flow_error_set(error, ENOTSUP,
- RTE_FLOW_ERROR_TYPE_ACTION, action,
- "Multiple VLAN VID modifications are "
- "not supported");
- else
- return 0;
- }
-
- /*
- * Action is on an existing VLAN header:
- * Need to verify this is a single modify CID action.
- * Rule mast include a match on outer VLAN.
- */
+ if (!(action_flags & MLX5_FLOW_ACTION_OF_PUSH_VLAN) &&
+ !(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
+ return rte_flow_error_set(error, ENOTSUP,
+ RTE_FLOW_ERROR_TYPE_ACTION, action,
+ "set VLAN VID action must follow push"
+ " VLAN action or match on VLAN item");
if (action_flags & MLX5_FLOW_ACTION_OF_SET_VLAN_VID)
return rte_flow_error_set(error, ENOTSUP,
RTE_FLOW_ERROR_TYPE_ACTION, action,
"Multiple VLAN VID modifications are "
"not supported");
- if (!(item_flags & MLX5_FLOW_LAYER_OUTER_VLAN))
- return rte_flow_error_set(error, EINVAL,
- RTE_FLOW_ERROR_TYPE_ACTION, action,
- "match on VLAN is required in order "
- "to set VLAN VID");
if (action_flags & MLX5_FLOW_ACTION_PORT_ID)
return rte_flow_error_set(error, EINVAL,
RTE_FLOW_ERROR_TYPE_ACTION, action,
* @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
{
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,
* @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
* Validate count action.
*
* @param[in] dev
- * device otr.
+ * Pointer to rte_eth_dev structure.
* @param[out] error
* Pointer to error structure.
*
* @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
(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 =
&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,
*
* @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.
*
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 = {
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;
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;
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;
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))
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);
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)