Lines Matching full:rule
10 struct sja1105_rule *rule; in sja1105_rule_find() local
12 list_for_each_entry(rule, &priv->flow_block.rules, list) in sja1105_rule_find()
13 if (rule->cookie == cookie) in sja1105_rule_find()
14 return rule; in sja1105_rule_find()
36 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_setup_bcast_policer() local
43 if (!rule) { in sja1105_setup_bcast_policer()
44 rule = kzalloc(sizeof(*rule), GFP_KERNEL); in sja1105_setup_bcast_policer()
45 if (!rule) in sja1105_setup_bcast_policer()
48 rule->cookie = cookie; in sja1105_setup_bcast_policer()
49 rule->type = SJA1105_RULE_BCAST_POLICER; in sja1105_setup_bcast_policer()
50 rule->bcast_pol.sharindx = sja1105_find_free_l2_policer(priv); in sja1105_setup_bcast_policer()
51 rule->key.type = SJA1105_KEY_BCAST; in sja1105_setup_bcast_policer()
55 if (rule->bcast_pol.sharindx == -1) { in sja1105_setup_bcast_policer()
70 rule->port_mask |= BIT(port); in sja1105_setup_bcast_policer()
75 for_each_set_bit(p, &rule->port_mask, SJA1105_MAX_NUM_PORTS) { in sja1105_setup_bcast_policer()
78 policing[bcast].sharindx = rule->bcast_pol.sharindx; in sja1105_setup_bcast_policer()
81 policing[rule->bcast_pol.sharindx].rate = div_u64(rate_bytes_per_sec * in sja1105_setup_bcast_policer()
83 policing[rule->bcast_pol.sharindx].smax = burst; in sja1105_setup_bcast_policer()
86 policing[rule->bcast_pol.sharindx].maxlen = VLAN_ETH_FRAME_LEN + in sja1105_setup_bcast_policer()
93 priv->flow_block.l2_policer_used[rule->bcast_pol.sharindx] = true; in sja1105_setup_bcast_policer()
94 list_add(&rule->list, &priv->flow_block.rules); in sja1105_setup_bcast_policer()
96 kfree(rule); in sja1105_setup_bcast_policer()
108 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_setup_tc_policer() local
114 if (!rule) { in sja1105_setup_tc_policer()
115 rule = kzalloc(sizeof(*rule), GFP_KERNEL); in sja1105_setup_tc_policer()
116 if (!rule) in sja1105_setup_tc_policer()
119 rule->cookie = cookie; in sja1105_setup_tc_policer()
120 rule->type = SJA1105_RULE_TC_POLICER; in sja1105_setup_tc_policer()
121 rule->tc_pol.sharindx = sja1105_find_free_l2_policer(priv); in sja1105_setup_tc_policer()
122 rule->key.type = SJA1105_KEY_TC; in sja1105_setup_tc_policer()
123 rule->key.tc.pcp = tc; in sja1105_setup_tc_policer()
127 if (rule->tc_pol.sharindx == -1) { in sja1105_setup_tc_policer()
142 rule->port_mask |= BIT(port); in sja1105_setup_tc_policer()
147 for_each_set_bit(p, &rule->port_mask, SJA1105_MAX_NUM_PORTS) { in sja1105_setup_tc_policer()
150 policing[index].sharindx = rule->tc_pol.sharindx; in sja1105_setup_tc_policer()
153 policing[rule->tc_pol.sharindx].rate = div_u64(rate_bytes_per_sec * in sja1105_setup_tc_policer()
155 policing[rule->tc_pol.sharindx].smax = burst; in sja1105_setup_tc_policer()
158 policing[rule->tc_pol.sharindx].maxlen = VLAN_ETH_FRAME_LEN + in sja1105_setup_tc_policer()
165 priv->flow_block.l2_policer_used[rule->tc_pol.sharindx] = true; in sja1105_setup_tc_policer()
166 list_add(&rule->list, &priv->flow_block.rules); in sja1105_setup_tc_policer()
168 kfree(rule); in sja1105_setup_tc_policer()
200 struct flow_rule *rule = flow_cls_offload_flow_rule(cls); in sja1105_flower_parse_key() local
201 struct flow_dissector *dissector = rule->match.dissector; in sja1105_flower_parse_key()
217 if (flow_rule_match_has_control_flags(rule, extack)) in sja1105_flower_parse_key()
220 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) { in sja1105_flower_parse_key()
223 flow_rule_match_basic(rule, &match); in sja1105_flower_parse_key()
231 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { in sja1105_flower_parse_key()
236 flow_rule_match_eth_addrs(rule, &match); in sja1105_flower_parse_key()
255 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) { in sja1105_flower_parse_key()
258 flow_rule_match_vlan(rule, &match); in sja1105_flower_parse_key()
349 struct flow_rule *rule = flow_cls_offload_flow_rule(cls); in sja1105_cls_flower_add() local
364 flow_action_for_each(i, act, &rule->action) { in sja1105_cls_flower_add()
367 rc = sja1105_policer_validate(&rule->action, act, extack); in sja1105_cls_flower_add()
466 struct sja1105_rule *rule = sja1105_rule_find(priv, cls->cookie); in sja1105_cls_flower_del() local
470 if (!rule) in sja1105_cls_flower_del()
473 if (rule->type == SJA1105_RULE_VL) in sja1105_cls_flower_del()
474 return sja1105_vl_delete(priv, port, rule, cls->common.extack); in sja1105_cls_flower_del()
478 if (rule->type == SJA1105_RULE_BCAST_POLICER) { in sja1105_cls_flower_del()
483 } else if (rule->type == SJA1105_RULE_TC_POLICER) { in sja1105_cls_flower_del()
484 int index = (port * SJA1105_NUM_TC) + rule->key.tc.pcp; in sja1105_cls_flower_del()
492 rule->port_mask &= ~BIT(port); in sja1105_cls_flower_del()
493 if (!rule->port_mask) { in sja1105_cls_flower_del()
495 list_del(&rule->list); in sja1105_cls_flower_del()
496 kfree(rule); in sja1105_cls_flower_del()
506 struct sja1105_rule *rule = sja1105_rule_find(priv, cls->cookie); in sja1105_cls_flower_stats() local
509 if (!rule) in sja1105_cls_flower_stats()
512 if (rule->type != SJA1105_RULE_VL) in sja1105_cls_flower_stats()
515 rc = sja1105_vl_stats(priv, port, rule, &cls->stats, in sja1105_cls_flower_stats()
537 struct sja1105_rule *rule; in sja1105_flower_teardown() local
541 rule = list_entry(pos, struct sja1105_rule, list); in sja1105_flower_teardown()
542 list_del(&rule->list); in sja1105_flower_teardown()
543 kfree(rule); in sja1105_flower_teardown()