Lines Matching refs:eth

58 static u32 mtk_eth_timestamp(struct mtk_eth *eth)
60 return mtk_r32(eth, 0x0010) & mtk_get_ib1_ts_mask(eth);
109 if (mtk_is_netsys_v3_or_greater(ppe->eth)) {
141 static u32 mtk_ppe_hash_entry(struct mtk_eth *eth, struct mtk_foe_entry *e)
146 switch (mtk_get_ib1_pkt_type(eth, e->ib1)) {
175 hash <<= (ffs(eth->soc->hash_offset) - 1);
182 mtk_foe_entry_l2(struct mtk_eth *eth, struct mtk_foe_entry *entry)
184 int type = mtk_get_ib1_pkt_type(eth, entry->ib1);
196 mtk_foe_entry_ib2(struct mtk_eth *eth, struct mtk_foe_entry *entry)
198 int type = mtk_get_ib1_pkt_type(eth, entry->ib1);
209 int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry,
218 if (mtk_is_netsys_v2_or_greater(eth)) {
228 int port_mg = eth->soc->offload_version > 1 ? 0 : 0x3f;
242 val |= mtk_get_ib2_multicast_mask(eth);
276 int mtk_foe_entry_set_pse_port(struct mtk_eth *eth,
279 u32 *ib2 = mtk_foe_entry_ib2(eth, entry);
282 if (mtk_is_netsys_v2_or_greater(eth)) {
294 int mtk_foe_entry_set_ipv4_tuple(struct mtk_eth *eth,
299 int type = mtk_get_ib1_pkt_type(eth, entry->ib1);
334 int mtk_foe_entry_set_ipv6_tuple(struct mtk_eth *eth,
339 int type = mtk_get_ib1_pkt_type(eth, entry->ib1);
370 int mtk_foe_entry_set_dsa(struct mtk_eth *eth, struct mtk_foe_entry *entry,
373 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry);
377 if (!(entry->ib1 & mtk_get_ib1_vlan_layer_mask(eth)))
378 entry->ib1 |= mtk_prep_ib1_vlan_layer(eth, 1);
382 entry->ib1 &= ~mtk_get_ib1_vlan_tag_mask(eth);
387 int mtk_foe_entry_set_vlan(struct mtk_eth *eth, struct mtk_foe_entry *entry,
390 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry);
392 switch (mtk_get_ib1_vlan_layer(eth, entry->ib1)) {
394 entry->ib1 |= mtk_get_ib1_vlan_tag_mask(eth) |
395 mtk_prep_ib1_vlan_layer(eth, 1);
399 if (!(entry->ib1 & mtk_get_ib1_vlan_tag_mask(eth))) {
404 entry->ib1 += mtk_prep_ib1_vlan_layer(eth, 1);
412 int mtk_foe_entry_set_pppoe(struct mtk_eth *eth, struct mtk_foe_entry *entry,
415 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry);
417 if (!(entry->ib1 & mtk_get_ib1_vlan_layer_mask(eth)) ||
418 (entry->ib1 & mtk_get_ib1_vlan_tag_mask(eth)))
421 entry->ib1 |= mtk_get_ib1_ppoe_mask(eth);
427 int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
430 struct mtk_foe_mac_info *l2 = mtk_foe_entry_l2(eth, entry);
431 u32 *ib2 = mtk_foe_entry_ib2(eth, entry);
433 switch (eth->soc->version) {
462 int mtk_foe_entry_set_queue(struct mtk_eth *eth, struct mtk_foe_entry *entry,
465 u32 *ib2 = mtk_foe_entry_ib2(eth, entry);
467 if (mtk_is_netsys_v2_or_greater(eth)) {
481 mtk_flow_entry_match(struct mtk_eth *eth, struct mtk_flow_entry *entry,
489 type = mtk_get_ib1_pkt_type(eth, entry->data.ib1);
542 u32 ib1_ts_mask = mtk_get_ib1_ts_mask(ppe->eth);
543 u16 now = mtk_eth_timestamp(ppe->eth);
555 u32 ib1_ts_mask = mtk_get_ib1_ts_mask(ppe->eth);
602 memcpy(&foe, hwe, ppe->eth->soc->foe_entry_size);
603 if (!mtk_flow_entry_match(ppe->eth, entry, &foe)) {
618 struct mtk_eth *eth = ppe->eth;
619 u16 timestamp = mtk_eth_timestamp(eth);
623 if (mtk_is_netsys_v2_or_greater(eth)) {
634 memcpy(&hwe->data, &entry->data, eth->soc->foe_entry_size - sizeof(hwe->ib1));
639 if (mtk_is_netsys_v2_or_greater(eth))
643 *mtk_foe_entry_ib2(eth, hwe) |= val;
679 const struct mtk_soc_data *soc = ppe->eth->soc;
680 int type = mtk_get_ib1_pkt_type(ppe->eth, entry->data.ib1);
686 hash = mtk_ppe_hash_entry(ppe->eth, &entry->data);
699 const struct mtk_soc_data *soc = ppe->eth->soc;
703 u32 ib1_mask = mtk_get_ib1_pkt_type_mask(ppe->eth) | MTK_FOE_IB1_UDP;
722 l2 = mtk_foe_entry_l2(ppe->eth, &foe);
725 type = mtk_get_ib1_pkt_type(ppe->eth, foe.ib1);
731 *mtk_foe_entry_ib2(ppe->eth, &foe) = entry->data.bridge.ib2;
738 const struct mtk_soc_data *soc = ppe->eth->soc;
764 if (found || !mtk_flow_entry_match(ppe->eth, entry, hwe)) {
875 struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int index)
877 bool accounting = eth->soc->has_accounting;
878 const struct mtk_soc_data *soc = eth->soc;
880 struct device *dev = eth->dev;
896 ppe->eth = eth;
898 ppe->version = eth->soc->offload_version;
941 void mtk_ppe_deinit(struct mtk_eth *eth)
945 for (i = 0; i < ARRAY_SIZE(eth->ppe); i++) {
946 if (!eth->ppe[i])
948 rhashtable_destroy(&eth->ppe[i]->l2_flows);
958 MTK_PPE_ENTRIES * ppe->eth->soc->foe_entry_size);
998 if (mtk_is_netsys_v2_or_greater(ppe->eth))
1000 if (!mtk_is_netsys_v3_or_greater(ppe->eth))
1016 if (mtk_is_netsys_v2_or_greater(ppe->eth))
1058 if (mtk_is_netsys_v2_or_greater(ppe->eth)) {