Lines Matching full:entry
132 mtk_foe_entry_l2(struct mtk_eth *eth, struct mtk_foe_entry *entry) in mtk_foe_entry_l2() argument
134 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_l2()
137 return &entry->bridge.l2; in mtk_foe_entry_l2()
140 return &entry->ipv6.l2; in mtk_foe_entry_l2()
142 return &entry->ipv4.l2; in mtk_foe_entry_l2()
146 mtk_foe_entry_ib2(struct mtk_eth *eth, struct mtk_foe_entry *entry) in mtk_foe_entry_ib2() argument
148 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_ib2()
151 return &entry->bridge.ib2; in mtk_foe_entry_ib2()
154 return &entry->ipv6.ib2; in mtk_foe_entry_ib2()
156 return &entry->ipv4.ib2; in mtk_foe_entry_ib2()
159 int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_prepare() argument
166 memset(entry, 0, sizeof(*entry)); in mtk_foe_entry_prepare()
173 entry->ib1 = val; in mtk_foe_entry_prepare()
182 entry->ib1 = val; in mtk_foe_entry_prepare()
194 entry->ipv4.orig.ports = ports_pad; in mtk_foe_entry_prepare()
196 entry->ipv6.ports = ports_pad; in mtk_foe_entry_prepare()
199 ether_addr_copy(entry->bridge.src_mac, src_mac); in mtk_foe_entry_prepare()
200 ether_addr_copy(entry->bridge.dest_mac, dest_mac); in mtk_foe_entry_prepare()
201 entry->bridge.ib2 = val; in mtk_foe_entry_prepare()
202 l2 = &entry->bridge.l2; in mtk_foe_entry_prepare()
204 entry->ipv6.ib2 = val; in mtk_foe_entry_prepare()
205 l2 = &entry->ipv6.l2; in mtk_foe_entry_prepare()
207 entry->ipv4.ib2 = val; in mtk_foe_entry_prepare()
208 l2 = &entry->ipv4.l2; in mtk_foe_entry_prepare()
225 struct mtk_foe_entry *entry, u8 port) in mtk_foe_entry_set_pse_port() argument
227 u32 *ib2 = mtk_foe_entry_ib2(eth, entry); in mtk_foe_entry_set_pse_port()
243 struct mtk_foe_entry *entry, bool egress, in mtk_foe_entry_set_ipv4_tuple() argument
247 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_set_ipv4_tuple()
253 t = &entry->ipv4.new; in mtk_foe_entry_set_ipv4_tuple()
259 t = &entry->ipv4.orig; in mtk_foe_entry_set_ipv4_tuple()
262 entry->ipv6_6rd.tunnel_src_ip = be32_to_cpu(src_addr); in mtk_foe_entry_set_ipv4_tuple()
263 entry->ipv6_6rd.tunnel_dest_ip = be32_to_cpu(dest_addr); in mtk_foe_entry_set_ipv4_tuple()
283 struct mtk_foe_entry *entry, in mtk_foe_entry_set_ipv6_tuple() argument
287 int type = mtk_get_ib1_pkt_type(eth, entry->ib1); in mtk_foe_entry_set_ipv6_tuple()
293 src = entry->dslite.tunnel_src_ip; in mtk_foe_entry_set_ipv6_tuple()
294 dest = entry->dslite.tunnel_dest_ip; in mtk_foe_entry_set_ipv6_tuple()
298 entry->ipv6.src_port = be16_to_cpu(src_port); in mtk_foe_entry_set_ipv6_tuple()
299 entry->ipv6.dest_port = be16_to_cpu(dest_port); in mtk_foe_entry_set_ipv6_tuple()
302 src = entry->ipv6.src_ip; in mtk_foe_entry_set_ipv6_tuple()
303 dest = entry->ipv6.dest_ip; in mtk_foe_entry_set_ipv6_tuple()
318 int mtk_foe_entry_set_dsa(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_dsa() argument
321 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_dsa()
325 if (!(entry->ib1 & mtk_get_ib1_vlan_layer_mask(eth))) in mtk_foe_entry_set_dsa()
326 entry->ib1 |= mtk_prep_ib1_vlan_layer(eth, 1); in mtk_foe_entry_set_dsa()
330 entry->ib1 &= ~mtk_get_ib1_vlan_tag_mask(eth); in mtk_foe_entry_set_dsa()
335 int mtk_foe_entry_set_vlan(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_vlan() argument
338 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_vlan()
340 switch (mtk_get_ib1_vlan_layer(eth, entry->ib1)) { in mtk_foe_entry_set_vlan()
342 entry->ib1 |= mtk_get_ib1_vlan_tag_mask(eth) | in mtk_foe_entry_set_vlan()
347 if (!(entry->ib1 & mtk_get_ib1_vlan_tag_mask(eth))) { in mtk_foe_entry_set_vlan()
352 entry->ib1 += mtk_prep_ib1_vlan_layer(eth, 1); in mtk_foe_entry_set_vlan()
360 int mtk_foe_entry_set_pppoe(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_pppoe() argument
363 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_pppoe()
365 if (!(entry->ib1 & mtk_get_ib1_vlan_layer_mask(eth)) || in mtk_foe_entry_set_pppoe()
366 (entry->ib1 & mtk_get_ib1_vlan_tag_mask(eth))) in mtk_foe_entry_set_pppoe()
369 entry->ib1 |= mtk_get_ib1_ppoe_mask(eth); in mtk_foe_entry_set_pppoe()
375 int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry, in mtk_foe_entry_set_wdma() argument
378 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry); in mtk_foe_entry_set_wdma()
379 u32 *ib2 = mtk_foe_entry_ib2(eth, entry); in mtk_foe_entry_set_wdma()
401 mtk_flow_entry_match(struct mtk_eth *eth, struct mtk_flow_entry *entry, in mtk_flow_entry_match() argument
406 if ((data->ib1 ^ entry->data.ib1) & MTK_FOE_IB1_UDP) in mtk_flow_entry_match()
409 type = mtk_get_ib1_pkt_type(eth, entry->data.ib1); in mtk_flow_entry_match()
415 return !memcmp(&entry->data.data, &data->data, len - 4); in mtk_flow_entry_match()
419 __mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in __mtk_foe_entry_clear() argument
424 if (entry->type == MTK_FLOW_TYPE_L2) { in __mtk_foe_entry_clear()
425 rhashtable_remove_fast(&ppe->l2_flows, &entry->l2_node, in __mtk_foe_entry_clear()
428 head = &entry->l2_flows; in __mtk_foe_entry_clear()
429 hlist_for_each_entry_safe(entry, tmp, head, l2_data.list) in __mtk_foe_entry_clear()
430 __mtk_foe_entry_clear(ppe, entry); in __mtk_foe_entry_clear()
434 hlist_del_init(&entry->list); in __mtk_foe_entry_clear()
435 if (entry->hash != 0xffff) { in __mtk_foe_entry_clear()
436 struct mtk_foe_entry *hwe = mtk_foe_get_entry(ppe, entry->hash); in __mtk_foe_entry_clear()
442 entry->hash = 0xffff; in __mtk_foe_entry_clear()
444 if (entry->type != MTK_FLOW_TYPE_L2_SUBFLOW) in __mtk_foe_entry_clear()
447 hlist_del_init(&entry->l2_data.list); in __mtk_foe_entry_clear()
448 kfree(entry); in __mtk_foe_entry_clear()
464 mtk_flow_entry_update_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_flow_entry_update_l2() argument
472 idle = __mtk_foe_entry_idle_time(ppe, entry->data.ib1); in mtk_flow_entry_update_l2()
473 hlist_for_each_entry_safe(cur, tmp, &entry->l2_flows, l2_data.list) { in mtk_flow_entry_update_l2()
491 entry->data.ib1 &= ~ib1_ts_mask; in mtk_flow_entry_update_l2()
492 entry->data.ib1 |= hwe->ib1 & ib1_ts_mask; in mtk_flow_entry_update_l2()
497 mtk_flow_entry_update(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_flow_entry_update() argument
504 if (entry->type == MTK_FLOW_TYPE_L2) { in mtk_flow_entry_update()
505 mtk_flow_entry_update_l2(ppe, entry); in mtk_flow_entry_update()
509 if (entry->hash == 0xffff) in mtk_flow_entry_update()
512 hwe = mtk_foe_get_entry(ppe, entry->hash); in mtk_flow_entry_update()
514 if (!mtk_flow_entry_match(ppe->eth, entry, &foe)) { in mtk_flow_entry_update()
515 entry->hash = 0xffff; in mtk_flow_entry_update()
519 entry->data.ib1 = foe.ib1; in mtk_flow_entry_update()
526 __mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_foe_entry *entry, in __mtk_foe_entry_commit() argument
534 entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP_V2; in __mtk_foe_entry_commit()
535 entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP_V2, in __mtk_foe_entry_commit()
538 entry->ib1 &= ~MTK_FOE_IB1_BIND_TIMESTAMP; in __mtk_foe_entry_commit()
539 entry->ib1 |= FIELD_PREP(MTK_FOE_IB1_BIND_TIMESTAMP, in __mtk_foe_entry_commit()
544 memcpy(&hwe->data, &entry->data, eth->soc->foe_entry_size - sizeof(hwe->ib1)); in __mtk_foe_entry_commit()
546 hwe->ib1 = entry->ib1; in __mtk_foe_entry_commit()
553 void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_clear() argument
556 __mtk_foe_entry_clear(ppe, entry); in mtk_foe_entry_clear()
561 mtk_foe_entry_commit_l2(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_commit_l2() argument
563 entry->type = MTK_FLOW_TYPE_L2; in mtk_foe_entry_commit_l2()
565 return rhashtable_insert_fast(&ppe->l2_flows, &entry->l2_node, in mtk_foe_entry_commit_l2()
569 int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_commit() argument
572 int type = mtk_get_ib1_pkt_type(ppe->eth, entry->data.ib1); in mtk_foe_entry_commit()
576 return mtk_foe_entry_commit_l2(ppe, entry); in mtk_foe_entry_commit()
578 hash = mtk_ppe_hash_entry(ppe->eth, &entry->data); in mtk_foe_entry_commit()
579 entry->hash = 0xffff; in mtk_foe_entry_commit()
581 hlist_add_head(&entry->list, &ppe->foe_flow[hash / soc->hash_offset]); in mtk_foe_entry_commit()
588 mtk_foe_entry_commit_subflow(struct mtk_ppe *ppe, struct mtk_flow_entry *entry, in mtk_foe_entry_commit_subflow() argument
603 flow_info->l2_data.base_flow = entry; in mtk_foe_entry_commit_subflow()
608 hlist_add_head(&flow_info->l2_data.list, &entry->l2_flows); in mtk_foe_entry_commit_subflow()
613 foe.ib1 |= entry->data.ib1 & ~ib1_mask; in mtk_foe_entry_commit_subflow()
616 memcpy(l2, &entry->data.bridge.l2, sizeof(*l2)); in mtk_foe_entry_commit_subflow()
624 *mtk_foe_entry_ib2(ppe->eth, &foe) = entry->data.bridge.ib2; in mtk_foe_entry_commit_subflow()
634 struct mtk_flow_entry *entry; in __mtk_ppe_check_skb() local
646 hlist_for_each_entry_safe(entry, n, head, list) { in __mtk_ppe_check_skb()
647 if (entry->type == MTK_FLOW_TYPE_L2_SUBFLOW) { in __mtk_ppe_check_skb()
652 entry->hash = 0xffff; in __mtk_ppe_check_skb()
653 __mtk_foe_entry_clear(ppe, entry); in __mtk_ppe_check_skb()
657 if (found || !mtk_flow_entry_match(ppe->eth, entry, hwe)) { in __mtk_ppe_check_skb()
658 if (entry->hash != 0xffff) in __mtk_ppe_check_skb()
659 entry->hash = 0xffff; in __mtk_ppe_check_skb()
663 entry->hash = hash; in __mtk_ppe_check_skb()
664 __mtk_foe_entry_commit(ppe, &entry->data, hash); in __mtk_ppe_check_skb()
696 entry = rhashtable_lookup_fast(&ppe->l2_flows, &key, mtk_flow_l2_ht_params); in __mtk_ppe_check_skb()
697 if (!entry) in __mtk_ppe_check_skb()
700 mtk_foe_entry_commit_subflow(ppe, entry, hash); in __mtk_ppe_check_skb()
706 int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry) in mtk_foe_entry_idle_time() argument
708 mtk_flow_entry_update(ppe, entry); in mtk_foe_entry_idle_time()
710 return __mtk_foe_entry_idle_time(ppe, entry->data.ib1); in mtk_foe_entry_idle_time()