net/mlx5: validate HWS template items
PATCH 1/1 net/mlx5: validate HWS template items
HWS item validation scheme is based on existing DV items validation.
Signed-off-by Gregory Etelson <[email protected]>
---
Depends-on: series-32045 ("validate actions in HWS table")
--- drivers/net/mlx5/linux/mlx5_flow_os.c | 21 +- drivers/net/mlx5/linux/mlx5_flow_os.h | 9 +- drivers/net/mlx5/mlx5_flow.c | 271 ++++++----- drivers/net/mlx5/mlx5_flow.h | 115 +++-- drivers/net/mlx5/mlx5_flow_dv.c | 369 +++++++------- drivers/net/mlx5/mlx5_flow_hw.c | 610 ++++++++++++++++-------- drivers/net/mlx5/mlx5_flow_verbs.c | 21 +- drivers/net/mlx5/windows/mlx5_flow_os.c | 5 +- drivers/net/mlx5/windows/mlx5_flow_os.h | 9 +- 9 files changed, 895 insertions(+), 535 deletions(-)
drivers/net/mlx5/linux/mlx5_flow_os.c +12 -9
@@ -14,10 +14,11 @@ static struct mlx5_flow_workspace *gc_head;static rte_spinlock_t mlx5_flow_workspace_lock =RTE_SPINLOCK_INITIALIZER ;int -mlx5_flow_os_validate_item_esp (const struct rte_flow_item *item, -uint64_t item_flags, -uint8_t target_protocol, -struct rte_flow_error *error) +mlx5_flow_os_validate_item_esp (const struct rte_eth_dev *dev, +const struct rte_flow_item *item, +uint64_t item_flags, +uint8_t target_protocol, +struct rte_flow_error *error) {const struct rte_flow_item_esp *mask = item->mask;const int tunnel = !!(item_flags &MLX5_FLOW_LAYER_TUNNEL );
@@ -27,10 +28,12 @@ mlx5_flow_os_validate_item_esp(const struct rte_flow_item *item,MLX5_FLOW_LAYER_OUTER_L4 ;int ret; -if (!(item_flags & l3m)) -return rte_flow_error_set (error,EINVAL , -RTE_FLOW_ERROR_TYPE_ITEM , item, -"L3 is mandatory to filter on L4" ); +if (!mlx5_hws_active (dev)) { +if (!(item_flags & l3m)) +return rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_ITEM , + item,"L3 is mandatory to filter on L4" ); + }if (item_flags & l4m) return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, item,
@@ -43,7 +46,7 @@ mlx5_flow_os_validate_item_esp(const struct rte_flow_item *item,if (!mask) mask = &rte_flow_item_esp_mask; ret =mlx5_flow_item_acceptable - (item, (const uint8_t *)mask, + (dev, item, (const uint8_t *)mask, (const uint8_t *)&rte_flow_item_esp_mask,sizeof (struct rte_flow_item_esp ),MLX5_ITEM_RANGE_NOT_ACCEPTED , error);
drivers/net/mlx5/linux/mlx5_flow_os.h +5 -4
@@ -521,10 +521,11 @@ mlx5_os_flow_dr_sync_domain(void *domain, uint32_t flags)* 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_flow_os_validate_item_esp (const struct rte_flow_item *item, -uint64_t item_flags, -uint8_t target_protocol, -struct rte_flow_error *error); +mlx5_flow_os_validate_item_esp (const struct rte_eth_dev *dev, +const struct rte_flow_item *item, +uint64_t item_flags, +uint8_t target_protocol, +struct rte_flow_error *error);/** * Add per thread workspace to the global list for garbage collection.
drivers/net/mlx5/mlx5_flow.c +157 -114
543 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow.h +82 -33
198 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_dv.c +205 -164
711 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_hw.c +414 -196
843 lines not on this page · raw message
drivers/net/mlx5/mlx5_flow_verbs.c +12 -9
@@ -1332,9 +1332,10 @@ flow_verbs_validate(struct rte_eth_dev *dev,switch (items->type) {#ifdef HAVE_IBV_FLOW_SPEC_ESP case RTE_FLOW_ITEM_TYPE_ESP : - ret =mlx5_flow_os_validate_item_esp (items, item_flags, - next_protocol, - error); + ret =mlx5_flow_os_validate_item_esp (dev, items, + item_flags, + next_protocol, + error);if (ret <0 )return ret; last_item =MLX5_FLOW_ITEM_ESP ;
@@ -1343,7 +1344,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,case RTE_FLOW_ITEM_TYPE_VOID :break ;case RTE_FLOW_ITEM_TYPE_ETH : - ret =mlx5_flow_validate_item_eth (items, item_flags, + ret =mlx5_flow_validate_item_eth (dev, items, item_flags, false, error);if (ret <0 )return ret;
@@ -1387,7 +1388,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,break ;case RTE_FLOW_ITEM_TYPE_IPV4 : ret =mlx5_flow_validate_item_ipv4 - (items, item_flags, + (dev, items, item_flags, last_item, ether_type,NULL ,MLX5_ITEM_RANGE_NOT_ACCEPTED , error);
@@ -1410,7 +1411,8 @@ flow_verbs_validate(struct rte_eth_dev *dev, }break ;case RTE_FLOW_ITEM_TYPE_IPV6 : - ret =mlx5_flow_validate_item_ipv6 (items, item_flags, + ret =mlx5_flow_validate_item_ipv6 (dev, items, + item_flags, last_item, ether_type,NULL , error);
@@ -1433,7 +1435,8 @@ flow_verbs_validate(struct rte_eth_dev *dev, }break ;case RTE_FLOW_ITEM_TYPE_UDP : - ret =mlx5_flow_validate_item_udp (items, item_flags, + ret =mlx5_flow_validate_item_udp (dev, items, + item_flags, next_protocol, error);const struct rte_flow_item_udp *spec = items->spec;
@@ -1452,7 +1455,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,break ;case RTE_FLOW_ITEM_TYPE_TCP : ret =mlx5_flow_validate_item_tcp - (items, item_flags, + (dev, items, item_flags, next_protocol, &rte_flow_item_tcp_mask, error);
@@ -1478,7 +1481,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, last_item =MLX5_FLOW_LAYER_VXLAN_GPE ;break ;case RTE_FLOW_ITEM_TYPE_GRE : - ret =mlx5_flow_validate_item_gre (items, item_flags, + ret =mlx5_flow_validate_item_gre (dev, items, item_flags, next_protocol, error);if (ret <0 )return ret;
drivers/net/mlx5/windows/mlx5_flow_os.c +3 -2
@@ -424,7 +424,8 @@ mlx5_flow_os_workspace_gc_add(struct mlx5_flow_workspace *ws) }int -mlx5_flow_os_validate_item_esp (const struct rte_flow_item *item, +mlx5_flow_os_validate_item_esp (const struct rte_eth_dev *dev, +const struct rte_flow_item *item,uint64_t item_flags,uint8_t target_protocol,struct rte_flow_error *error)
@@ -459,7 +460,7 @@ mlx5_flow_os_validate_item_esp(const struct rte_flow_item *item,"matching on spi field in esp is not" " supported on Windows"); ret =mlx5_flow_item_acceptable - (item, (const uint8_t *)mask, + (dev, item, (const uint8_t *)mask, (const uint8_t *)&rte_flow_item_esp_mask,sizeof (struct rte_flow_item_esp ),MLX5_ITEM_RANGE_NOT_ACCEPTED , error);
drivers/net/mlx5/windows/mlx5_flow_os.h +5 -4
@@ -468,10 +468,11 @@ int mlx5_flow_os_destroy_flow(void *drv_flow_ptr);* 0 on success, a negative errno value otherwise and rte_errno is set. */ int -mlx5_flow_os_validate_item_esp (const struct rte_flow_item *item, -uint64_t item_flags, -uint8_t target_protocol, -struct rte_flow_error *error); +mlx5_flow_os_validate_item_esp (const struct rte_eth_dev *dev, +const struct rte_flow_item *item, +uint64_t item_flags, +uint8_t target_protocol, +struct rte_flow_error *error);/** * Add per thread workspace to the global list for garbage collection.
Signature · 1 line
2.43.0
Hi,
From: Gregory Etelson <[email protected]>
Sent: Wednesday, June 5, 2024 7:27 AM
To: [email protected]
Cc: Gregory Etelson; Maayan Kashani; Raslan Darawsheh; Dariusz Sosnowski; Slava Ovsiienko; Ori Kam; Suanming Mou; Matan Azrad
Subject: [PATCH] net/mlx5: validate HWS template items
HWS item validation scheme is based on existing DV items validation.
Signed-off-by Gregory Etelson <[email protected]>
---
Patch applied to next-net-mlx,
Kindest regards
Raslan Darawsheh