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()
307 struct sja1105_rule *rule; in sja1105_init_virtual_links() local
313 list_for_each_entry(rule, &priv->flow_block.rules, list) { in sja1105_init_virtual_links()
314 if (rule->type != SJA1105_RULE_VL) in sja1105_init_virtual_links()
317 num_virtual_links += hweight_long(rule->port_mask); in sja1105_init_virtual_links()
319 if (rule->vl.type != SJA1105_VL_NONCRITICAL) in sja1105_init_virtual_links()
321 if (max_sharindx < rule->vl.sharindx) in sja1105_init_virtual_links()
322 max_sharindx = rule->vl.sharindx; in sja1105_init_virtual_links()
383 list_for_each_entry(rule, &priv->flow_block.rules, list) { in sja1105_init_virtual_links()
386 if (rule->type != SJA1105_RULE_VL) in sja1105_init_virtual_links()
389 for_each_set_bit(port, &rule->port_mask, SJA1105_NUM_PORTS) { in sja1105_init_virtual_links()
392 vl_lookup[k].macaddr = rule->key.vl.dmac; in sja1105_init_virtual_links()
393 if (rule->key.type == SJA1105_KEY_VLAN_AWARE_VL) { in sja1105_init_virtual_links()
394 vl_lookup[k].vlanid = rule->key.vl.vid; in sja1105_init_virtual_links()
395 vl_lookup[k].vlanprior = rule->key.vl.pcp; in sja1105_init_virtual_links()
406 if (rule->vl.type == SJA1105_VL_NONCRITICAL) in sja1105_init_virtual_links()
407 vl_lookup[k].destports = rule->vl.destports; in sja1105_init_virtual_links()
410 vl_lookup[k].flow_cookie = rule->cookie; in sja1105_init_virtual_links()
466 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_init_virtual_links() local
468 if (rule->vl.type == SJA1105_VL_NONCRITICAL) in sja1105_init_virtual_links()
470 if (rule->vl.type == SJA1105_VL_TIME_TRIGGERED) { in sja1105_init_virtual_links()
471 int sharindx = rule->vl.sharindx; in sja1105_init_virtual_links()
475 vl_policing[i].maxlen = rule->vl.maxlen; in sja1105_init_virtual_links()
480 vl_fwd[sharindx].priority = rule->vl.ipv; in sja1105_init_virtual_links()
482 vl_fwd[sharindx].destports = rule->vl.destports; in sja1105_init_virtual_links()
496 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_vl_redirect() local
512 if (!rule) { in sja1105_vl_redirect()
513 rule = kzalloc(sizeof(*rule), GFP_KERNEL); in sja1105_vl_redirect()
514 if (!rule) in sja1105_vl_redirect()
517 rule->cookie = cookie; in sja1105_vl_redirect()
518 rule->type = SJA1105_RULE_VL; in sja1105_vl_redirect()
519 rule->key = *key; in sja1105_vl_redirect()
520 list_add(&rule->list, &priv->flow_block.rules); in sja1105_vl_redirect()
523 rule->port_mask |= BIT(port); in sja1105_vl_redirect()
525 rule->vl.destports |= destports; in sja1105_vl_redirect()
527 rule->vl.destports = destports; in sja1105_vl_redirect()
531 rule->port_mask &= ~BIT(port); in sja1105_vl_redirect()
532 if (!rule->port_mask) { in sja1105_vl_redirect()
533 list_del(&rule->list); in sja1105_vl_redirect()
534 kfree(rule); in sja1105_vl_redirect()
542 struct sja1105_rule *rule, struct netlink_ext_ack *extack) in sja1105_vl_delete() argument
546 rule->port_mask &= ~BIT(port); in sja1105_vl_delete()
547 if (!rule->port_mask) { in sja1105_vl_delete()
548 list_del(&rule->list); in sja1105_vl_delete()
549 kfree(rule); in sja1105_vl_delete()
573 struct sja1105_rule *rule = sja1105_rule_find(priv, cookie); in sja1105_vl_gate() local
611 if (!rule) { in sja1105_vl_gate()
612 rule = kzalloc(sizeof(*rule), GFP_KERNEL); in sja1105_vl_gate()
613 if (!rule) in sja1105_vl_gate()
616 list_add(&rule->list, &priv->flow_block.rules); in sja1105_vl_gate()
617 rule->cookie = cookie; in sja1105_vl_gate()
618 rule->type = SJA1105_RULE_VL; in sja1105_vl_gate()
619 rule->key = *key; in sja1105_vl_gate()
620 rule->vl.type = SJA1105_VL_TIME_TRIGGERED; in sja1105_vl_gate()
621 rule->vl.sharindx = index; in sja1105_vl_gate()
622 rule->vl.base_time = base_time; in sja1105_vl_gate()
623 rule->vl.cycle_time = cycle_time; in sja1105_vl_gate()
624 rule->vl.num_entries = num_entries; in sja1105_vl_gate()
625 rule->vl.entries = kcalloc(num_entries, in sja1105_vl_gate()
628 if (!rule->vl.entries) { in sja1105_vl_gate()
674 rule->vl.entries[i] = entries[i]; in sja1105_vl_gate()
685 rule->vl.maxlen = VLAN_ETH_FRAME_LEN + ETH_FCS_LEN; in sja1105_vl_gate()
686 rule->vl.ipv = ipv; in sja1105_vl_gate()
689 rule->port_mask |= BIT(port); in sja1105_vl_gate()
707 rule->port_mask &= ~BIT(port); in sja1105_vl_gate()
708 if (!rule->port_mask) { in sja1105_vl_gate()
709 list_del(&rule->list); in sja1105_vl_gate()
710 kfree(rule->vl.entries); in sja1105_vl_gate()
711 kfree(rule); in sja1105_vl_gate()
750 struct sja1105_rule *rule, struct flow_stats *stats, in sja1105_vl_stats() argument
761 if (rule->vl.type != SJA1105_VL_TIME_TRIGGERED) in sja1105_vl_stats()
764 vlid = sja1105_find_vlid(priv, port, &rule->key); in sja1105_vl_stats()
781 flow_stats_update(stats, 0, pkts - rule->vl.stats.pkts, 0, in sja1105_vl_stats()
782 jiffies - rule->vl.stats.lastused, in sja1105_vl_stats()
785 rule->vl.stats.pkts = pkts; in sja1105_vl_stats()
786 rule->vl.stats.lastused = jiffies; in sja1105_vl_stats()