.. | .. |
---|
4 | 4 | #ifndef __MLX5E_FLOW_STEER_H__ |
---|
5 | 5 | #define __MLX5E_FLOW_STEER_H__ |
---|
6 | 6 | |
---|
| 7 | +#include "mod_hdr.h" |
---|
| 8 | + |
---|
7 | 9 | enum { |
---|
8 | 10 | MLX5E_TC_FT_LEVEL = 0, |
---|
9 | 11 | MLX5E_TC_TTC_FT_LEVEL, |
---|
10 | 12 | }; |
---|
11 | 13 | |
---|
12 | 14 | struct mlx5e_tc_table { |
---|
| 15 | + /* Protects the dynamic assignment of the t parameter |
---|
| 16 | + * which is the nic tc root table. |
---|
| 17 | + */ |
---|
| 18 | + struct mutex t_lock; |
---|
13 | 19 | struct mlx5_flow_table *t; |
---|
| 20 | + struct mlx5_fs_chains *chains; |
---|
14 | 21 | |
---|
15 | 22 | struct rhashtable ht; |
---|
16 | 23 | |
---|
17 | | - DECLARE_HASHTABLE(mod_hdr_tbl, 8); |
---|
| 24 | + struct mod_hdr_tbl mod_hdr; |
---|
| 25 | + struct mutex hairpin_tbl_lock; /* protects hairpin_tbl */ |
---|
18 | 26 | DECLARE_HASHTABLE(hairpin_tbl, 8); |
---|
19 | 27 | |
---|
20 | 28 | struct notifier_block netdevice_nb; |
---|
| 29 | + struct netdev_net_notifier netdevice_nn; |
---|
| 30 | + |
---|
| 31 | + struct mlx5_tc_ct_priv *ct; |
---|
21 | 32 | }; |
---|
22 | 33 | |
---|
23 | 34 | struct mlx5e_flow_table { |
---|
.. | .. |
---|
73 | 84 | MLX5E_NUM_INDIR_TIRS = MLX5E_TT_ANY, |
---|
74 | 85 | }; |
---|
75 | 86 | |
---|
| 87 | +struct mlx5e_tirc_config { |
---|
| 88 | + u8 l3_prot_type; |
---|
| 89 | + u8 l4_prot_type; |
---|
| 90 | + u32 rx_hash_fields; |
---|
| 91 | +}; |
---|
| 92 | + |
---|
| 93 | +#define MLX5_HASH_IP (MLX5_HASH_FIELD_SEL_SRC_IP |\ |
---|
| 94 | + MLX5_HASH_FIELD_SEL_DST_IP) |
---|
| 95 | +#define MLX5_HASH_IP_L4PORTS (MLX5_HASH_FIELD_SEL_SRC_IP |\ |
---|
| 96 | + MLX5_HASH_FIELD_SEL_DST_IP |\ |
---|
| 97 | + MLX5_HASH_FIELD_SEL_L4_SPORT |\ |
---|
| 98 | + MLX5_HASH_FIELD_SEL_L4_DPORT) |
---|
| 99 | +#define MLX5_HASH_IP_IPSEC_SPI (MLX5_HASH_FIELD_SEL_SRC_IP |\ |
---|
| 100 | + MLX5_HASH_FIELD_SEL_DST_IP |\ |
---|
| 101 | + MLX5_HASH_FIELD_SEL_IPSEC_SPI) |
---|
| 102 | + |
---|
76 | 103 | enum mlx5e_tunnel_types { |
---|
77 | 104 | MLX5E_TT_IPV4_GRE, |
---|
78 | 105 | MLX5E_TT_IPV6_GRE, |
---|
| 106 | + MLX5E_TT_IPV4_IPIP, |
---|
| 107 | + MLX5E_TT_IPV6_IPIP, |
---|
| 108 | + MLX5E_TT_IPV4_IPV6, |
---|
| 109 | + MLX5E_TT_IPV6_IPV6, |
---|
79 | 110 | MLX5E_NUM_TUNNEL_TT, |
---|
| 111 | +}; |
---|
| 112 | + |
---|
| 113 | +bool mlx5e_tunnel_inner_ft_supported(struct mlx5_core_dev *mdev); |
---|
| 114 | + |
---|
| 115 | +struct mlx5e_ttc_rule { |
---|
| 116 | + struct mlx5_flow_handle *rule; |
---|
| 117 | + struct mlx5_flow_destination default_dest; |
---|
80 | 118 | }; |
---|
81 | 119 | |
---|
82 | 120 | /* L3/L4 traffic type classifier */ |
---|
83 | 121 | struct mlx5e_ttc_table { |
---|
84 | | - struct mlx5e_flow_table ft; |
---|
85 | | - struct mlx5_flow_handle *rules[MLX5E_NUM_TT]; |
---|
86 | | - struct mlx5_flow_handle *tunnel_rules[MLX5E_NUM_TUNNEL_TT]; |
---|
| 122 | + struct mlx5e_flow_table ft; |
---|
| 123 | + struct mlx5e_ttc_rule rules[MLX5E_NUM_TT]; |
---|
| 124 | + struct mlx5_flow_handle *tunnel_rules[MLX5E_NUM_TUNNEL_TT]; |
---|
87 | 125 | }; |
---|
88 | 126 | |
---|
89 | 127 | /* NIC prio FTS */ |
---|
.. | .. |
---|
92 | 130 | MLX5E_L2_FT_LEVEL, |
---|
93 | 131 | MLX5E_TTC_FT_LEVEL, |
---|
94 | 132 | MLX5E_INNER_TTC_FT_LEVEL, |
---|
| 133 | +#ifdef CONFIG_MLX5_EN_TLS |
---|
| 134 | + MLX5E_ACCEL_FS_TCP_FT_LEVEL, |
---|
| 135 | +#endif |
---|
95 | 136 | #ifdef CONFIG_MLX5_EN_ARFS |
---|
96 | | - MLX5E_ARFS_FT_LEVEL |
---|
| 137 | + MLX5E_ARFS_FT_LEVEL, |
---|
| 138 | +#endif |
---|
| 139 | +#ifdef CONFIG_MLX5_EN_IPSEC |
---|
| 140 | + MLX5E_ACCEL_FS_ESP_FT_LEVEL = MLX5E_INNER_TTC_FT_LEVEL + 1, |
---|
| 141 | + MLX5E_ACCEL_FS_ESP_FT_ERR_LEVEL, |
---|
97 | 142 | #endif |
---|
98 | 143 | }; |
---|
| 144 | + |
---|
| 145 | +#define MLX5E_TTC_NUM_GROUPS 3 |
---|
| 146 | +#define MLX5E_TTC_GROUP1_SIZE (BIT(3) + MLX5E_NUM_TUNNEL_TT) |
---|
| 147 | +#define MLX5E_TTC_GROUP2_SIZE BIT(1) |
---|
| 148 | +#define MLX5E_TTC_GROUP3_SIZE BIT(0) |
---|
| 149 | +#define MLX5E_TTC_TABLE_SIZE (MLX5E_TTC_GROUP1_SIZE +\ |
---|
| 150 | + MLX5E_TTC_GROUP2_SIZE +\ |
---|
| 151 | + MLX5E_TTC_GROUP3_SIZE) |
---|
| 152 | + |
---|
| 153 | +#define MLX5E_INNER_TTC_NUM_GROUPS 3 |
---|
| 154 | +#define MLX5E_INNER_TTC_GROUP1_SIZE BIT(3) |
---|
| 155 | +#define MLX5E_INNER_TTC_GROUP2_SIZE BIT(1) |
---|
| 156 | +#define MLX5E_INNER_TTC_GROUP3_SIZE BIT(0) |
---|
| 157 | +#define MLX5E_INNER_TTC_TABLE_SIZE (MLX5E_INNER_TTC_GROUP1_SIZE +\ |
---|
| 158 | + MLX5E_INNER_TTC_GROUP2_SIZE +\ |
---|
| 159 | + MLX5E_INNER_TTC_GROUP3_SIZE) |
---|
99 | 160 | |
---|
100 | 161 | #ifdef CONFIG_MLX5_EN_RXNFC |
---|
101 | 162 | |
---|
.. | .. |
---|
116 | 177 | |
---|
117 | 178 | void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv); |
---|
118 | 179 | void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv); |
---|
119 | | -int mlx5e_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd); |
---|
120 | | -int mlx5e_get_rxnfc(struct net_device *dev, |
---|
121 | | - struct ethtool_rxnfc *info, u32 *rule_locs); |
---|
| 180 | +int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd); |
---|
| 181 | +int mlx5e_ethtool_get_rxnfc(struct net_device *dev, |
---|
| 182 | + struct ethtool_rxnfc *info, u32 *rule_locs); |
---|
122 | 183 | #else |
---|
123 | 184 | static inline void mlx5e_ethtool_init_steering(struct mlx5e_priv *priv) { } |
---|
124 | 185 | static inline void mlx5e_ethtool_cleanup_steering(struct mlx5e_priv *priv) { } |
---|
| 186 | +static inline int mlx5e_ethtool_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) |
---|
| 187 | +{ return -EOPNOTSUPP; } |
---|
| 188 | +static inline int mlx5e_ethtool_get_rxnfc(struct net_device *dev, |
---|
| 189 | + struct ethtool_rxnfc *info, u32 *rule_locs) |
---|
| 190 | +{ return -EOPNOTSUPP; } |
---|
125 | 191 | #endif /* CONFIG_MLX5_EN_RXNFC */ |
---|
126 | 192 | |
---|
127 | 193 | #ifdef CONFIG_MLX5_EN_ARFS |
---|
.. | .. |
---|
164 | 230 | static inline int mlx5e_arfs_disable(struct mlx5e_priv *priv) { return -EOPNOTSUPP; } |
---|
165 | 231 | #endif |
---|
166 | 232 | |
---|
| 233 | +#ifdef CONFIG_MLX5_EN_TLS |
---|
| 234 | +struct mlx5e_accel_fs_tcp; |
---|
| 235 | +#endif |
---|
| 236 | + |
---|
167 | 237 | struct mlx5e_flow_steering { |
---|
168 | 238 | struct mlx5_flow_namespace *ns; |
---|
| 239 | + struct mlx5_flow_namespace *egress_ns; |
---|
169 | 240 | #ifdef CONFIG_MLX5_EN_RXNFC |
---|
170 | 241 | struct mlx5e_ethtool_steering ethtool; |
---|
171 | 242 | #endif |
---|
.. | .. |
---|
176 | 247 | struct mlx5e_ttc_table inner_ttc; |
---|
177 | 248 | #ifdef CONFIG_MLX5_EN_ARFS |
---|
178 | 249 | struct mlx5e_arfs_tables arfs; |
---|
| 250 | +#endif |
---|
| 251 | +#ifdef CONFIG_MLX5_EN_TLS |
---|
| 252 | + struct mlx5e_accel_fs_tcp *accel_tcp; |
---|
179 | 253 | #endif |
---|
180 | 254 | }; |
---|
181 | 255 | |
---|
.. | .. |
---|
188 | 262 | |
---|
189 | 263 | void mlx5e_set_ttc_basic_params(struct mlx5e_priv *priv, struct ttc_params *ttc_params); |
---|
190 | 264 | void mlx5e_set_ttc_ft_params(struct ttc_params *ttc_params); |
---|
191 | | -void mlx5e_set_inner_ttc_ft_params(struct ttc_params *ttc_params); |
---|
192 | 265 | |
---|
193 | 266 | int mlx5e_create_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params, |
---|
194 | 267 | struct mlx5e_ttc_table *ttc); |
---|
195 | 268 | void mlx5e_destroy_ttc_table(struct mlx5e_priv *priv, |
---|
196 | 269 | struct mlx5e_ttc_table *ttc); |
---|
197 | 270 | |
---|
198 | | -int mlx5e_create_inner_ttc_table(struct mlx5e_priv *priv, struct ttc_params *params, |
---|
199 | | - struct mlx5e_ttc_table *ttc); |
---|
200 | | -void mlx5e_destroy_inner_ttc_table(struct mlx5e_priv *priv, |
---|
201 | | - struct mlx5e_ttc_table *ttc); |
---|
202 | | - |
---|
203 | 271 | void mlx5e_destroy_flow_table(struct mlx5e_flow_table *ft); |
---|
| 272 | +int mlx5e_ttc_fwd_dest(struct mlx5e_priv *priv, enum mlx5e_traffic_types type, |
---|
| 273 | + struct mlx5_flow_destination *new_dest); |
---|
| 274 | +struct mlx5_flow_destination |
---|
| 275 | +mlx5e_ttc_get_default_dest(struct mlx5e_priv *priv, enum mlx5e_traffic_types type); |
---|
| 276 | +int mlx5e_ttc_fwd_default_dest(struct mlx5e_priv *priv, enum mlx5e_traffic_types type); |
---|
204 | 277 | |
---|
205 | 278 | void mlx5e_enable_cvlan_filter(struct mlx5e_priv *priv); |
---|
206 | 279 | void mlx5e_disable_cvlan_filter(struct mlx5e_priv *priv); |
---|
.. | .. |
---|
208 | 281 | int mlx5e_create_flow_steering(struct mlx5e_priv *priv); |
---|
209 | 282 | void mlx5e_destroy_flow_steering(struct mlx5e_priv *priv); |
---|
210 | 283 | |
---|
| 284 | +bool mlx5e_tunnel_proto_supported(struct mlx5_core_dev *mdev, u8 proto_type); |
---|
| 285 | +bool mlx5e_any_tunnel_proto_supported(struct mlx5_core_dev *mdev); |
---|
| 286 | + |
---|
211 | 287 | #endif /* __MLX5E_FLOW_STEER_H__ */ |
---|
212 | 288 | |
---|