linux/include/soc/mscc/ocelot_vcap.h

/* SPDX-License-Identifier: (GPL-2.0 OR MIT)
 * Microsemi Ocelot Switch driver
 * Copyright (c) 2019 Microsemi Corporation
 */

#ifndef _OCELOT_VCAP_H_
#define _OCELOT_VCAP_H_

#include <soc/mscc/ocelot.h>

/* Cookie definitions for private VCAP filters installed by the driver.
 * Must be unique per VCAP block.
 */
#define OCELOT_VCAP_ES0_TAG_8021Q_RXVLAN(ocelot, port, upstream)
#define OCELOT_VCAP_IS1_TAG_8021Q_TXVLAN(ocelot, port)
#define OCELOT_VCAP_IS2_TAG_8021Q_TXVLAN(ocelot, port)
#define OCELOT_VCAP_IS2_MRP_REDIRECT(ocelot, port)
#define OCELOT_VCAP_IS2_MRP_TRAP(ocelot)
#define OCELOT_VCAP_IS2_L2_PTP_TRAP(ocelot)
#define OCELOT_VCAP_IS2_IPV4_GEN_PTP_TRAP(ocelot)
#define OCELOT_VCAP_IS2_IPV4_EV_PTP_TRAP(ocelot)
#define OCELOT_VCAP_IS2_IPV6_GEN_PTP_TRAP(ocelot)
#define OCELOT_VCAP_IS2_IPV6_EV_PTP_TRAP(ocelot)

/* =================================================================
 *  VCAP Common
 * =================================================================
 */

enum {};

#define OCELOT_NUM_VCAP_BLOCKS

struct vcap_props {};

/* VCAP Type-Group values */
#define VCAP_TG_NONE
#define VCAP_TG_FULL
#define VCAP_TG_HALF
#define VCAP_TG_QUARTER

#define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD(x)
#define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_M
#define VCAP_CORE_UPDATE_CTRL_UPDATE_CMD_X(x)
#define VCAP_CORE_UPDATE_CTRL_UPDATE_ENTRY_DIS
#define VCAP_CORE_UPDATE_CTRL_UPDATE_ACTION_DIS
#define VCAP_CORE_UPDATE_CTRL_UPDATE_CNT_DIS
#define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR(x)
#define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_M
#define VCAP_CORE_UPDATE_CTRL_UPDATE_ADDR_X(x)
#define VCAP_CORE_UPDATE_CTRL_UPDATE_SHOT
#define VCAP_CORE_UPDATE_CTRL_CLEAR_CACHE
#define VCAP_CORE_UPDATE_CTRL_MV_TRAFFIC_IGN

#define VCAP_CORE_MV_CFG_MV_NUM_POS(x)
#define VCAP_CORE_MV_CFG_MV_NUM_POS_M
#define VCAP_CORE_MV_CFG_MV_NUM_POS_X(x)
#define VCAP_CORE_MV_CFG_MV_SIZE(x)
#define VCAP_CORE_MV_CFG_MV_SIZE_M

#define VCAP_CACHE_ENTRY_DAT_RSZ

#define VCAP_CACHE_MASK_DAT_RSZ

#define VCAP_CACHE_ACTION_DAT_RSZ

#define VCAP_CACHE_CNT_DAT_RSZ

#define VCAP_STICKY_VCAP_ROW_DELETED_STICKY

#define TCAM_BIST_CTRL_TCAM_BIST
#define TCAM_BIST_CTRL_TCAM_INIT

#define TCAM_BIST_CFG_TCAM_BIST_SOE_ENA
#define TCAM_BIST_CFG_TCAM_HCG_DIS
#define TCAM_BIST_CFG_TCAM_CG_DIS
#define TCAM_BIST_CFG_TCAM_BIAS(x)
#define TCAM_BIST_CFG_TCAM_BIAS_M

#define TCAM_BIST_STAT_BIST_RT_ERR
#define TCAM_BIST_STAT_BIST_PENC_ERR
#define TCAM_BIST_STAT_BIST_COMP_ERR
#define TCAM_BIST_STAT_BIST_ADDR_ERR
#define TCAM_BIST_STAT_BIST_BL1E_ERR
#define TCAM_BIST_STAT_BIST_BL1_ERR
#define TCAM_BIST_STAT_BIST_BL0E_ERR
#define TCAM_BIST_STAT_BIST_BL0_ERR
#define TCAM_BIST_STAT_BIST_PH1_ERR
#define TCAM_BIST_STAT_BIST_PH0_ERR
#define TCAM_BIST_STAT_BIST_PV1_ERR
#define TCAM_BIST_STAT_BIST_PV0_ERR
#define TCAM_BIST_STAT_BIST_RUN
#define TCAM_BIST_STAT_BIST_ERR
#define TCAM_BIST_STAT_BIST_BUSY
#define TCAM_BIST_STAT_TCAM_RDY

/* =================================================================
 *  VCAP IS2
 * =================================================================
 */

/* IS2 half key types */
#define IS2_TYPE_ETYPE
#define IS2_TYPE_LLC
#define IS2_TYPE_SNAP
#define IS2_TYPE_ARP
#define IS2_TYPE_IP_UDP_TCP
#define IS2_TYPE_IP_OTHER
#define IS2_TYPE_IPV6
#define IS2_TYPE_OAM
#define IS2_TYPE_SMAC_SIP6
#define IS2_TYPE_ANY

/* IS2 half key type mask for matching any IP */
#define IS2_TYPE_MASK_IP_ANY

enum {};

/* IS2 MASK_MODE values */
#define IS2_ACT_MASK_MODE_NONE
#define IS2_ACT_MASK_MODE_FILTER
#define IS2_ACT_MASK_MODE_POLICY
#define IS2_ACT_MASK_MODE_REDIR

/* IS2 REW_OP values */
#define IS2_ACT_REW_OP_NONE
#define IS2_ACT_REW_OP_PTP_ONE
#define IS2_ACT_REW_OP_PTP_TWO
#define IS2_ACT_REW_OP_SPECIAL
#define IS2_ACT_REW_OP_PTP_ORG
#define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_1
#define IS2_ACT_REW_OP_PTP_ONE_SUB_DELAY_2
#define IS2_ACT_REW_OP_PTP_ONE_ADD_DELAY
#define IS2_ACT_REW_OP_PTP_ONE_ADD_SUB

#define VCAP_PORT_WIDTH

/* IS2 quarter key - SMAC_SIP4 */
#define IS2_QKO_IGR_PORT
#define IS2_QKL_IGR_PORT
#define IS2_QKO_L2_SMAC
#define IS2_QKL_L2_SMAC
#define IS2_QKO_L3_IP4_SIP
#define IS2_QKL_L3_IP4_SIP

enum vcap_is2_half_key_field {};

struct vcap_field {};

enum vcap_is2_action_field {};

/* =================================================================
 *  VCAP IS1
 * =================================================================
 */

/* IS1 half key types */
#define IS1_TYPE_S1_NORMAL
#define IS1_TYPE_S1_5TUPLE_IP4

/* IS1 full key types */
#define IS1_TYPE_S1_NORMAL_IP6
#define IS1_TYPE_S1_7TUPLE
#define IS2_TYPE_S1_5TUPLE_IP6

enum {};

enum vcap_is1_half_key_field {};

enum vcap_is1_action_field {};

/* =================================================================
 *  VCAP ES0
 * =================================================================
 */

enum {};

enum vcap_es0_key_field {};

enum vcap_es0_action_field {};

struct ocelot_ipv4 {};

enum ocelot_vcap_bit {};

struct ocelot_vcap_u8 {};

struct ocelot_vcap_u16 {};

struct ocelot_vcap_u24 {};

struct ocelot_vcap_u32 {};

struct ocelot_vcap_u40 {};

struct ocelot_vcap_u48 {};

struct ocelot_vcap_u64 {};

struct ocelot_vcap_u128 {};

struct ocelot_vcap_vid {};

struct ocelot_vcap_ipv4 {};

struct ocelot_vcap_udp_tcp {};

struct ocelot_vcap_port {};

enum ocelot_vcap_key_type {};

struct ocelot_vcap_key_vlan {};

struct ocelot_vcap_key_etype {};

struct ocelot_vcap_key_llc {};

struct ocelot_vcap_key_snap {};

struct ocelot_vcap_key_arp {};

struct ocelot_vcap_key_ipv4 {};

struct ocelot_vcap_key_ipv6 {};

enum ocelot_mask_mode {};

enum ocelot_es0_vid_sel {};

enum ocelot_es0_pcp_sel {};

enum ocelot_es0_tag {};

enum ocelot_tag_tpid_sel {};

struct ocelot_vcap_action {};

struct ocelot_vcap_stats {};

enum ocelot_vcap_filter_type {};

struct ocelot_vcap_id {};

struct ocelot_vcap_filter {};

int ocelot_vcap_filter_add(struct ocelot *ocelot,
			   struct ocelot_vcap_filter *rule,
			   struct netlink_ext_ack *extack);
int ocelot_vcap_filter_del(struct ocelot *ocelot,
			   struct ocelot_vcap_filter *rule);
int ocelot_vcap_filter_replace(struct ocelot *ocelot,
			       struct ocelot_vcap_filter *filter);
struct ocelot_vcap_filter *
ocelot_vcap_block_find_filter_by_id(struct ocelot_vcap_block *block,
				    unsigned long cookie, bool tc_offload);

#endif /* _OCELOT_VCAP_H_ */