.. | .. |
---|
42 | 42 | MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_PRIO = 1 << 16, |
---|
43 | 43 | MLX5_FLOW_CONTEXT_ACTION_ENCRYPT = 1 << 17, |
---|
44 | 44 | MLX5_FLOW_CONTEXT_ACTION_DECRYPT = 1 << 18, |
---|
| 45 | + MLX5_FLOW_CONTEXT_ACTION_FWD_NEXT_NS = 1 << 19, |
---|
45 | 46 | }; |
---|
46 | 47 | |
---|
47 | 48 | enum { |
---|
48 | | - MLX5_FLOW_TABLE_TUNNEL_EN = BIT(0), |
---|
| 49 | + MLX5_FLOW_TABLE_TUNNEL_EN_REFORMAT = BIT(0), |
---|
| 50 | + MLX5_FLOW_TABLE_TUNNEL_EN_DECAP = BIT(1), |
---|
| 51 | + MLX5_FLOW_TABLE_TERMINATION = BIT(2), |
---|
| 52 | + MLX5_FLOW_TABLE_UNMANAGED = BIT(3), |
---|
49 | 53 | }; |
---|
50 | 54 | |
---|
51 | 55 | #define LEFTOVERS_RULE_NUM 2 |
---|
.. | .. |
---|
72 | 76 | MLX5_FLOW_NAMESPACE_SNIFFER_RX, |
---|
73 | 77 | MLX5_FLOW_NAMESPACE_SNIFFER_TX, |
---|
74 | 78 | MLX5_FLOW_NAMESPACE_EGRESS, |
---|
| 79 | + MLX5_FLOW_NAMESPACE_EGRESS_KERNEL, |
---|
| 80 | + MLX5_FLOW_NAMESPACE_RDMA_RX, |
---|
| 81 | + MLX5_FLOW_NAMESPACE_RDMA_RX_KERNEL, |
---|
| 82 | + MLX5_FLOW_NAMESPACE_RDMA_TX, |
---|
75 | 83 | }; |
---|
76 | 84 | |
---|
| 85 | +enum { |
---|
| 86 | + FDB_BYPASS_PATH, |
---|
| 87 | + FDB_TC_OFFLOAD, |
---|
| 88 | + FDB_FT_OFFLOAD, |
---|
| 89 | + FDB_SLOW_PATH, |
---|
| 90 | + FDB_PER_VPORT, |
---|
| 91 | +}; |
---|
| 92 | + |
---|
| 93 | +struct mlx5_pkt_reformat; |
---|
| 94 | +struct mlx5_modify_hdr; |
---|
77 | 95 | struct mlx5_flow_table; |
---|
78 | 96 | struct mlx5_flow_group; |
---|
79 | 97 | struct mlx5_flow_namespace; |
---|
80 | 98 | struct mlx5_flow_handle; |
---|
81 | 99 | |
---|
| 100 | +enum { |
---|
| 101 | + FLOW_CONTEXT_HAS_TAG = BIT(0), |
---|
| 102 | +}; |
---|
| 103 | + |
---|
| 104 | +struct mlx5_flow_context { |
---|
| 105 | + u32 flags; |
---|
| 106 | + u32 flow_tag; |
---|
| 107 | + u32 flow_source; |
---|
| 108 | +}; |
---|
| 109 | + |
---|
82 | 110 | struct mlx5_flow_spec { |
---|
83 | 111 | u8 match_criteria_enable; |
---|
84 | 112 | u32 match_criteria[MLX5_ST_SZ_DW(fte_match_param)]; |
---|
85 | 113 | u32 match_value[MLX5_ST_SZ_DW(fte_match_param)]; |
---|
| 114 | + struct mlx5_flow_context flow_context; |
---|
| 115 | +}; |
---|
| 116 | + |
---|
| 117 | +enum { |
---|
| 118 | + MLX5_FLOW_DEST_VPORT_VHCA_ID = BIT(0), |
---|
| 119 | + MLX5_FLOW_DEST_VPORT_REFORMAT_ID = BIT(1), |
---|
86 | 120 | }; |
---|
87 | 121 | |
---|
88 | 122 | struct mlx5_flow_destination { |
---|
.. | .. |
---|
91 | 125 | u32 tir_num; |
---|
92 | 126 | u32 ft_num; |
---|
93 | 127 | struct mlx5_flow_table *ft; |
---|
94 | | - struct mlx5_fc *counter; |
---|
| 128 | + u32 counter_id; |
---|
95 | 129 | struct { |
---|
96 | 130 | u16 num; |
---|
97 | 131 | u16 vhca_id; |
---|
98 | | - bool vhca_id_valid; |
---|
| 132 | + struct mlx5_pkt_reformat *pkt_reformat; |
---|
| 133 | + u8 flags; |
---|
99 | 134 | } vport; |
---|
100 | 135 | }; |
---|
101 | 136 | }; |
---|
102 | 137 | |
---|
| 138 | +struct mod_hdr_tbl { |
---|
| 139 | + struct mutex lock; /* protects hlist */ |
---|
| 140 | + DECLARE_HASHTABLE(hlist, 8); |
---|
| 141 | +}; |
---|
| 142 | + |
---|
| 143 | +struct mlx5_flow_namespace * |
---|
| 144 | +mlx5_get_fdb_sub_ns(struct mlx5_core_dev *dev, int n); |
---|
103 | 145 | struct mlx5_flow_namespace * |
---|
104 | 146 | mlx5_get_flow_namespace(struct mlx5_core_dev *dev, |
---|
105 | 147 | enum mlx5_flow_namespace_type type); |
---|
.. | .. |
---|
108 | 150 | enum mlx5_flow_namespace_type type, |
---|
109 | 151 | int vport); |
---|
110 | 152 | |
---|
111 | | -struct mlx5_flow_table * |
---|
112 | | -mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, |
---|
113 | | - int prio, |
---|
114 | | - int num_flow_table_entries, |
---|
115 | | - int max_num_groups, |
---|
116 | | - u32 level, |
---|
117 | | - u32 flags); |
---|
118 | | - |
---|
119 | 153 | struct mlx5_flow_table_attr { |
---|
120 | 154 | int prio; |
---|
121 | 155 | int max_fte; |
---|
122 | 156 | u32 level; |
---|
123 | 157 | u32 flags; |
---|
| 158 | + struct mlx5_flow_table *next_ft; |
---|
| 159 | + |
---|
| 160 | + struct { |
---|
| 161 | + int max_num_groups; |
---|
| 162 | + int num_reserved_entries; |
---|
| 163 | + } autogroup; |
---|
124 | 164 | }; |
---|
125 | 165 | |
---|
126 | 166 | struct mlx5_flow_table * |
---|
127 | 167 | mlx5_create_flow_table(struct mlx5_flow_namespace *ns, |
---|
128 | 168 | struct mlx5_flow_table_attr *ft_attr); |
---|
| 169 | + |
---|
| 170 | +struct mlx5_flow_table * |
---|
| 171 | +mlx5_create_auto_grouped_flow_table(struct mlx5_flow_namespace *ns, |
---|
| 172 | + struct mlx5_flow_table_attr *ft_attr); |
---|
129 | 173 | |
---|
130 | 174 | struct mlx5_flow_table * |
---|
131 | 175 | mlx5_create_vport_flow_table(struct mlx5_flow_namespace *ns, |
---|
.. | .. |
---|
155 | 199 | |
---|
156 | 200 | #define MLX5_FS_VLAN_DEPTH 2 |
---|
157 | 201 | |
---|
| 202 | +enum { |
---|
| 203 | + FLOW_ACT_NO_APPEND = BIT(0), |
---|
| 204 | + FLOW_ACT_IGNORE_FLOW_LEVEL = BIT(1), |
---|
| 205 | +}; |
---|
| 206 | + |
---|
158 | 207 | struct mlx5_flow_act { |
---|
159 | 208 | u32 action; |
---|
160 | | - bool has_flow_tag; |
---|
161 | | - u32 flow_tag; |
---|
162 | | - u32 encap_id; |
---|
163 | | - u32 modify_id; |
---|
164 | | - uintptr_t esp_id; |
---|
| 209 | + struct mlx5_modify_hdr *modify_hdr; |
---|
| 210 | + struct mlx5_pkt_reformat *pkt_reformat; |
---|
| 211 | + union { |
---|
| 212 | + u32 ipsec_obj_id; |
---|
| 213 | + uintptr_t esp_id; |
---|
| 214 | + }; |
---|
| 215 | + u32 flags; |
---|
165 | 216 | struct mlx5_fs_vlan vlan[MLX5_FS_VLAN_DEPTH]; |
---|
166 | 217 | struct ib_counters *counters; |
---|
167 | 218 | }; |
---|
168 | 219 | |
---|
169 | 220 | #define MLX5_DECLARE_FLOW_ACT(name) \ |
---|
170 | | - struct mlx5_flow_act name = {MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\ |
---|
171 | | - MLX5_FS_DEFAULT_FLOW_TAG, 0, 0} |
---|
| 221 | + struct mlx5_flow_act name = { .action = MLX5_FLOW_CONTEXT_ACTION_FWD_DEST,\ |
---|
| 222 | + .flags = 0, } |
---|
172 | 223 | |
---|
173 | 224 | /* Single destination per rule. |
---|
174 | 225 | * Group ID is implied by the match criteria. |
---|
175 | 226 | */ |
---|
176 | 227 | struct mlx5_flow_handle * |
---|
177 | 228 | mlx5_add_flow_rules(struct mlx5_flow_table *ft, |
---|
178 | | - struct mlx5_flow_spec *spec, |
---|
| 229 | + const struct mlx5_flow_spec *spec, |
---|
179 | 230 | struct mlx5_flow_act *flow_act, |
---|
180 | 231 | struct mlx5_flow_destination *dest, |
---|
181 | 232 | int num_dest); |
---|
.. | .. |
---|
185 | 236 | struct mlx5_flow_destination *new_dest, |
---|
186 | 237 | struct mlx5_flow_destination *old_dest); |
---|
187 | 238 | |
---|
188 | | -struct mlx5_fc *mlx5_flow_rule_counter(struct mlx5_flow_handle *handler); |
---|
189 | 239 | struct mlx5_fc *mlx5_fc_create(struct mlx5_core_dev *dev, bool aging); |
---|
190 | 240 | void mlx5_fc_destroy(struct mlx5_core_dev *dev, struct mlx5_fc *counter); |
---|
191 | 241 | u64 mlx5_fc_query_lastuse(struct mlx5_fc *counter); |
---|
.. | .. |
---|
193 | 243 | u64 *bytes, u64 *packets, u64 *lastuse); |
---|
194 | 244 | int mlx5_fc_query(struct mlx5_core_dev *dev, struct mlx5_fc *counter, |
---|
195 | 245 | u64 *packets, u64 *bytes); |
---|
| 246 | +u32 mlx5_fc_id(struct mlx5_fc *counter); |
---|
196 | 247 | |
---|
197 | 248 | int mlx5_fs_add_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn); |
---|
198 | 249 | int mlx5_fs_remove_rx_underlay_qpn(struct mlx5_core_dev *dev, u32 underlay_qpn); |
---|
199 | 250 | |
---|
| 251 | +struct mlx5_modify_hdr *mlx5_modify_header_alloc(struct mlx5_core_dev *dev, |
---|
| 252 | + u8 ns_type, u8 num_actions, |
---|
| 253 | + void *modify_actions); |
---|
| 254 | +void mlx5_modify_header_dealloc(struct mlx5_core_dev *dev, |
---|
| 255 | + struct mlx5_modify_hdr *modify_hdr); |
---|
| 256 | + |
---|
| 257 | +struct mlx5_pkt_reformat *mlx5_packet_reformat_alloc(struct mlx5_core_dev *dev, |
---|
| 258 | + int reformat_type, |
---|
| 259 | + size_t size, |
---|
| 260 | + void *reformat_data, |
---|
| 261 | + enum mlx5_flow_namespace_type ns_type); |
---|
| 262 | +void mlx5_packet_reformat_dealloc(struct mlx5_core_dev *dev, |
---|
| 263 | + struct mlx5_pkt_reformat *reformat); |
---|
| 264 | + |
---|
200 | 265 | #endif |
---|