Lines Matching full:entry
185 mtk_foe_entry_l2(struct mtk_eth *eth, struct mtk_foe_entry *entry) in mtk_foe_entry_l2() argument
187 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_l2()
190 return &entry->bridge.l2; in mtk_foe_entry_l2()
193 return &entry->ipv6.l2; in mtk_foe_entry_l2()
195 return &entry->ipv4.l2; in mtk_foe_entry_l2()
199 mtk_foe_entry_ib2(struct mtk_eth *eth, struct mtk_foe_entry *entry) in mtk_foe_entry_ib2() argument
201 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_ib2()
204 return &entry->bridge.ib2; in mtk_foe_entry_ib2()
207 return &entry->ipv6.ib2; in mtk_foe_entry_ib2()
209 return &entry->ipv4.ib2; in mtk_foe_entry_ib2()
212 int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_prepare() argument
219 memset(entry, 0, sizeof(*entry)); in mtk_foe_entry_prepare()
226 entry->ib1 = val; in mtk_foe_entry_prepare()
237 entry->ib1 = val; in mtk_foe_entry_prepare()
249 entry->ipv4.orig.ports = ports_pad; in mtk_foe_entry_prepare()
251 entry->ipv6.ports = ports_pad; in mtk_foe_entry_prepare()
254 ether_addr_copy(entry->bridge.src_mac, src_mac); in mtk_foe_entry_prepare()
255 ether_addr_copy(entry->bridge.dest_mac, dest_mac); in mtk_foe_entry_prepare()
256 entry->bridge.ib2 = val; in mtk_foe_entry_prepare()
257 l2 = &entry->bridge.l2; in mtk_foe_entry_prepare()
259 entry->ipv6.ib2 = val; in mtk_foe_entry_prepare()
260 l2 = &entry->ipv6.l2; in mtk_foe_entry_prepare()
262 entry->ipv4.ib2 = val; in mtk_foe_entry_prepare()
263 l2 = &entry->ipv4.l2; in mtk_foe_entry_prepare()
280 struct mtk_foe_entry *entry, u8 port) in mtk_foe_entry_set_pse_port() argument
282 u32 *ib2 = mtk_foe_entry_ib2(eth, entry); in mtk_foe_entry_set_pse_port()
298 struct mtk_foe_entry *entry, bool egress, in mtk_foe_entry_set_ipv4_tuple() argument
302 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_set_ipv4_tuple()
308 t = &entry->ipv4.new; in mtk_foe_entry_set_ipv4_tuple()
314 t = &entry->ipv4.orig; in mtk_foe_entry_set_ipv4_tuple()
317 entry->ipv6_6rd.tunnel_src_ip = be32_to_cpu(src_addr); in mtk_foe_entry_set_ipv4_tuple()
318 entry->ipv6_6rd.tunnel_dest_ip = be32_to_cpu(dest_addr); in mtk_foe_entry_set_ipv4_tuple()
338 struct mtk_foe_entry *entry, in mtk_foe_entry_set_ipv6_tuple() argument
342 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_set_ipv6_tuple()
347 src = entry->dslite.tunnel_src_ip; in mtk_foe_entry_set_ipv6_tuple()
348 dest = entry->dslite.tunnel_dest_ip; in mtk_foe_entry_set_ipv6_tuple()
352 entry->ipv6.src_port = be16_to_cpu(src_port); in mtk_foe_entry_set_ipv6_tuple()
353 entry->ipv6.dest_port = be16_to_cpu(dest_port); in mtk_foe_entry_set_ipv6_tuple()
356 src = entry->ipv6.src_ip; in mtk_foe_entry_set_ipv6_tuple()
357 dest = entry->ipv6.dest_ip; in mtk_foe_entry_set_ipv6_tuple()
370 int mtk_foe_entry_set_dsa(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_dsa() argument
373 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_dsa()
377 if (!(entry->ib1 & mtk_get_ib1_vlan_layer_mask(eth))) in mtk_foe_entry_set_dsa()
378 entry->ib1 |= mtk_prep_ib1_vlan_layer(eth, 1); in mtk_foe_entry_set_dsa()
382 entry->ib1 &= ~mtk_get_ib1_vlan_tag_mask(eth); in mtk_foe_entry_set_dsa()
387 int mtk_foe_entry_set_vlan(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_vlan() argument
390 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_vlan()
392 switch (mtk_get_ib1_vlan_layer(eth, entry->ib1)) { in mtk_foe_entry_set_vlan()
394 entry->ib1 |= mtk_get_ib1_vlan_tag_mask(eth) | in mtk_foe_entry_set_vlan()
399 if (!(entry->ib1 & mtk_get_ib1_vlan_tag_mask(eth))) { in mtk_foe_entry_set_vlan()
404 entry->ib1 += mtk_prep_ib1_vlan_layer(eth, 1); in mtk_foe_entry_set_vlan()
412 int mtk_foe_entry_set_pppoe(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_pppoe() argument
415 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_pppoe()
417 if (!(entry->ib1 & mtk_get_ib1_vlan_layer_mask(eth)) || in mtk_foe_entry_set_pppoe()
418 (entry->ib1 & mtk_get_ib1_vlan_tag_mask(eth))) in mtk_foe_entry_set_pppoe()
421 entry->ib1 |= mtk_get_ib1_ppoe_mask(eth); in mtk_foe_entry_set_pppoe()
427 int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_wdma() argument
431 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_wdma()
432 u32 *ib2 = mtk_foe_entry_ib2(eth, entry); in mtk_foe_entry_set_wdma()
464 int mtk_foe_entry_set_queue(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_queue() argument
467 u32 *ib2 = mtk_foe_entry_ib2(eth, entry); in mtk_foe_entry_set_queue()
483 mtk_flow_entry_match(struct mtk_eth *eth, struct mtk_flow_entry *entry, in mtk_flow_entry_match() argument
488 if ((data->ib1 ^ entry->data.ib1) & MTK_FOE_IB1_UDP) in mtk_flow_entry_match()
491 type = mtk_get_ib1_pkt_type(eth, entry->data.ib1); in mtk_flow_entry_match()
497 return !memcmp(&entry->data.data, &data->data, len - 4); in mtk_flow_entry_match()
501 __mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in __mtk_foe_entry_clear() argument
506 if (entry->type == MTK_FLOW_TYPE_L2) { in __mtk_foe_entry_clear()
507 rhashtable_remove_fast(&ppe->l2_flows, &entry->l2_node, in __mtk_foe_entry_clear()
510 head = &entry->l2_flows; in __mtk_foe_entry_clear()
511 hlist_for_each_entry_safe(entry, tmp, head, l2_data.list) in __mtk_foe_entry_clear()
512 __mtk_foe_entry_clear(ppe, entry); in __mtk_foe_entry_clear()
516 hlist_del_init(&entry->list); in __mtk_foe_entry_clear()
517 if (entry->hash != 0xffff) { in __mtk_foe_entry_clear()
518 struct mtk_foe_entry *hwe = mtk_foe_get_entry(ppe, entry->hash); in __mtk_foe_entry_clear()
528 acct = ppe->acct_table + entry->hash * sizeof(*acct); in __mtk_foe_entry_clear()
533 entry->hash = 0xffff; in __mtk_foe_entry_clear()
535 if (entry->type != MTK_FLOW_TYPE_L2_SUBFLOW) in __mtk_foe_entry_clear()
538 hlist_del_init(&entry->l2_data.list); in __mtk_foe_entry_clear()
539 kfree(entry); in __mtk_foe_entry_clear()
555 mtk_flow_entry_update_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_flow_entry_update_l2() argument
563 idle = __mtk_foe_entry_idle_time(ppe, entry->data.ib1); in mtk_flow_entry_update_l2()
564 hlist_for_each_entry_safe(cur, tmp, &entry->l2_flows, l2_data.list) { in mtk_flow_entry_update_l2()
582 entry->data.ib1 &= ~ib1_ts_mask; in mtk_flow_entry_update_l2()
583 entry->data.ib1 |= ib1 & ib1_ts_mask; in mtk_flow_entry_update_l2()
588 mtk_flow_entry_update(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_flow_entry_update() argument
595 if (entry->type == MTK_FLOW_TYPE_L2) { in mtk_flow_entry_update()
596 mtk_flow_entry_update_l2(ppe, entry); in mtk_flow_entry_update()
600 if (entry->hash == 0xffff) in mtk_flow_entry_update()
603 hwe = mtk_foe_get_entry(ppe, entry->hash); in mtk_flow_entry_update()
605 if (!mtk_flow_entry_match(ppe->eth, entry, &foe)) { in mtk_flow_entry_update()
606 entry->hash = 0xffff; in mtk_flow_entry_update()
610 entry->data.ib1 = foe.ib1; in mtk_flow_entry_update()
617 __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, in __mtk_foe_entry_commit() argument
626 entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2; in __mtk_foe_entry_commit()
627 entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP_V2, in __mtk_foe_entry_commit()
630 entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP; in __mtk_foe_entry_commit()
631 entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP, in __mtk_foe_entry_commit()
636 memcpy(&hwe->data, &entry->data, eth->soc->foe_entry_size - sizeof(hwe->ib1)); in __mtk_foe_entry_commit()
638 hwe->ib1 = entry->ib1; in __mtk_foe_entry_commit()
653 void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_clear() argument
656 __mtk_foe_entry_clear(ppe, entry); in mtk_foe_entry_clear()
661 mtk_foe_entry_commit_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_commit_l2() argument
665 entry->type = MTK_FLOW_TYPE_L2; in mtk_foe_entry_commit_l2()
667 prev = rhashtable_lookup_get_insert_fast(&ppe->l2_flows, &entry->l2_node, in mtk_foe_entry_commit_l2()
676 &entry->l2_node, mtk_flow_l2_ht_params); in mtk_foe_entry_commit_l2()
679 int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_commit() argument
682 int type = mtk_get_ib1_pkt_type(ppe->eth, entry->data.ib1); in mtk_foe_entry_commit()
686 return mtk_foe_entry_commit_l2(ppe, entry); in mtk_foe_entry_commit()
688 hash = mtk_ppe_hash_entry(ppe->eth, &entry->data); in mtk_foe_entry_commit()
689 entry->hash = 0xffff; in mtk_foe_entry_commit()
691 hlist_add_head(&entry->list, &ppe->foe_flow[hash / soc->hash_offset]); in mtk_foe_entry_commit()
698 mtk_foe_entry_commit_subflow(struct mtk_ppe *ppe, struct mtk_flow_entry *entry, in mtk_foe_entry_commit_subflow() argument
712 flow_info->l2_data.base_flow = entry; in mtk_foe_entry_commit_subflow()
717 hlist_add_head(&flow_info->l2_data.list, &entry->l2_flows); in mtk_foe_entry_commit_subflow()
722 foe.ib1 |= entry->data.ib1 & ~ib1_mask; in mtk_foe_entry_commit_subflow()
725 memcpy(l2, &entry->data.bridge.l2, sizeof(*l2)); in mtk_foe_entry_commit_subflow()
733 *mtk_foe_entry_ib2(ppe->eth, &foe) = entry->data.bridge.ib2; in mtk_foe_entry_commit_subflow()
743 struct mtk_flow_entry *entry; in __mtk_ppe_check_skb() local
755 hlist_for_each_entry_safe(entry, n, head, list) { in __mtk_ppe_check_skb()
756 if (entry->type == MTK_FLOW_TYPE_L2_SUBFLOW) { in __mtk_ppe_check_skb()
761 entry->hash = 0xffff; in __mtk_ppe_check_skb()
762 __mtk_foe_entry_clear(ppe, entry); in __mtk_ppe_check_skb()
766 if (found || !mtk_flow_entry_match(ppe->eth, entry, hwe)) { in __mtk_ppe_check_skb()
767 if (entry->hash != 0xffff) in __mtk_ppe_check_skb()
768 entry->hash = 0xffff; in __mtk_ppe_check_skb()
772 entry->hash = hash; in __mtk_ppe_check_skb()
773 __mtk_foe_entry_commit(ppe, &entry->data, hash); in __mtk_ppe_check_skb()
807 entry = rhashtable_lookup_fast(&ppe->l2_flows, &key, mtk_flow_l2_ht_params); in __mtk_ppe_check_skb()
808 if (!entry) in __mtk_ppe_check_skb()
811 mtk_foe_entry_commit_subflow(ppe, entry, hash); in __mtk_ppe_check_skb()
817 int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_idle_time() argument
819 mtk_flow_entry_update(ppe, entry); in mtk_foe_entry_idle_time()
821 return __mtk_foe_entry_idle_time(ppe, entry->data.ib1); in mtk_foe_entry_idle_time()