[2/9] net/mlx5: add flex item query tunnel mode routine
Checks
Commit Message
Once parsing the RTE item array the PMD needs to know
whether the flex item represents the tunnel header.
The appropriate tunnel mode query API is added.
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
---
drivers/net/mlx5/mlx5.h | 2 ++
drivers/net/mlx5/mlx5_flow_flex.c | 27 +++++++++++++++++++++++++++
2 files changed, 29 insertions(+)
@@ -2605,6 +2605,8 @@ int mlx5_flex_get_sample_id(const struct mlx5_flex_item *tp,
int mlx5_flex_get_parser_value_per_byte_off(const struct rte_flow_item_flex *item,
void *flex, uint32_t byte_off,
bool is_mask, bool tunnel, uint32_t *value);
+int mlx5_flex_get_tunnel_mode(const struct rte_flow_item *item,
+ enum rte_flow_item_flex_tunnel_mode *tunnel_mode);
int mlx5_flex_acquire_index(struct rte_eth_dev *dev,
struct rte_flow_item_flex_handle *handle,
bool acquire);
@@ -291,6 +291,33 @@ mlx5_flex_get_parser_value_per_byte_off(const struct rte_flow_item_flex *item,
return 0;
}
+/**
+ * Get the flex parser tunnel mode.
+ *
+ * @param[in] item
+ * RTE Flex item.
+ * @param[in, out] tunnel_mode
+ * Pointer to return tunnel mode.
+ *
+ * @return
+ * 0 on success, otherwise negative error code.
+ */
+int
+mlx5_flex_get_tunnel_mode(const struct rte_flow_item *item,
+ enum rte_flow_item_flex_tunnel_mode *tunnel_mode)
+{
+ if (item && item->spec && tunnel_mode) {
+ const struct rte_flow_item_flex *spec = item->spec;
+ struct mlx5_flex_item *flex = (struct mlx5_flex_item *)spec->handle;
+
+ if (flex) {
+ *tunnel_mode = flex->tunnel_mode;
+ return 0;
+ }
+ }
+ return -EINVAL;
+}
+
/**
* Translate item pattern into matcher fields according to translation
* array.