Lines Matching refs:e
554 static bool airoha_ppe_foe_compare_entry(struct airoha_flow_table_entry *e, in airoha_ppe_foe_compare_entry() argument
557 int type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, e->data.ib1); in airoha_ppe_foe_compare_entry()
560 if ((hwe->ib1 ^ e->data.ib1) & AIROHA_FOE_IB1_BIND_UDP) in airoha_ppe_foe_compare_entry()
568 return !memcmp(&e->data.d, &hwe->d, len - sizeof(hwe->ib1)); in airoha_ppe_foe_compare_entry()
572 struct airoha_foe_entry *e, in airoha_ppe_foe_commit_entry() argument
581 memcpy(&hwe->d, &e->d, sizeof(*hwe) - sizeof(hwe->ib1)); in airoha_ppe_foe_commit_entry()
584 e->ib1 &= ~AIROHA_FOE_IB1_BIND_TIMESTAMP; in airoha_ppe_foe_commit_entry()
585 e->ib1 |= FIELD_PREP(AIROHA_FOE_IB1_BIND_TIMESTAMP, ts); in airoha_ppe_foe_commit_entry()
586 hwe->ib1 = e->ib1; in airoha_ppe_foe_commit_entry()
613 struct airoha_flow_table_entry *e) in airoha_ppe_foe_remove_flow() argument
617 hlist_del_init(&e->list); in airoha_ppe_foe_remove_flow()
618 if (e->hash != 0xffff) { in airoha_ppe_foe_remove_flow()
619 e->data.ib1 &= ~AIROHA_FOE_IB1_BIND_STATE; in airoha_ppe_foe_remove_flow()
620 e->data.ib1 |= FIELD_PREP(AIROHA_FOE_IB1_BIND_STATE, in airoha_ppe_foe_remove_flow()
622 airoha_ppe_foe_commit_entry(ppe, &e->data, e->hash); in airoha_ppe_foe_remove_flow()
623 e->hash = 0xffff; in airoha_ppe_foe_remove_flow()
625 if (e->type == FLOW_TYPE_L2_SUBFLOW) { in airoha_ppe_foe_remove_flow()
626 hlist_del_init(&e->l2_subflow_node); in airoha_ppe_foe_remove_flow()
627 kfree(e); in airoha_ppe_foe_remove_flow()
632 struct airoha_flow_table_entry *e) in airoha_ppe_foe_remove_l2_flow() argument
634 struct hlist_head *head = &e->l2_flows; in airoha_ppe_foe_remove_l2_flow()
639 rhashtable_remove_fast(&ppe->l2_flows, &e->l2_node, in airoha_ppe_foe_remove_l2_flow()
641 hlist_for_each_entry_safe(e, n, head, l2_subflow_node) in airoha_ppe_foe_remove_l2_flow()
642 airoha_ppe_foe_remove_flow(ppe, e); in airoha_ppe_foe_remove_l2_flow()
646 struct airoha_flow_table_entry *e) in airoha_ppe_foe_flow_remove_entry() argument
650 if (e->type == FLOW_TYPE_L2) in airoha_ppe_foe_flow_remove_entry()
651 airoha_ppe_foe_remove_l2_flow(ppe, e); in airoha_ppe_foe_flow_remove_entry()
653 airoha_ppe_foe_remove_flow(ppe, e); in airoha_ppe_foe_flow_remove_entry()
660 struct airoha_flow_table_entry *e, in airoha_ppe_foe_commit_subflow_entry() argument
676 hlist_add_head(&f->l2_subflow_node, &e->l2_flows); in airoha_ppe_foe_commit_subflow_entry()
681 hwe.ib1 = (hwe.ib1 & mask) | (e->data.ib1 & ~mask); in airoha_ppe_foe_commit_subflow_entry()
685 memcpy(&hwe.ipv6.l2, &e->data.bridge.l2, sizeof(hwe.ipv6.l2)); in airoha_ppe_foe_commit_subflow_entry()
686 hwe.ipv6.ib2 = e->data.bridge.ib2; in airoha_ppe_foe_commit_subflow_entry()
693 memcpy(&hwe.bridge.l2, &e->data.bridge.l2, in airoha_ppe_foe_commit_subflow_entry()
695 hwe.bridge.ib2 = e->data.bridge.ib2; in airoha_ppe_foe_commit_subflow_entry()
701 hwe.bridge.data = e->data.bridge.data; in airoha_ppe_foe_commit_subflow_entry()
711 struct airoha_flow_table_entry *e; in airoha_ppe_foe_insert_entry() local
729 hlist_for_each_entry_safe(e, n, &ppe->foe_flow[index], list) { in airoha_ppe_foe_insert_entry()
730 if (e->type == FLOW_TYPE_L2_SUBFLOW) { in airoha_ppe_foe_insert_entry()
733 e->hash = 0xffff; in airoha_ppe_foe_insert_entry()
734 airoha_ppe_foe_remove_flow(ppe, e); in airoha_ppe_foe_insert_entry()
739 if (commit_done || !airoha_ppe_foe_compare_entry(e, hwe)) { in airoha_ppe_foe_insert_entry()
740 e->hash = 0xffff; in airoha_ppe_foe_insert_entry()
744 airoha_ppe_foe_commit_entry(ppe, &e->data, hash); in airoha_ppe_foe_insert_entry()
746 e->hash = hash; in airoha_ppe_foe_insert_entry()
753 e = rhashtable_lookup_fast(&ppe->l2_flows, &br, in airoha_ppe_foe_insert_entry()
755 if (e) in airoha_ppe_foe_insert_entry()
756 airoha_ppe_foe_commit_subflow_entry(ppe, e, hash); in airoha_ppe_foe_insert_entry()
763 struct airoha_flow_table_entry *e) in airoha_ppe_foe_l2_flow_commit_entry() argument
767 e->type = FLOW_TYPE_L2; in airoha_ppe_foe_l2_flow_commit_entry()
768 prev = rhashtable_lookup_get_insert_fast(&ppe->l2_flows, &e->l2_node, in airoha_ppe_foe_l2_flow_commit_entry()
777 &e->l2_node, in airoha_ppe_foe_l2_flow_commit_entry()
782 struct airoha_flow_table_entry *e) in airoha_ppe_foe_flow_commit_entry() argument
784 int type = FIELD_GET(AIROHA_FOE_IB1_BIND_PACKET_TYPE, e->data.ib1); in airoha_ppe_foe_flow_commit_entry()
788 return airoha_ppe_foe_l2_flow_commit_entry(ppe, e); in airoha_ppe_foe_flow_commit_entry()
790 hash = airoha_ppe_foe_get_entry_hash(&e->data); in airoha_ppe_foe_flow_commit_entry()
791 e->type = FLOW_TYPE_L4; in airoha_ppe_foe_flow_commit_entry()
792 e->hash = 0xffff; in airoha_ppe_foe_flow_commit_entry()
795 hlist_add_head(&e->list, &ppe->foe_flow[hash]); in airoha_ppe_foe_flow_commit_entry()
822 struct airoha_flow_table_entry *e) in airoha_ppe_foe_flow_l2_entry_update() argument
824 int min_idle = airoha_ppe_get_entry_idle_time(ppe, e->data.ib1); in airoha_ppe_foe_flow_l2_entry_update()
830 hlist_for_each_entry_safe(iter, n, &e->l2_flows, l2_subflow_node) { in airoha_ppe_foe_flow_l2_entry_update()
852 e->data.ib1 &= ~AIROHA_FOE_IB1_BIND_TIMESTAMP; in airoha_ppe_foe_flow_l2_entry_update()
853 e->data.ib1 |= ib1 & AIROHA_FOE_IB1_BIND_TIMESTAMP; in airoha_ppe_foe_flow_l2_entry_update()
858 struct airoha_flow_table_entry *e) in airoha_ppe_foe_flow_entry_update() argument
864 if (e->type == FLOW_TYPE_L2) { in airoha_ppe_foe_flow_entry_update()
865 airoha_ppe_foe_flow_l2_entry_update(ppe, e); in airoha_ppe_foe_flow_entry_update()
869 if (e->hash == 0xffff) in airoha_ppe_foe_flow_entry_update()
872 hwe_p = airoha_ppe_foe_get_entry_locked(ppe, e->hash); in airoha_ppe_foe_flow_entry_update()
877 if (!airoha_ppe_foe_compare_entry(e, &hwe)) { in airoha_ppe_foe_flow_entry_update()
878 e->hash = 0xffff; in airoha_ppe_foe_flow_entry_update()
882 e->data.ib1 = hwe.ib1; in airoha_ppe_foe_flow_entry_update()
888 struct airoha_flow_table_entry *e) in airoha_ppe_entry_idle_time() argument
890 airoha_ppe_foe_flow_entry_update(ppe, e); in airoha_ppe_entry_idle_time()
892 return airoha_ppe_get_entry_idle_time(ppe, e->data.ib1); in airoha_ppe_entry_idle_time()
900 struct airoha_flow_table_entry *e; in airoha_ppe_flow_offload_replace() local
1070 e = kzalloc(sizeof(*e), GFP_KERNEL); in airoha_ppe_flow_offload_replace()
1071 if (!e) in airoha_ppe_flow_offload_replace()
1074 e->cookie = f->cookie; in airoha_ppe_flow_offload_replace()
1075 memcpy(&e->data, &hwe, sizeof(e->data)); in airoha_ppe_flow_offload_replace()
1077 err = airoha_ppe_foe_flow_commit_entry(eth->ppe, e); in airoha_ppe_flow_offload_replace()
1081 err = rhashtable_insert_fast(ð->flow_table, &e->node, in airoha_ppe_flow_offload_replace()
1089 airoha_ppe_foe_flow_remove_entry(eth->ppe, e); in airoha_ppe_flow_offload_replace()
1091 kfree(e); in airoha_ppe_flow_offload_replace()
1100 struct airoha_flow_table_entry *e; in airoha_ppe_flow_offload_destroy() local
1102 e = rhashtable_lookup(ð->flow_table, &f->cookie, in airoha_ppe_flow_offload_destroy()
1104 if (!e) in airoha_ppe_flow_offload_destroy()
1107 airoha_ppe_foe_flow_remove_entry(eth->ppe, e); in airoha_ppe_flow_offload_destroy()
1108 rhashtable_remove_fast(ð->flow_table, &e->node, in airoha_ppe_flow_offload_destroy()
1110 kfree(e); in airoha_ppe_flow_offload_destroy()
1146 struct airoha_flow_table_entry *e; in airoha_ppe_flow_offload_stats() local
1149 e = rhashtable_lookup(ð->flow_table, &f->cookie, in airoha_ppe_flow_offload_stats()
1151 if (!e) in airoha_ppe_flow_offload_stats()
1154 idle = airoha_ppe_entry_idle_time(eth->ppe, e); in airoha_ppe_flow_offload_stats()
1157 if (e->hash != 0xffff) { in airoha_ppe_flow_offload_stats()
1160 airoha_ppe_foe_entry_get_stats(eth->ppe, e->hash, &stats); in airoha_ppe_flow_offload_stats()
1161 f->stats.pkts += (stats.packets - e->stats.packets); in airoha_ppe_flow_offload_stats()
1162 f->stats.bytes += (stats.bytes - e->stats.bytes); in airoha_ppe_flow_offload_stats()
1163 e->stats = stats; in airoha_ppe_flow_offload_stats()