Lines Matching defs:rule

226 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_##_name)) {		\
229 flow_rule_match_##_tcget(rule, &fm); \
239 struct flow_rule *rule,
243 struct flow_dissector *dissector = rule->match.dissector;
252 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CONTROL)) {
255 flow_rule_match_control(rule, &fm);
322 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) {
325 flow_rule_match_vlan(rule, &fm);
336 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CVLAN)) {
339 flow_rule_match_cvlan(rule, &fm);
350 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
353 flow_rule_match_eth_addrs(rule, &fm);
387 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
390 flow_rule_match_enc_control(rule, &fm);
439 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CT)) {
442 flow_rule_match_ct(rule, &fm);
697 * a rule on the net_dev that's been offloaded to us, then the net_dev
698 * can't go away until the rule has been deoffloaded.
738 static void efx_tc_delete_rule(struct efx_nic *efx, struct efx_tc_flow_rule *rule)
740 efx_mae_delete_rule(efx, rule->fw_id);
743 efx_tc_free_action_set_list(efx, &rule->acts, true);
744 if (rule->match.rid)
745 efx_tc_put_recirc_id(efx, rule->match.rid);
746 if (rule->match.encap)
747 efx_tc_flower_release_encap_match(efx, rule->match.encap);
748 rule->fw_id = MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL;
834 * The MAE hardware can handle at most two rounds of action rule matching,
836 * rule". This is a rule which typically contains only the actions "ct" and
859 /* If rule is -trk, or doesn't mention trk at all, then
861 * LHS rule). If rule is +trk, then a CT action could
879 struct efx_tc_lhs_rule *rule)
883 struct efx_tc_lhs_action *act = &rule->lhs_act;
941 NL_SET_ERR_MSG_MOD(extack, "Can't clear ct in LHS rule");
947 NL_SET_ERR_MSG_MOD(extack, "Can't perform NAT in LHS rule - packet isn't conntracked yet");
951 NL_SET_ERR_MSG_FMT_MOD(extack, "Unhandled ct.action %u for LHS rule\n",
964 NL_SET_ERR_MSG_FMT_MOD(extack, "Unhandled action %u for LHS rule\n",
971 NL_SET_ERR_MSG_MOD(extack, "Missing goto chain in LHS rule");
1013 * @efx: NIC we're installing a flow rule on
1131 * @efx: NIC we're installing a flow rule on
1325 NL_SET_ERR_MSG_FMT_MOD(extack, "Unhandled mangle htype %u for action rule",
1363 struct efx_tc_flow_rule *rule = NULL, *old = NULL;
1377 /* The rule as given to us doesn't specify a source netdevice.
1474 /* This is not a tunnel decap rule, ignore it */
1481 rule = kzalloc(sizeof(*rule), GFP_USER);
1482 if (!rule) {
1486 INIT_LIST_HEAD(&rule->acts.list);
1487 rule->cookie = tc->cookie;
1489 &rule->linkage,
1496 "Ignoring already-offloaded rule (cookie %lx)\n",
1582 list_add_tail(&act->list, &rule->acts.list);
1628 list_add_tail(&act->list, &rule->acts.list);
1632 rule->match = match;
1638 rc = efx_mae_alloc_action_set_list(efx, &rule->acts);
1643 rc = efx_mae_insert_rule(efx, &rule->match, EFX_TC_PRIO_TC,
1644 rule->acts.fw_id, &rule->fw_id);
1646 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
1652 efx_mae_free_action_set_list(efx, &rule->acts);
1654 /* We failed to insert the rule, so free up any entries we created in
1661 if (rule) {
1664 &rule->linkage,
1666 efx_tc_free_action_set_list(efx, &rule->acts, false);
1668 kfree(rule);
1682 struct efx_tc_lhs_rule *rule, *old;
1686 NL_SET_ERR_MSG_MOD(extack, "LHS rule only allowed in chain 0");
1691 NL_SET_ERR_MSG_MOD(extack, "LHS rule can never match +trk");
1702 rule = kzalloc(sizeof(*rule), GFP_USER);
1703 if (!rule)
1705 rule->cookie = tc->cookie;
1707 &rule->linkage,
1714 "Already offloaded rule (cookie %lx)\n", tc->cookie);
1724 rc = efx_tc_flower_handle_lhs_actions(efx, tc, fr, efx->net_dev, rule);
1728 rule->match = *match;
1730 rc = efx_mae_insert_lhs_rule(efx, rule, EFX_TC_PRIO_TC);
1732 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
1736 "Successfully parsed lhs rule (cookie %lx)\n",
1741 efx_tc_flower_release_lhs_actions(efx, &rule->lhs_act);
1743 rhashtable_remove_fast(&efx->tc->lhs_rule_ht, &rule->linkage,
1745 kfree(rule);
1757 struct efx_tc_flow_rule *rule = NULL, *old;
1863 rule = kzalloc(sizeof(*rule), GFP_USER);
1864 if (!rule) {
1868 INIT_LIST_HEAD(&rule->acts.list);
1869 rule->cookie = tc->cookie;
1871 &rule->linkage,
1878 "Already offloaded rule (cookie %lx)\n", tc->cookie);
1903 * append @act to the action-set list (@rule->acts); if this is a pipe
1908 * @rule->acts or pointed to by @act (and never both), and that only
1909 * those action-sets in @rule->acts exist in hardware. Consequently,
1911 * for @rule->acts we remove each action-set from hardware before
1975 list_add_tail(&act->list, &rule->acts.list);
2019 list_add_tail(&act->list, &rule->acts.list);
2020 act->user = &rule->acts;
2060 list_add_tail(&act->list, &rule->acts.list);
2158 /* Representor, so rule applies to traffic from
2170 list_add_tail(&act->list, &rule->acts.list);
2178 rule->match = match;
2180 rc = efx_mae_alloc_action_set_list(efx, &rule->acts);
2186 /* PF netdev, so rule applies to traffic from wire */
2187 rule->fallback = &efx->tc->facts.pf;
2189 /* repdev, so rule applies to traffic from representee */
2190 rule->fallback = &efx->tc->facts.reps;
2191 if (!efx_tc_check_ready(efx, rule)) {
2193 acts_id = rule->fallback->fw_id;
2196 acts_id = rule->acts.fw_id;
2198 rc = efx_mae_insert_rule(efx, &rule->match, EFX_TC_PRIO_TC,
2199 acts_id, &rule->fw_id);
2201 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
2207 efx_mae_free_action_set_list(efx, &rule->acts);
2209 /* We failed to insert the rule, so free up any entries we created in
2216 if (rule) {
2219 &rule->linkage,
2221 efx_tc_free_action_set_list(efx, &rule->acts, false);
2223 kfree(rule);
2233 struct efx_tc_flow_rule *rule;
2252 rule = rhashtable_lookup_fast(&efx->tc->match_action_ht, &tc->cookie,
2254 if (!rule) {
2268 efx_tc_delete_rule(efx, rule);
2270 rhashtable_remove_fast(&efx->tc->match_action_ht, &rule->linkage,
2272 netif_dbg(efx, drv, efx->net_dev, "Removed filter %lx\n", rule->cookie);
2273 kfree(rule);
2341 u32 eg_port, struct efx_tc_flow_rule *rule)
2343 struct efx_tc_action_set_list *acts = &rule->acts;
2344 struct efx_tc_match *match = &rule->match;
2364 acts->fw_id, &rule->fw_id);
2380 struct efx_tc_flow_rule *rule = &efx->tc->dflt.pf;
2385 return efx_tc_configure_default_rule(efx, ing_port, eg_port, rule);
2390 struct efx_tc_flow_rule *rule = &efx->tc->dflt.wire;
2395 return efx_tc_configure_default_rule(efx, ing_port, eg_port, rule);
2400 struct efx_tc_flow_rule *rule = &efv->dflt;
2406 return efx_tc_configure_default_rule(efx, ing_port, eg_port, rule);
2410 struct efx_tc_flow_rule *rule)
2412 if (rule->fw_id != MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL)
2413 efx_tc_delete_rule(efx, rule);
2414 rule->fw_id = MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL;
2620 struct efx_tc_lhs_rule *rule = ptr;
2625 rule->cookie);
2627 if (rule->lhs_act.zone)
2628 efx_tc_ct_unregister_zone(efx, rule->lhs_act.zone);
2629 if (rule->lhs_act.count)
2630 efx_tc_flower_put_counter_index(efx, rule->lhs_act.count);
2631 efx_mae_remove_lhs_rule(efx, rule);
2633 kfree(rule);
2646 struct efx_tc_flow_rule *rule = ptr;
2650 "tc rule %lx still present at teardown, removing\n",
2651 rule->cookie);
2654 efx_tc_delete_rule(efx, rule);
2656 kfree(rule);