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);
43 if (!rule) {
44 rule = kzalloc(sizeof(*rule), GFP_KERNEL);
45 if (!rule)
48 rule->cookie = cookie;
49 rule->type = SJA1105_RULE_BCAST_POLICER;
50 rule->bcast_pol.sharindx = sja1105_find_free_l2_policer(priv);
51 rule->key.type = SJA1105_KEY_BCAST;
55 if (rule->bcast_pol.sharindx == -1) {
70 rule->port_mask |= BIT(port);
75 for_each_set_bit(p, &rule->port_mask, SJA1105_MAX_NUM_PORTS) {
78 policing[bcast].sharindx = rule->bcast_pol.sharindx;
81 policing[rule->bcast_pol.sharindx].rate = div_u64(rate_bytes_per_sec *
83 policing[rule->bcast_pol.sharindx].smax = burst;
86 policing[rule->bcast_pol.sharindx].maxlen = VLAN_ETH_FRAME_LEN +
93 priv->flow_block.l2_policer_used[rule->bcast_pol.sharindx] = true;
94 list_add(&rule->list, &priv->flow_block.rules);
96 kfree(rule);
108 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie);
114 if (!rule) {
115 rule = kzalloc(sizeof(*rule), GFP_KERNEL);
116 if (!rule)
119 rule->cookie = cookie;
120 rule->type = SJA1105_RULE_TC_POLICER;
121 rule->tc_pol.sharindx = sja1105_find_free_l2_policer(priv);
122 rule->key.type = SJA1105_KEY_TC;
123 rule->key.tc.pcp = tc;
127 if (rule->tc_pol.sharindx == -1) {
142 rule->port_mask |= BIT(port);
147 for_each_set_bit(p, &rule->port_mask, SJA1105_MAX_NUM_PORTS) {
150 policing[index].sharindx = rule->tc_pol.sharindx;
153 policing[rule->tc_pol.sharindx].rate = div_u64(rate_bytes_per_sec *
155 policing[rule->tc_pol.sharindx].smax = burst;
158 policing[rule->tc_pol.sharindx].maxlen = VLAN_ETH_FRAME_LEN +
165 priv->flow_block.l2_policer_used[rule->tc_pol.sharindx] = true;
166 list_add(&rule->list, &priv->flow_block.rules);
168 kfree(rule);
200 struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
201 struct flow_dissector *dissector = rule->match.dissector;
217 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_BASIC)) {
220 flow_rule_match_basic(rule, &match);
228 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
233 flow_rule_match_eth_addrs(rule, &match);
252 if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) {
255 flow_rule_match_vlan(rule, &match);
346 struct flow_rule *rule = flow_cls_offload_flow_rule(cls);
361 flow_action_for_each(i, act, &rule->action) {
364 rc = sja1105_policer_validate(&rule->action, act, extack);
463 struct sja1105_rule *rule = sja1105_rule_find(priv, cls->cookie);
467 if (!rule)
470 if (rule->type == SJA1105_RULE_VL)
471 return sja1105_vl_delete(priv, port, rule, cls->common.extack);
475 if (rule->type == SJA1105_RULE_BCAST_POLICER) {
480 } else if (rule->type == SJA1105_RULE_TC_POLICER) {
481 int index = (port * SJA1105_NUM_TC) + rule->key.tc.pcp;
489 rule->port_mask &= ~BIT(port);
490 if (!rule->port_mask) {
492 list_del(&rule->list);
493 kfree(rule);
503 struct sja1105_rule *rule = sja1105_rule_find(priv, cls->cookie);
506 if (!rule)
509 if (rule->type != SJA1105_RULE_VL)
512 rc = sja1105_vl_stats(priv, port, rule, &cls->stats,
534 struct sja1105_rule *rule;
538 rule = list_entry(pos, struct sja1105_rule, list);
539 list_del(&rule->list);
540 kfree(rule);