Lines Matching full:act

175 				   struct efx_tc_action_set *act, bool in_hw)  in efx_tc_free_action_set()  argument
179 * not still have it in act. in efx_tc_free_action_set()
182 efx_mae_free_action_set(efx, act->fw_id); in efx_tc_free_action_set()
186 list_del(&act->list); in efx_tc_free_action_set()
188 if (act->count) { in efx_tc_free_action_set()
189 spin_lock_bh(&act->count->cnt->lock); in efx_tc_free_action_set()
190 if (!list_empty(&act->count_user)) in efx_tc_free_action_set()
191 list_del(&act->count_user); in efx_tc_free_action_set()
192 spin_unlock_bh(&act->count->cnt->lock); in efx_tc_free_action_set()
193 efx_tc_flower_put_counter_index(efx, act->count); in efx_tc_free_action_set()
195 if (act->encap_md) { in efx_tc_free_action_set()
196 list_del(&act->encap_user); in efx_tc_free_action_set()
197 efx_tc_flower_release_encap_md(efx, act->encap_md); in efx_tc_free_action_set()
199 if (act->src_mac) in efx_tc_free_action_set()
200 efx_tc_flower_put_mac(efx, act->src_mac); in efx_tc_free_action_set()
201 if (act->dst_mac) in efx_tc_free_action_set()
202 efx_tc_flower_put_mac(efx, act->dst_mac); in efx_tc_free_action_set()
203 kfree(act); in efx_tc_free_action_set()
210 struct efx_tc_action_set *act, *next; in efx_tc_free_action_set_list() local
218 /* Any act that's on the list will be in_hw even if the list isn't */ in efx_tc_free_action_set_list()
219 list_for_each_entry_safe(act, next, &acts->list, list) in efx_tc_free_action_set_list()
220 efx_tc_free_action_set(efx, act, true); in efx_tc_free_action_set_list()
787 static bool efx_tc_flower_action_order_ok(const struct efx_tc_action_set *act, in efx_tc_flower_action_order_ok() argument
792 if (act->decap) in efx_tc_flower_action_order_ok()
797 if (act->dst_mac || act->src_mac) in efx_tc_flower_action_order_ok()
801 if (act->do_ttl_dec) in efx_tc_flower_action_order_ok()
805 if (act->vlan_pop >= 2) in efx_tc_flower_action_order_ok()
811 if (act->vlan_push) in efx_tc_flower_action_order_ok()
815 if (act->vlan_push >= 2) in efx_tc_flower_action_order_ok()
819 if (act->count) in efx_tc_flower_action_order_ok()
824 if (act->encap_md) in efx_tc_flower_action_order_ok()
828 return !act->deliver; in efx_tc_flower_action_order_ok()
830 if (act->encap_md) in efx_tc_flower_action_order_ok()
832 return !act->do_ttl_dec; in efx_tc_flower_action_order_ok()
979 struct efx_tc_lhs_action *act = &rule->lhs_act; in efx_tc_flower_handle_lhs_actions() local
1008 act->rid = rid; in efx_tc_flower_handle_lhs_actions()
1024 WARN_ON(act->count); /* can't happen */ in efx_tc_flower_handle_lhs_actions()
1025 act->count = cnt; in efx_tc_flower_handle_lhs_actions()
1030 if (act->zone) { in efx_tc_flower_handle_lhs_actions()
1060 act->zone = ct_zone; in efx_tc_flower_handle_lhs_actions()
1077 struct efx_tc_lhs_action *act) in efx_tc_flower_release_lhs_actions() argument
1079 if (act->rid) in efx_tc_flower_release_lhs_actions()
1080 efx_tc_put_recirc_id(efx, act->rid); in efx_tc_flower_release_lhs_actions()
1081 if (act->zone) in efx_tc_flower_release_lhs_actions()
1082 efx_tc_ct_unregister_zone(efx, act->zone); in efx_tc_flower_release_lhs_actions()
1083 if (act->count) in efx_tc_flower_release_lhs_actions()
1084 efx_tc_flower_put_counter_index(efx, act->count); in efx_tc_flower_release_lhs_actions()
1113 * @act: action set (cursor) to update
1118 * combined into a complete packet field edit, add that edit to @act,
1123 struct efx_tc_action_set *act, in efx_tc_complete_mac_mangle() argument
1135 if (act->dst_mac) in efx_tc_complete_mac_mangle()
1136 efx_tc_flower_put_mac(efx, act->dst_mac); in efx_tc_complete_mac_mangle()
1138 act->dst_mac = ped; in efx_tc_complete_mac_mangle()
1150 if (act->src_mac) in efx_tc_complete_mac_mangle()
1151 efx_tc_flower_put_mac(efx, act->src_mac); in efx_tc_complete_mac_mangle()
1153 act->src_mac = ped; in efx_tc_complete_mac_mangle()
1162 static int efx_tc_pedit_add(struct efx_nic *efx, struct efx_tc_action_set *act, in efx_tc_pedit_add() argument
1181 if (!efx_tc_flower_action_order_ok(act, in efx_tc_pedit_add()
1186 act->do_ttl_dec = 1; in efx_tc_pedit_add()
1206 if (!efx_tc_flower_action_order_ok(act, in efx_tc_pedit_add()
1211 act->do_ttl_dec = 1; in efx_tc_pedit_add()
1231 * @act: action set (cursor) to update
1239 * earlier partial mangle, consume and apply to @act by calling
1243 static int efx_tc_mangle(struct efx_nic *efx, struct efx_tc_action_set *act, in efx_tc_mangle() argument
1257 if (!efx_tc_flower_action_order_ok(act, EFX_TC_AO_PEDIT_MAC_ADDRS)) { in efx_tc_mangle()
1274 return efx_tc_complete_mac_mangle(efx, act, mung, extack); in efx_tc_mangle()
1290 return efx_tc_complete_mac_mangle(efx, act, mung, extack); in efx_tc_mangle()
1301 return efx_tc_complete_mac_mangle(efx, act, mung, extack); in efx_tc_mangle()
1344 if (!efx_tc_flower_action_order_ok(act, in efx_tc_mangle()
1354 act->do_ttl_dec = 1; in efx_tc_mangle()
1403 if (!efx_tc_flower_action_order_ok(act, in efx_tc_mangle()
1413 act->do_ttl_dec = 1; in efx_tc_mangle()
1679 struct efx_tc_action_set *act = NULL; in efx_tc_flower_replace_foreign() local
1822 act = kzalloc(sizeof(*act), GFP_USER); in efx_tc_flower_replace_foreign()
1823 if (!act) { in efx_tc_flower_replace_foreign()
1830 * operation & how 'act' cursor is used. in efx_tc_flower_replace_foreign()
1841 save = *act; in efx_tc_flower_replace_foreign()
1852 if (!efx_tc_flower_action_order_ok(act, EFX_TC_AO_COUNT)) { in efx_tc_flower_replace_foreign()
1866 act->count = ctr; in efx_tc_flower_replace_foreign()
1867 INIT_LIST_HEAD(&act->count_user); in efx_tc_flower_replace_foreign()
1870 if (!efx_tc_flower_action_order_ok(act, EFX_TC_AO_DELIVER)) { in efx_tc_flower_replace_foreign()
1895 act->dest_mport = rc; in efx_tc_flower_replace_foreign()
1896 act->deliver = 1; in efx_tc_flower_replace_foreign()
1897 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_flower_replace_foreign()
1903 list_add_tail(&act->list, &rule->acts.list); in efx_tc_flower_replace_foreign()
1904 act = NULL; in efx_tc_flower_replace_foreign()
1907 /* Mirror, so continue on with saved act */ in efx_tc_flower_replace_foreign()
1908 act = kzalloc(sizeof(*act), GFP_USER); in efx_tc_flower_replace_foreign()
1909 if (!act) { in efx_tc_flower_replace_foreign()
1913 *act = save; in efx_tc_flower_replace_foreign()
1916 if (!efx_tc_flower_action_order_ok(act, EFX_TC_AO_DECAP)) { in efx_tc_flower_replace_foreign()
1921 act->decap = 1; in efx_tc_flower_replace_foreign()
1936 if (act) { in efx_tc_flower_replace_foreign()
1941 efx_mae_mport_uplink(efx, &act->dest_mport); in efx_tc_flower_replace_foreign()
1942 act->deliver = 1; in efx_tc_flower_replace_foreign()
1944 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_flower_replace_foreign()
1949 list_add_tail(&act->list, &rule->acts.list); in efx_tc_flower_replace_foreign()
1950 act = NULL; /* Prevent double-free in error path */ in efx_tc_flower_replace_foreign()
1980 if (act) in efx_tc_flower_replace_foreign()
1981 efx_tc_free_action_set(efx, act, false); in efx_tc_flower_replace_foreign()
2080 struct efx_tc_action_set *act = NULL; in efx_tc_flower_replace() local
2206 act = kzalloc(sizeof(*act), GFP_USER); in efx_tc_flower_replace()
2207 if (!act) { in efx_tc_flower_replace()
2220 * To translate between these two models, we maintain a 'cursor', @act, in efx_tc_flower_replace()
2224 * append @act to the action-set list (@rule->acts); if this is a pipe in efx_tc_flower_replace()
2225 * action (mirred mirror) we then allocate a new @act with a copy of in efx_tc_flower_replace()
2226 * the cursor state _before_ the delivery action, otherwise we set @act in efx_tc_flower_replace()
2229 * @rule->acts or pointed to by @act (and never both), and that only in efx_tc_flower_replace()
2231 * in the failure path, @act only needs to be freed in memory, whereas in efx_tc_flower_replace()
2240 if (!act) { in efx_tc_flower_replace()
2260 if (!efx_tc_flower_action_order_ok(act, EFX_TC_AO_COUNT)) { in efx_tc_flower_replace()
2262 * (gact shot, mirred redirect) or clone act in efx_tc_flower_replace()
2285 act->count = ctr; in efx_tc_flower_replace()
2286 INIT_LIST_HEAD(&act->count_user); in efx_tc_flower_replace()
2291 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_flower_replace()
2296 list_add_tail(&act->list, &rule->acts.list); in efx_tc_flower_replace()
2297 act = NULL; /* end of the line */ in efx_tc_flower_replace()
2301 save = *act; in efx_tc_flower_replace()
2306 if (!efx_tc_flower_action_order_ok(act, in efx_tc_flower_replace()
2320 act->encap_md = encap; in efx_tc_flower_replace()
2321 list_add_tail(&act->encap_user, &encap->users); in efx_tc_flower_replace()
2322 act->dest_mport = encap->dest_mport; in efx_tc_flower_replace()
2323 act->deliver = 1; in efx_tc_flower_replace()
2324 if (act->count && !WARN_ON(!act->count->cnt)) { in efx_tc_flower_replace()
2330 spin_lock_bh(&act->count->cnt->lock); in efx_tc_flower_replace()
2331 list_add_tail(&act->count_user, in efx_tc_flower_replace()
2332 &act->count->cnt->users); in efx_tc_flower_replace()
2333 spin_unlock_bh(&act->count->cnt->lock); in efx_tc_flower_replace()
2335 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_flower_replace()
2340 list_add_tail(&act->list, &rule->acts.list); in efx_tc_flower_replace()
2341 act->user = &rule->acts; in efx_tc_flower_replace()
2342 act = NULL; in efx_tc_flower_replace()
2345 /* Mirror, so continue on with saved act */ in efx_tc_flower_replace()
2347 act = kzalloc(sizeof(*act), GFP_USER); in efx_tc_flower_replace()
2348 if (!act) { in efx_tc_flower_replace()
2352 *act = save; in efx_tc_flower_replace()
2356 if (!efx_tc_flower_action_order_ok(act, EFX_TC_AO_DELIVER)) { in efx_tc_flower_replace()
2374 act->dest_mport = rc; in efx_tc_flower_replace()
2375 act->deliver = 1; in efx_tc_flower_replace()
2376 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_flower_replace()
2381 list_add_tail(&act->list, &rule->acts.list); in efx_tc_flower_replace()
2382 act = NULL; in efx_tc_flower_replace()
2385 /* Mirror, so continue on with saved act */ in efx_tc_flower_replace()
2387 act = kzalloc(sizeof(*act), GFP_USER); in efx_tc_flower_replace()
2388 if (!act) { in efx_tc_flower_replace()
2392 *act = save; in efx_tc_flower_replace()
2395 if (act->vlan_push) { in efx_tc_flower_replace()
2396 act->vlan_push--; in efx_tc_flower_replace()
2397 } else if (efx_tc_flower_action_order_ok(act, EFX_TC_AO_VLAN_POP)) { in efx_tc_flower_replace()
2398 act->vlan_pop++; in efx_tc_flower_replace()
2407 if (!efx_tc_flower_action_order_ok(act, EFX_TC_AO_VLAN_PUSH)) { in efx_tc_flower_replace()
2415 act->vlan_tci[act->vlan_push] = cpu_to_be16(tci); in efx_tc_flower_replace()
2416 act->vlan_proto[act->vlan_push] = fa->vlan.proto; in efx_tc_flower_replace()
2417 act->vlan_push++; in efx_tc_flower_replace()
2420 rc = efx_tc_pedit_add(efx, act, fa, extack); in efx_tc_flower_replace()
2425 rc = efx_tc_mangle(efx, act, fa, &mung, extack, &match); in efx_tc_flower_replace()
2466 act->do_nat = 1; in efx_tc_flower_replace()
2479 if (act) { in efx_tc_flower_replace()
2485 efx_mae_mport_uplink(efx, &act->dest_mport); in efx_tc_flower_replace()
2492 &act->dest_mport); in efx_tc_flower_replace()
2493 act->deliver = 1; in efx_tc_flower_replace()
2494 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_flower_replace()
2499 list_add_tail(&act->list, &rule->acts.list); in efx_tc_flower_replace()
2500 act = NULL; /* Prevent double-free in error path */ in efx_tc_flower_replace()
2543 if (act) in efx_tc_flower_replace()
2544 efx_tc_free_action_set(efx, act, false); in efx_tc_flower_replace()
2674 struct efx_tc_action_set *act; in efx_tc_configure_default_rule() local
2679 act = kzalloc(sizeof(*act), GFP_KERNEL); in efx_tc_configure_default_rule()
2680 if (!act) in efx_tc_configure_default_rule()
2682 act->deliver = 1; in efx_tc_configure_default_rule()
2683 act->dest_mport = eg_port; in efx_tc_configure_default_rule()
2684 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_configure_default_rule()
2688 list_add_tail(&act->list, &acts->list); in efx_tc_configure_default_rule()
2700 list_del(&act->list); in efx_tc_configure_default_rule()
2701 efx_mae_free_action_set(efx, act->fw_id); in efx_tc_configure_default_rule()
2703 kfree(act); in efx_tc_configure_default_rule()
2749 struct efx_tc_action_set *act; in efx_tc_configure_fallback_acts() local
2752 act = kzalloc(sizeof(*act), GFP_KERNEL); in efx_tc_configure_fallback_acts()
2753 if (!act) in efx_tc_configure_fallback_acts()
2755 act->deliver = 1; in efx_tc_configure_fallback_acts()
2756 act->dest_mport = eg_port; in efx_tc_configure_fallback_acts()
2757 rc = efx_mae_alloc_action_set(efx, act); in efx_tc_configure_fallback_acts()
2761 list_add_tail(&act->list, &acts->list); in efx_tc_configure_fallback_acts()
2767 list_del(&act->list); in efx_tc_configure_fallback_acts()
2768 efx_mae_free_action_set(efx, act->fw_id); in efx_tc_configure_fallback_acts()
2770 kfree(act); in efx_tc_configure_fallback_acts()