#define MLX5_ENCAP_MAX_LEN 132
-/* Encap/decap resource key of the hash organization. */
-union mlx5_flow_encap_decap_key {
- struct {
- uint32_t ft_type:8; /**< Flow table type, Rx or Tx. */
- uint32_t refmt_type:8; /**< Header reformat type. */
- uint32_t buf_size:8; /**< Encap buf size. */
- uint32_t table_level:8; /**< Root table or not. */
- uint32_t cksum; /**< Encap buf check sum. */
- };
- uint64_t v64; /**< full 64bits value of key */
-};
-
/* Encap/decap resource structure. */
struct mlx5_flow_dv_encap_decap_resource {
struct mlx5_hlist_entry entry;
struct mlx5_priv *priv = dev->data->dev_private;
struct mlx5_dev_ctx_shared *sh = priv->sh;
struct mlx5_hlist_entry *entry;
- union mlx5_flow_encap_decap_key encap_decap_key = {
+ union {
+ struct {
+ uint32_t ft_type:8;
+ uint32_t refmt_type:8;
+ /*
+ * Header reformat actions can be shared between
+ * non-root tables. One bit to indicate non-root
+ * table or not.
+ */
+ uint32_t is_root:1;
+ uint32_t reserve:15;
+ };
+ uint32_t v32;
+ } encap_decap_key = {
{
.ft_type = resource->ft_type,
.refmt_type = resource->reformat_type,
- .buf_size = resource->size,
- .table_level = !!dev_flow->dv.group,
- .cksum = 0,
+ .is_root = !!dev_flow->dv.group,
+ .reserve = 0,
}
};
struct mlx5_flow_cb_ctx ctx = {
};
resource->flags = dev_flow->dv.group ? 0 : 1;
- encap_decap_key.cksum = __rte_raw_cksum(resource->buf,
- resource->size, 0);
- resource->entry.key = encap_decap_key.v64;
+ resource->entry.key = __rte_raw_cksum(&encap_decap_key.v32,
+ sizeof(encap_decap_key.v32), 0);
+ if (resource->reformat_type !=
+ MLX5DV_FLOW_ACTION_PACKET_REFORMAT_TYPE_L2_TUNNEL_TO_L2 &&
+ resource->size)
+ resource->entry.key = __rte_raw_cksum(resource->buf,
+ resource->size,
+ resource->entry.key);
entry = mlx5_hlist_register(sh->encaps_decaps, resource->entry.key,
&ctx);
if (!entry)