Lines Matching refs: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);
321 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) {
324 flow_rule_match_vlan(rule, &fm);
335 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CVLAN)) {
338 flow_rule_match_cvlan(rule, &fm);
349 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
352 flow_rule_match_eth_addrs(rule, &fm);
386 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ENC_CONTROL)) {
389 flow_rule_match_enc_control(rule, &fm);
438 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_CT)) {
441 flow_rule_match_ct(rule, &fm);
705 * a rule on the net_dev that's been offloaded to us, then the net_dev
706 * can't go away until the rule has been deoffloaded.
746 static void efx_tc_delete_rule(struct efx_nic *efx, struct efx_tc_flow_rule *rule)
748 efx_mae_delete_rule(efx, rule->fw_id);
751 efx_tc_free_action_set_list(efx, &rule->acts, true);
752 if (rule->match.rid)
753 efx_tc_put_recirc_id(efx, rule->match.rid);
754 if (rule->match.encap)
755 efx_tc_flower_release_encap_match(efx, rule->match.encap);
756 rule->fw_id = MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL;
842 * The MAE hardware can handle at most two rounds of action rule matching,
844 * rule". This is a rule which typically contains only the actions "ct" and
867 /* If rule is -trk, or doesn't mention trk at all, then
869 * LHS rule). If rule is +trk, then a CT action could
883 /* A foreign LHS rule has matches on enc_ keys at the TC layer (including an
889 * efx_tc_match_fields and (b) semantically an LHS rule doesn't have inner
892 * would imply a rule that needed a triple lookup. (Hardware can do that,
941 /* If a foreign LHS rule wants to match on keys that are only available after
974 struct efx_tc_lhs_rule *rule)
978 struct efx_tc_lhs_action *act = &rule->lhs_act;
984 ctype = rule->is_ar ? EFX_TC_COUNTER_TYPE_AR : EFX_TC_COUNTER_TYPE_OR;
1039 NL_SET_ERR_MSG_MOD(extack, "Can't clear ct in LHS rule");
1045 NL_SET_ERR_MSG_MOD(extack, "Can't perform NAT in LHS rule - packet isn't conntracked yet");
1049 NL_SET_ERR_MSG_FMT_MOD(extack, "Unhandled ct.action %u for LHS rule\n",
1062 NL_SET_ERR_MSG_FMT_MOD(extack, "Unhandled action %u for LHS rule\n",
1069 NL_SET_ERR_MSG_MOD(extack, "Missing goto chain in LHS rule");
1111 * @efx: NIC we're installing a flow rule on
1229 * @efx: NIC we're installing a flow rule on
1423 NL_SET_ERR_MSG_FMT_MOD(extack, "Unhandled mangle htype %u for action rule",
1462 struct efx_tc_lhs_rule *rule, *old;
1489 NL_SET_ERR_MSG_MOD(extack, "LHS rule can never match +trk");
1511 rule = kzalloc(sizeof(*rule), GFP_USER);
1512 if (!rule) {
1516 rule->cookie = tc->cookie;
1517 rule->is_ar = true;
1519 &rule->linkage,
1523 "Already offloaded rule (cookie %lx)\n", tc->cookie);
1530 rc = efx_tc_flower_handle_lhs_actions(efx, tc, fr, net_dev, rule);
1534 rule->match = *match;
1535 rule->lhs_act.tun_type = type;
1537 rc = efx_mae_insert_lhs_rule(efx, rule, EFX_TC_PRIO_TC);
1539 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
1543 "Successfully parsed lhs rule (cookie %lx)\n",
1548 efx_tc_flower_release_lhs_actions(efx, &rule->lhs_act);
1550 rhashtable_remove_fast(&efx->tc->lhs_rule_ht, &rule->linkage,
1552 kfree(rule);
1566 struct efx_tc_lhs_rule *rule, *old;
1571 NL_SET_ERR_MSG_MOD(extack, "LHS rule only allowed in chain 0");
1576 /* This is not a tunnel decap rule, ignore it */
1606 NL_SET_ERR_MSG_MOD(extack, "LHS rule can never match +trk");
1616 NL_SET_ERR_MSG_MOD(extack, "LHS rule cannot match on inner fields");
1624 rule = kzalloc(sizeof(*rule), GFP_USER);
1625 if (!rule) {
1629 rule->cookie = tc->cookie;
1631 &rule->linkage,
1635 "Already offloaded rule (cookie %lx)\n", tc->cookie);
1642 rc = efx_tc_flower_handle_lhs_actions(efx, tc, fr, net_dev, rule);
1646 rule->match = *match;
1647 rule->lhs_act.tun_type = type;
1649 rc = efx_mae_insert_lhs_rule(efx, rule, EFX_TC_PRIO_TC);
1651 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
1655 "Successfully parsed lhs rule (cookie %lx)\n",
1660 efx_tc_flower_release_lhs_actions(efx, &rule->lhs_act);
1662 rhashtable_remove_fast(&efx->tc->lhs_rule_ht, &rule->linkage,
1664 kfree(rule);
1677 struct efx_tc_flow_rule *rule = NULL, *old = NULL;
1691 /* The rule as given to us doesn't specify a source netdevice.
1793 /* This is not a tunnel decap rule, ignore it */
1800 rule = kzalloc(sizeof(*rule), GFP_USER);
1801 if (!rule) {
1805 INIT_LIST_HEAD(&rule->acts.list);
1806 rule->cookie = tc->cookie;
1808 &rule->linkage,
1815 "Ignoring already-offloaded rule (cookie %lx)\n",
1902 list_add_tail(&act->list, &rule->acts.list);
1948 list_add_tail(&act->list, &rule->acts.list);
1952 rule->match = match;
1958 rc = efx_mae_alloc_action_set_list(efx, &rule->acts);
1963 rc = efx_mae_insert_rule(efx, &rule->match, EFX_TC_PRIO_TC,
1964 rule->acts.fw_id, &rule->fw_id);
1966 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
1972 efx_mae_free_action_set_list(efx, &rule->acts);
1974 /* We failed to insert the rule, so free up any entries we created in
1981 if (rule) {
1984 &rule->linkage,
1986 efx_tc_free_action_set_list(efx, &rule->acts, false);
1988 kfree(rule);
2002 struct efx_tc_lhs_rule *rule, *old;
2006 NL_SET_ERR_MSG_MOD(extack, "LHS rule only allowed in chain 0");
2011 NL_SET_ERR_MSG_MOD(extack, "LHS rule can never match +trk");
2022 rule = kzalloc(sizeof(*rule), GFP_USER);
2023 if (!rule)
2025 rule->cookie = tc->cookie;
2027 &rule->linkage,
2034 "Already offloaded rule (cookie %lx)\n", tc->cookie);
2044 rc = efx_tc_flower_handle_lhs_actions(efx, tc, fr, efx->net_dev, rule);
2048 rule->match = *match;
2050 rc = efx_mae_insert_lhs_rule(efx, rule, EFX_TC_PRIO_TC);
2052 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
2056 "Successfully parsed lhs rule (cookie %lx)\n",
2061 efx_tc_flower_release_lhs_actions(efx, &rule->lhs_act);
2063 rhashtable_remove_fast(&efx->tc->lhs_rule_ht, &rule->linkage,
2065 kfree(rule);
2077 struct efx_tc_flow_rule *rule = NULL, *old;
2183 rule = kzalloc(sizeof(*rule), GFP_USER);
2184 if (!rule) {
2188 INIT_LIST_HEAD(&rule->acts.list);
2189 rule->cookie = tc->cookie;
2191 &rule->linkage,
2198 "Already offloaded rule (cookie %lx)\n", tc->cookie);
2223 * append @act to the action-set list (@rule->acts); if this is a pipe
2228 * @rule->acts or pointed to by @act (and never both), and that only
2229 * those action-sets in @rule->acts exist in hardware. Consequently,
2231 * for @rule->acts we remove each action-set from hardware before
2295 list_add_tail(&act->list, &rule->acts.list);
2339 list_add_tail(&act->list, &rule->acts.list);
2340 act->user = &rule->acts;
2380 list_add_tail(&act->list, &rule->acts.list);
2486 /* Representor, so rule applies to traffic from
2498 list_add_tail(&act->list, &rule->acts.list);
2506 rule->match = match;
2508 rc = efx_mae_alloc_action_set_list(efx, &rule->acts);
2514 /* PF netdev, so rule applies to traffic from wire */
2515 rule->fallback = &efx->tc->facts.pf;
2517 /* repdev, so rule applies to traffic from representee */
2518 rule->fallback = &efx->tc->facts.reps;
2519 if (!efx_tc_check_ready(efx, rule)) {
2521 acts_id = rule->fallback->fw_id;
2524 acts_id = rule->acts.fw_id;
2526 rc = efx_mae_insert_rule(efx, &rule->match, EFX_TC_PRIO_TC,
2527 acts_id, &rule->fw_id);
2529 NL_SET_ERR_MSG_MOD(extack, "Failed to insert rule in hw");
2535 efx_mae_free_action_set_list(efx, &rule->acts);
2537 /* We failed to insert the rule, so free up any entries we created in
2544 if (rule) {
2547 &rule->linkage,
2549 efx_tc_free_action_set_list(efx, &rule->acts, false);
2551 kfree(rule);
2561 struct efx_tc_flow_rule *rule;
2580 rule = rhashtable_lookup_fast(&efx->tc->match_action_ht, &tc->cookie,
2582 if (!rule) {
2596 efx_tc_delete_rule(efx, rule);
2598 rhashtable_remove_fast(&efx->tc->match_action_ht, &rule->linkage,
2600 netif_dbg(efx, drv, efx->net_dev, "Removed filter %lx\n", rule->cookie);
2601 kfree(rule);
2669 u32 eg_port, struct efx_tc_flow_rule *rule)
2671 struct efx_tc_action_set_list *acts = &rule->acts;
2672 struct efx_tc_match *match = &rule->match;
2692 acts->fw_id, &rule->fw_id);
2708 struct efx_tc_flow_rule *rule = &efx->tc->dflt.pf;
2713 return efx_tc_configure_default_rule(efx, ing_port, eg_port, rule);
2718 struct efx_tc_flow_rule *rule = &efx->tc->dflt.wire;
2723 return efx_tc_configure_default_rule(efx, ing_port, eg_port, rule);
2728 struct efx_tc_flow_rule *rule = &efv->dflt;
2734 return efx_tc_configure_default_rule(efx, ing_port, eg_port, rule);
2738 struct efx_tc_flow_rule *rule)
2740 if (rule->fw_id != MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL)
2741 efx_tc_delete_rule(efx, rule);
2742 rule->fw_id = MC_CMD_MAE_ACTION_RULE_INSERT_OUT_ACTION_RULE_ID_NULL;
2948 struct efx_tc_lhs_rule *rule = ptr;
2953 rule->cookie);
2955 if (rule->lhs_act.zone)
2956 efx_tc_ct_unregister_zone(efx, rule->lhs_act.zone);
2957 if (rule->lhs_act.count)
2958 efx_tc_flower_put_counter_index(efx, rule->lhs_act.count);
2959 efx_mae_remove_lhs_rule(efx, rule);
2961 kfree(rule);
2974 struct efx_tc_flow_rule *rule = ptr;
2978 "tc rule %lx still present at teardown, removing\n",
2979 rule->cookie);
2982 efx_tc_delete_rule(efx, rule);
2984 kfree(rule);