Lines Matching refs:rule
10 struct sja1105_rule *rule;
12 list_for_each_entry(rule, &priv->flow_block.rules, list)
13 if (rule->cookie == cookie)
14 return rule;
36 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie);
42 if (!rule) {
43 rule = kzalloc(sizeof(*rule), GFP_KERNEL);
44 if (!rule)
47 rule->cookie = cookie;
48 rule->type = SJA1105_RULE_BCAST_POLICER;
49 rule->bcast_pol.sharindx = sja1105_find_free_l2_policer(priv);
50 rule->key.type = SJA1105_KEY_BCAST;
54 if (rule->bcast_pol.sharindx == -1) {
69 rule->port_mask |= BIT(port);
74 for_each_set_bit(p, &rule->port_mask, SJA1105_NUM_PORTS) {
77 policing[bcast].sharindx = rule->bcast_pol.sharindx;
80 policing[rule->bcast_pol.sharindx].rate = div_u64(rate_bytes_per_sec *
82 policing[rule->bcast_pol.sharindx].smax = burst;
85 policing[rule->bcast_pol.sharindx].maxlen = VLAN_ETH_FRAME_LEN +
92 priv->flow_block.l2_policer_used[rule->bcast_pol.sharindx] = true;
93 list_add(&rule->list, &priv->flow_block.rules);
95 kfree(rule);
107 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie);
113 if (!rule) {
114 rule = kzalloc(sizeof(*rule), GFP_KERNEL);
115 if (!rule)
118 rule->cookie = cookie;
119 rule->type = SJA1105_RULE_TC_POLICER;
120 rule->tc_pol.sharindx = sja1105_find_free_l2_policer(priv);
121 rule->key.type = SJA1105_KEY_TC;
122 rule->key.tc.pcp = tc;
126 if (rule->tc_pol.sharindx == -1) {
141 rule->port_mask |= BIT(port);
146 for_each_set_bit(p, &rule->port_mask, SJA1105_NUM_PORTS) {
149 policing[index].sharindx = rule->tc_pol.sharindx;
152 policing[rule->tc_pol.sharindx].rate = div_u64(rate_bytes_per_sec *
154 policing[rule->tc_pol.sharindx].smax = burst;
157 policing[rule->tc_pol.sharindx].maxlen = VLAN_ETH_FRAME_LEN +
164 priv->flow_block.l2_policer_used[rule->tc_pol.sharindx] = true;
165 list_add(&rule->list, &priv->flow_block.rules);
167 kfree(rule);
199 struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
200 struct flow_dissector *dissector = rule->match.dissector;
216 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) {
219 flow_rule_match_basic(rule, &match);
227 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
232 flow_rule_match_eth_addrs(rule, &match);
251 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) {
254 flow_rule_match_vlan(rule, &match);
305 struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
322 flow_action_for_each(i, act, &rule->action) {
420 struct sja1105_rule *rule = sja1105_rule_find(priv, cls->cookie);
424 if (!rule)
427 if (rule->type == SJA1105_RULE_VL)
428 return sja1105_vl_delete(priv, port, rule, cls->common.extack);
432 if (rule->type == SJA1105_RULE_BCAST_POLICER) {
437 } else if (rule->type == SJA1105_RULE_TC_POLICER) {
438 int index = (port * SJA1105_NUM_TC) + rule->key.tc.pcp;
446 rule->port_mask &= ~BIT(port);
447 if (!rule->port_mask) {
449 list_del(&rule->list);
450 kfree(rule);
460 struct sja1105_rule *rule = sja1105_rule_find(priv, cls->cookie);
463 if (!rule)
466 if (rule->type != SJA1105_RULE_VL)
469 rc = sja1105_vl_stats(priv, port, rule, &cls->stats,
491 struct sja1105_rule *rule;
495 rule = list_entry(pos, struct sja1105_rule, list);
496 list_del(&rule->list);
497 kfree(rule);