FILE
fs_hws.h
File preview with syntax highlighting.
linux-6.19.14/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/fs_hws.h
1/* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */ 2/* Copyright (c) 2025 NVIDIA Corporation & Affiliates */ 3 4#ifndef _MLX5_FS_HWS_ 5#define _MLX5_FS_HWS_ 6 7#include "mlx5hws.h" 8#include "fs_hws_pools.h" 9 10struct mlx5_fs_hws_actions_pool { 11 struct mlx5hws_action *tag_action; 12 struct mlx5hws_action *pop_vlan_action; 13 struct mlx5hws_action *push_vlan_action; 14 struct mlx5hws_action *drop_action; 15 struct mlx5hws_action *decapl2_action; 16 struct mlx5hws_action *remove_hdr_vlan_action; 17 struct mlx5_fs_pool insert_hdr_pool; 18 struct mlx5_fs_pool dl3tnltol2_pool; 19 struct xarray el2tol3tnl_pools; 20 struct xarray el2tol2tnl_pools; 21 struct xarray mh_pools; 22 struct xarray table_dests; 23 struct xarray vport_vhca_dests; 24 struct xarray vport_dests; 25 struct xarray aso_meters; 26 struct xarray sample_dests; 27}; 28 29struct mlx5_fs_hws_context { 30 struct mlx5hws_context *hws_ctx; 31 struct mlx5_fs_hws_actions_pool hws_pool; 32}; 33 34struct mlx5_fs_hws_table { 35 struct mlx5hws_table *hws_table; 36 bool miss_ft_set; 37}; 38 39struct mlx5_fs_hws_action { 40 struct mlx5hws_action *hws_action; 41 struct mlx5_fs_pool *fs_pool; 42 struct mlx5_fs_hws_pr *pr_data; 43 struct mlx5_fs_hws_mh *mh_data; 44 u32 fw_reformat_id; 45 /* Protect `fw_reformat_id` against being initialized from multiple 46 * threads. 47 */ 48 struct mutex lock; 49}; 50 51struct mlx5_fs_hws_matcher { 52 struct mlx5hws_bwc_matcher *matcher; 53}; 54 55struct mlx5_fs_hws_rule_action { 56 struct mlx5hws_action *action; 57 union { 58 struct mlx5_fc *counter; 59 struct mlx5_exe_aso *exe_aso; 60 u32 sampler_id; 61 }; 62}; 63 64struct mlx5_fs_hws_rule { 65 struct mlx5hws_bwc_rule *bwc_rule; 66 struct mlx5_fs_hws_rule_action *hws_fs_actions; 67 int num_fs_actions; 68}; 69 70struct mlx5_fs_hws_data { 71 struct mlx5hws_action *hws_action; 72 struct mutex lock; /* protects hws_action */ 73 refcount_t hws_action_refcount; 74}; 75 76struct mlx5_fs_hws_create_action_ctx { 77 enum mlx5hws_action_type actions_type; 78 struct mlx5hws_context *hws_ctx; 79 u32 id; 80 union { 81 u8 return_reg_id; 82 }; 83}; 84 85struct mlx5hws_action * 86mlx5_fs_get_hws_action(struct mlx5_fs_hws_data *fs_hws_data, 87 struct mlx5_fs_hws_create_action_ctx *create_ctx); 88void mlx5_fs_put_hws_action(struct mlx5_fs_hws_data *fs_hws_data); 89 90#ifdef CONFIG_MLX5_HW_STEERING 91 92int 93mlx5_fs_hws_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 94 u32 *reformat_id); 95 96bool mlx5_fs_hws_is_supported(struct mlx5_core_dev *dev); 97 98const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds(void); 99 100#else 101 102static inline int 103mlx5_fs_hws_action_get_pkt_reformat_id(struct mlx5_pkt_reformat *pkt_reformat, 104 u32 *reformat_id) 105{ 106 return -EOPNOTSUPP; 107} 108 109static inline bool mlx5_fs_hws_is_supported(struct mlx5_core_dev *dev) 110{ 111 return false; 112} 113 114static inline const struct mlx5_flow_cmds *mlx5_fs_cmd_get_hws_cmds(void) 115{ 116 return NULL; 117} 118 119#endif /* CONFIG_MLX5_HWS_STEERING */ 120#endif
~/
Read-only file preview.