linux/drivers/net/ethernet/mediatek/mtk_ppe.h

// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (C) 2020 Felix Fietkau <[email protected]> */

#ifndef __MTK_PPE_H
#define __MTK_PPE_H

#include <linux/kernel.h>
#include <linux/bitfield.h>
#include <linux/rhashtable.h>

#define MTK_PPE_ENTRIES_SHIFT
#define MTK_PPE_ENTRIES
#define MTK_PPE_HASH_MASK
#define MTK_PPE_WAIT_TIMEOUT_US

#define MTK_FOE_IB1_UNBIND_TIMESTAMP
#define MTK_FOE_IB1_UNBIND_PACKETS
#define MTK_FOE_IB1_UNBIND_PREBIND

#define MTK_FOE_IB1_BIND_TIMESTAMP
#define MTK_FOE_IB1_BIND_KEEPALIVE
#define MTK_FOE_IB1_BIND_VLAN_LAYER
#define MTK_FOE_IB1_BIND_PPPOE
#define MTK_FOE_IB1_BIND_VLAN_TAG
#define MTK_FOE_IB1_BIND_PKT_SAMPLE
#define MTK_FOE_IB1_BIND_CACHE
#define MTK_FOE_IB1_BIND_TUNNEL_DECAP
#define MTK_FOE_IB1_BIND_TTL

#define MTK_FOE_IB1_PACKET_TYPE
#define MTK_FOE_IB1_STATE
#define MTK_FOE_IB1_UDP
#define MTK_FOE_IB1_STATIC

/* CONFIG_MEDIATEK_NETSYS_V2 */
#define MTK_FOE_IB1_BIND_TIMESTAMP_V2
#define MTK_FOE_IB1_BIND_VLAN_LAYER_V2
#define MTK_FOE_IB1_BIND_PPPOE_V2
#define MTK_FOE_IB1_BIND_VLAN_TAG_V2
#define MTK_FOE_IB1_BIND_CACHE_V2
#define MTK_FOE_IB1_BIND_TTL_V2
#define MTK_FOE_IB1_PACKET_TYPE_V2

enum {};

#define MTK_FOE_IB2_QID
#define MTK_FOE_IB2_PSE_QOS
#define MTK_FOE_IB2_DEST_PORT
#define MTK_FOE_IB2_MULTICAST
#define MTK_FOE_IB2_MIB_CNT

#define MTK_FOE_IB2_WDMA_QID2
#define MTK_FOE_IB2_MIB_CNT_V2
#define MTK_FOE_IB2_WDMA_DEVIDX
#define MTK_FOE_IB2_WDMA_WINFO

#define MTK_FOE_IB2_PORT_MG

#define MTK_FOE_IB2_RX_IDX
#define MTK_FOE_IB2_PORT_AG

#define MTK_FOE_IB2_DSCP

/* CONFIG_MEDIATEK_NETSYS_V2 */
#define MTK_FOE_IB2_QID_V2
#define MTK_FOE_IB2_PORT_MG_V2
#define MTK_FOE_IB2_PSE_QOS_V2
#define MTK_FOE_IB2_DEST_PORT_V2
#define MTK_FOE_IB2_MULTICAST_V2
#define MTK_FOE_IB2_WDMA_WINFO_V2
#define MTK_FOE_IB2_PORT_AG_V2

#define MTK_FOE_VLAN2_WINFO_BSS
#define MTK_FOE_VLAN2_WINFO_WCID
#define MTK_FOE_VLAN2_WINFO_RING

#define MTK_FOE_WINFO_BSS
#define MTK_FOE_WINFO_WCID

#define MTK_FOE_WINFO_BSS_V3
#define MTK_FOE_WINFO_WCID_V3

#define MTK_FOE_WINFO_AMSDU_USR_INFO
#define MTK_FOE_WINFO_AMSDU_TID
#define MTK_FOE_WINFO_AMSDU_IS_FIXEDRATE
#define MTK_FOE_WINFO_AMSDU_IS_PRIOR
#define MTK_FOE_WINFO_AMSDU_IS_SP
#define MTK_FOE_WINFO_AMSDU_HF
#define MTK_FOE_WINFO_AMSDU_EN

enum {};

struct mtk_foe_mac_info {};

/* software-only entry type */
struct mtk_foe_bridge {};

struct mtk_ipv4_tuple {};

struct mtk_foe_ipv4 {};

struct mtk_foe_ipv4_dslite {};

struct mtk_foe_ipv6 {};

struct mtk_foe_ipv6_6rd {};

#define MTK_FOE_ENTRY_V1_SIZE
#define MTK_FOE_ENTRY_V2_SIZE
#define MTK_FOE_ENTRY_V3_SIZE

struct mtk_foe_entry {};

enum {};

enum {};

struct mtk_flow_entry {};

struct mtk_mib_entry {} __packed;

struct mtk_foe_accounting {};

struct mtk_ppe {};

struct mtk_ppe *mtk_ppe_init(struct mtk_eth *eth, void __iomem *base, int index);

void mtk_ppe_deinit(struct mtk_eth *eth);
void mtk_ppe_start(struct mtk_ppe *ppe);
int mtk_ppe_stop(struct mtk_ppe *ppe);
int mtk_ppe_prepare_reset(struct mtk_ppe *ppe);

void __mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash);

static inline void
mtk_ppe_check_skb(struct mtk_ppe *ppe, struct sk_buff *skb, u16 hash)
{}

int mtk_foe_entry_prepare(struct mtk_eth *eth, struct mtk_foe_entry *entry,
			  int type, int l4proto, u8 pse_port, u8 *src_mac,
			  u8 *dest_mac);
int mtk_foe_entry_set_pse_port(struct mtk_eth *eth,
			       struct mtk_foe_entry *entry, u8 port);
int mtk_foe_entry_set_ipv4_tuple(struct mtk_eth *eth,
				 struct mtk_foe_entry *entry, bool orig,
				 __be32 src_addr, __be16 src_port,
				 __be32 dest_addr, __be16 dest_port);
int mtk_foe_entry_set_ipv6_tuple(struct mtk_eth *eth,
				 struct mtk_foe_entry *entry,
				 __be32 *src_addr, __be16 src_port,
				 __be32 *dest_addr, __be16 dest_port);
int mtk_foe_entry_set_dsa(struct mtk_eth *eth, struct mtk_foe_entry *entry,
			  int port);
int mtk_foe_entry_set_vlan(struct mtk_eth *eth, struct mtk_foe_entry *entry,
			   int vid);
int mtk_foe_entry_set_pppoe(struct mtk_eth *eth, struct mtk_foe_entry *entry,
			    int sid);
int mtk_foe_entry_set_wdma(struct mtk_eth *eth, struct mtk_foe_entry *entry,
			   int wdma_idx, int txq, int bss, int wcid,
			   bool amsdu_en);
int mtk_foe_entry_set_queue(struct mtk_eth *eth, struct mtk_foe_entry *entry,
			    unsigned int queue);
int mtk_foe_entry_commit(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
void mtk_foe_entry_clear(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
int mtk_foe_entry_idle_time(struct mtk_ppe *ppe, struct mtk_flow_entry *entry);
int mtk_ppe_debugfs_init(struct mtk_ppe *ppe, int index);
struct mtk_foe_accounting *mtk_foe_entry_get_mib(struct mtk_ppe *ppe, u32 index,
						 struct mtk_foe_accounting *diff);

#endif