Add HWS modify IPv6 protocol implementation.

Signed-off-by: Rongwei Liu <rongw...@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viachesl...@nvidia.com>
---
 drivers/common/mlx5/mlx5_prm.h  |  1 +
 drivers/net/mlx5/mlx5_flow_dv.c | 10 ++++++++++
 2 files changed, 11 insertions(+)

diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index ce6cd98fd7..497f2622b2 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -759,6 +759,7 @@ enum mlx5_modification_field {
        MLX5_MODI_OUT_IP_ECN = 0x73,
        MLX5_MODI_TUNNEL_HDR_DW_1 = 0x75,
        MLX5_MODI_GTPU_FIRST_EXT_DW_0 = 0x76,
+       MLX5_MODI_OUT_IPV6_NEXT_HDR = 0x4A,
 };
 
 /* Total number of metadata reg_c's. */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 7ca909999b..e972a2dc5a 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -1357,6 +1357,7 @@ mlx5_flow_item_field_width(struct rte_eth_dev *dev,
        case RTE_FLOW_FIELD_IPV6_DSCP:
                return 6;
        case RTE_FLOW_FIELD_IPV6_HOPLIMIT:
+       case RTE_FLOW_FIELD_IPV6_PROTO:
                return 8;
        case RTE_FLOW_FIELD_IPV6_SRC:
        case RTE_FLOW_FIELD_IPV6_DST:
@@ -1883,6 +1884,15 @@ mlx5_flow_field_id_to_modify_info
                                info[idx].offset = data->offset;
                }
                break;
+       case RTE_FLOW_FIELD_IPV6_PROTO:
+               MLX5_ASSERT(data->offset + width <= 8);
+               off_be = 8 - (data->offset + width);
+               info[idx] = (struct field_modify_info){1, 0, 
MLX5_MODI_OUT_IPV6_NEXT_HDR};
+               if (mask)
+                       mask[idx] = flow_modify_info_mask_8(width, off_be);
+               else
+                       info[idx].offset = off_be;
+               break;
        case RTE_FLOW_FIELD_POINTER:
        case RTE_FLOW_FIELD_VALUE:
        default:
-- 
2.27.0

Reply via email to