Lines Matching refs:rule

12 				     struct sja1105_rule *rule,  in sja1105_insert_gate_entry()  argument
23 e->rule = rule; in sja1105_insert_gate_entry()
95 struct sja1105_rule *rule; in sja1105_compose_gating_subschedule() local
102 list_for_each_entry(rule, &priv->flow_block.rules, list) { in sja1105_compose_gating_subschedule()
103 if (rule->type != SJA1105_RULE_VL) in sja1105_compose_gating_subschedule()
105 if (rule->vl.type != SJA1105_VL_TIME_TRIGGERED) in sja1105_compose_gating_subschedule()
108 if (max_cycle_time < rule->vl.cycle_time) { in sja1105_compose_gating_subschedule()
109 max_cycle_time = rule->vl.cycle_time; in sja1105_compose_gating_subschedule()
110 its_base_time = rule->vl.base_time; in sja1105_compose_gating_subschedule()
124 list_for_each_entry(rule, &priv->flow_block.rules, list) { in sja1105_compose_gating_subschedule()
128 if (rule->type != SJA1105_RULE_VL) in sja1105_compose_gating_subschedule()
130 if (rule->vl.type != SJA1105_VL_TIME_TRIGGERED) in sja1105_compose_gating_subschedule()
137 rbt = future_base_time(rule->vl.base_time, rule->vl.cycle_time, in sja1105_compose_gating_subschedule()
143 for (i = 0; i < rule->vl.num_entries; i++) { in sja1105_compose_gating_subschedule()
144 u8 gate_state = rule->vl.entries[i].gate_state; in sja1105_compose_gating_subschedule()
148 rc = sja1105_insert_gate_entry(gating_cfg, rule, in sja1105_compose_gating_subschedule()
155 entry_time += rule->vl.cycle_time; in sja1105_compose_gating_subschedule()
157 time += rule->vl.entries[i].interval; in sja1105_compose_gating_subschedule()
320 struct sja1105_rule *rule; in sja1105_init_virtual_links() local
326 list_for_each_entry(rule, &priv->flow_block.rules, list) { in sja1105_init_virtual_links()
327 if (rule->type != SJA1105_RULE_VL) in sja1105_init_virtual_links()
330 num_virtual_links += hweight_long(rule->port_mask); in sja1105_init_virtual_links()
332 if (rule->vl.type != SJA1105_VL_NONCRITICAL) in sja1105_init_virtual_links()
334 if (max_sharindx < rule->vl.sharindx) in sja1105_init_virtual_links()
335 max_sharindx = rule->vl.sharindx; in sja1105_init_virtual_links()
396 list_for_each_entry(rule, &priv->flow_block.rules, list) { in sja1105_init_virtual_links()
399 if (rule->type != SJA1105_RULE_VL) in sja1105_init_virtual_links()
402 for_each_set_bit(port, &rule->port_mask, SJA1105_MAX_NUM_PORTS) { in sja1105_init_virtual_links()
405 vl_lookup[k].macaddr = rule->key.vl.dmac; in sja1105_init_virtual_links()
406 if (rule->key.type == SJA1105_KEY_VLAN_AWARE_VL) { in sja1105_init_virtual_links()
407 vl_lookup[k].vlanid = rule->key.vl.vid; in sja1105_init_virtual_links()
408 vl_lookup[k].vlanprior = rule->key.vl.pcp; in sja1105_init_virtual_links()
421 if (rule->vl.type == SJA1105_VL_NONCRITICAL) in sja1105_init_virtual_links()
422 vl_lookup[k].destports = rule->vl.destports; in sja1105_init_virtual_links()
425 vl_lookup[k].flow_cookie = rule->cookie; in sja1105_init_virtual_links()
481 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_init_virtual_links() local
483 if (rule->vl.type == SJA1105_VL_NONCRITICAL) in sja1105_init_virtual_links()
485 if (rule->vl.type == SJA1105_VL_TIME_TRIGGERED) { in sja1105_init_virtual_links()
486 int sharindx = rule->vl.sharindx; in sja1105_init_virtual_links()
490 vl_policing[i].maxlen = rule->vl.maxlen; in sja1105_init_virtual_links()
495 vl_fwd[sharindx].priority = rule->vl.ipv; in sja1105_init_virtual_links()
497 vl_fwd[sharindx].destports = rule->vl.destports; in sja1105_init_virtual_links()
511 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_vl_redirect() local
526 if (!rule) { in sja1105_vl_redirect()
527 rule = kzalloc(sizeof(*rule), GFP_KERNEL); in sja1105_vl_redirect()
528 if (!rule) in sja1105_vl_redirect()
531 rule->cookie = cookie; in sja1105_vl_redirect()
532 rule->type = SJA1105_RULE_VL; in sja1105_vl_redirect()
533 rule->key = *key; in sja1105_vl_redirect()
534 list_add(&rule->list, &priv->flow_block.rules); in sja1105_vl_redirect()
537 rule->port_mask |= BIT(port); in sja1105_vl_redirect()
539 rule->vl.destports |= destports; in sja1105_vl_redirect()
541 rule->vl.destports = destports; in sja1105_vl_redirect()
545 rule->port_mask &= ~BIT(port); in sja1105_vl_redirect()
546 if (!rule->port_mask) { in sja1105_vl_redirect()
547 list_del(&rule->list); in sja1105_vl_redirect()
548 kfree(rule); in sja1105_vl_redirect()
556 struct sja1105_rule *rule, struct netlink_ext_ack *extack) in sja1105_vl_delete() argument
560 rule->port_mask &= ~BIT(port); in sja1105_vl_delete()
561 if (!rule->port_mask) { in sja1105_vl_delete()
562 list_del(&rule->list); in sja1105_vl_delete()
563 kfree(rule); in sja1105_vl_delete()
587 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_vl_gate() local
624 if (!rule) { in sja1105_vl_gate()
625 rule = kzalloc(sizeof(*rule), GFP_KERNEL); in sja1105_vl_gate()
626 if (!rule) in sja1105_vl_gate()
629 list_add(&rule->list, &priv->flow_block.rules); in sja1105_vl_gate()
630 rule->cookie = cookie; in sja1105_vl_gate()
631 rule->type = SJA1105_RULE_VL; in sja1105_vl_gate()
632 rule->key = *key; in sja1105_vl_gate()
633 rule->vl.type = SJA1105_VL_TIME_TRIGGERED; in sja1105_vl_gate()
634 rule->vl.sharindx = index; in sja1105_vl_gate()
635 rule->vl.base_time = base_time; in sja1105_vl_gate()
636 rule->vl.cycle_time = cycle_time; in sja1105_vl_gate()
637 rule->vl.num_entries = num_entries; in sja1105_vl_gate()
638 rule->vl.entries = kcalloc(num_entries, in sja1105_vl_gate()
641 if (!rule->vl.entries) { in sja1105_vl_gate()
687 rule->vl.entries[i] = entries[i]; in sja1105_vl_gate()
698 rule->vl.maxlen = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN; in sja1105_vl_gate()
699 rule->vl.ipv = ipv; in sja1105_vl_gate()
702 rule->port_mask |= BIT(port); in sja1105_vl_gate()
720 rule->port_mask &= ~BIT(port); in sja1105_vl_gate()
721 if (!rule->port_mask) { in sja1105_vl_gate()
722 list_del(&rule->list); in sja1105_vl_gate()
723 kfree(rule->vl.entries); in sja1105_vl_gate()
724 kfree(rule); in sja1105_vl_gate()
763 struct sja1105_rule *rule, struct flow_stats *stats, in sja1105_vl_stats() argument
774 if (rule->vl.type != SJA1105_VL_TIME_TRIGGERED) in sja1105_vl_stats()
777 vlid = sja1105_find_vlid(priv, port, &rule->key); in sja1105_vl_stats()
794 flow_stats_update(stats, 0, pkts - rule->vl.stats.pkts, 0, in sja1105_vl_stats()
795 jiffies - rule->vl.stats.lastused, in sja1105_vl_stats()
798 rule->vl.stats.pkts = pkts; in sja1105_vl_stats()
799 rule->vl.stats.lastused = jiffies; in sja1105_vl_stats()