/*
 * sfe_api.h
 *	 SFE exported function headers for SFE engine
 *
 * Copyright (c) 2015,2016, The Linux Foundation. All rights reserved.
 * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef __SFE_API_H
#define __SFE_API_H

#define SFE_MAX_VLAN_DEPTH 2
#define SFE_VLAN_ID_NOT_CONFIGURED 0xfff

#define SFE_SPECIAL_INTERFACE_BASE 0x7f00
#define SFE_SPECIAL_INTERFACE_IPV4 (SFE_SPECIAL_INTERFACE_BASE + 1)
#define SFE_SPECIAL_INTERFACE_IPV6 (SFE_SPECIAL_INTERFACE_BASE + 2)
#define SFE_SPECIAL_INTERFACE_IPSEC (SFE_SPECIAL_INTERFACE_BASE + 3)
#define SFE_SPECIAL_INTERFACE_L2TP (SFE_SPECIAL_INTERFACE_BASE + 4)
#define SFE_SPECIAL_INTERFACE_PPTP (SFE_SPECIAL_INTERFACE_BASE + 5)

/**
 * Rule creation & rule update flags.
 */
#define SFE_RULE_CREATE_FLAG_NO_SEQ_CHECK (1<<0) /**< Do not perform TCP sequence number checks */
#define SFE_RULE_CREATE_FLAG_BRIDGE_FLOW  (1<<1) /**< This is a pure bridge forwarding flow */
#define SFE_RULE_CREATE_FLAG_ROUTED       (1<<2) /**< Rule is for a routed connection */
#define SFE_RULE_CREATE_FLAG_DSCP_MARKING (1<<3) /**< Rule has for a DSCP marking configured*/
#define SFE_RULE_CREATE_FLAG_VLAN_MARKING (1<<4) /**< Rule has for a VLAN marking configured*/
#define SFE_RULE_UPDATE_FLAG_CHANGE_MTU   (1<<5) /**< Update MTU of connection interfaces */
#define SFE_RULE_CREATE_FLAG_ICMP_NO_CME_FLUSH (1<<6)/**< Rule for not flushing CME on ICMP pkt */
#define SFE_RULE_CREATE_FLAG_L2_ENCAP     (1<<7) /**< consists of an encapsulating protocol that carries an IPv4 payload within it. */
#define SFE_RULE_CREATE_FLAG_USE_FLOW_BOTTOM_INTERFACE (1<<8) /**< Use flow interface number instead of top interface. */
#define SFE_RULE_CREATE_FLAG_USE_RETURN_BOTTOM_INTERFACE (1<<9) /**< Use return interface number instead of top interface. */
#define SFE_RULE_CREATE_FLAG_SRC_INTERFACE_CHECK  (1<<10)  /**< Check source interface. */
#define SFE_RULE_CREATE_FLAG_FLOW_TRANSMIT_FAST (1<<11) /**< original flow transmit fast. */
#define SFE_RULE_CREATE_FLAG_RETURN_TRANSMIT_FAST (1<<12) /**< return flow transmit fast. */

/**
 * Rule creation validity flags.
 */
#define SFE_RULE_CREATE_CONN_VALID         (1<<0) /**< IPv4 Connection is valid */
#define SFE_RULE_CREATE_TCP_VALID          (1<<1) /**< TCP Protocol fields are valid */
#define SFE_RULE_CREATE_PPPOE_DECAP_VALID  (1<<2) /**< PPPoE Decap fields are valid */
#define SFE_RULE_CREATE_PPPOE_ENCAP_VALID  (1<<3) /**< PPPoE Encap fields are valid */
#define SFE_RULE_CREATE_QOS_VALID          (1<<4) /**< QoS fields are valid */
#define SFE_RULE_CREATE_VLAN_VALID         (1<<5) /**< VLAN fields are valid */
#define SFE_RULE_CREATE_DSCP_MARKING_VALID (1<<6) /**< DSCP marking fields are valid */
#define SFE_RULE_CREATE_VLAN_MARKING_VALID (1<<7) /**< VLAN marking fields are valid */
#define SFE_RULE_CREATE_DIRECTION_VALID    (1<<8) /**< specify acceleration directions */
#define SFE_RULE_CREATE_SRC_MAC_VALID	   (1<<9) /**< Source MAC valid */
#define SFE_RULE_CREATE_MARK_VALID         (1<<10) /**< SKB mark fields are valid */

/*
 * Source MAC address valid flags (to be used with mac_valid_flags field of sfe_ipv4_src_mac_rule structure)
 */
#define SFE_SRC_MAC_FLOW_VALID 0x01
		/**< MAC address for the flow interface is valid. */
#define SFE_SRC_MAC_RETURN_VALID 0x02
		/**< MAC address for the return interface is valid. */

/*
 * 32/64 bits pointer type
 */
#ifdef __LP64__
typedef uint64_t sfe_ptr_t;
#else
typedef uint32_t sfe_ptr_t;
#endif

typedef enum sfe_rule_sync_reason {
	SFE_RULE_SYNC_REASON_STATS,	/* Sync is to synchronize stats */
	SFE_RULE_SYNC_REASON_FLUSH,	/* Sync is to flush a entry */
	SFE_RULE_SYNC_REASON_EVICT,	/* Sync is to evict a entry */
	SFE_RULE_SYNC_REASON_DESTROY	/* Sync is to destroy a entry(requested by connection manager) */

} sfe_rule_sync_reason_t;

/**
 * Tx command status
 */
typedef enum {
	SFE_TX_SUCCESS = 0,	/**< Success */
	SFE_TX_FAILURE,		/**< Command failure other than descriptor not available */
	SFE_TX_FAILURE_QUEUE,	/**< Command failure due to descriptor not available */
	SFE_TX_FAILURE_NOT_READY,	/**< Command failure due to SFE state uninitialized */
	SFE_TX_FAILURE_TOO_LARGE,	/**< Command is too large to fit in one message */
	SFE_TX_FAILURE_TOO_SHORT,	/**< Command/Packet is shorter than expected size */
	SFE_TX_FAILURE_NOT_SUPPORTED,	/**< Command/Packet not accepted for forwarding */
	SFE_TX_FAILURE_BAD_PARAM,	/**< Command failure due to bad parameters */
	SFE_TX_FAILURE_NOT_ENABLED,	/**< Command failure due to SFE feature is not enabled */
} sfe_tx_status_t;

/**
 * Common response types.
 */
enum sfe_cmn_response {
	SFE_CMN_RESPONSE_ACK,		/**< Message Acknowledge */
	SFE_CMN_RESPONSE_EVERSION,	/**< Message Version Error */
	SFE_CMN_RESPONSE_EINTERFACE,	/**< Message Interface Error */
	SFE_CMN_RESPONSE_ELENGTH,	/**< Message Length Error */
	SFE_CMN_RESPONSE_EMSG,		/**< Message Error */
	SFE_CMM_RESPONSE_NOTIFY,	/**< Message Independant of Request */
	SFE_CMN_RESPONSE_LAST
};

/**
 * IPv4 bridge/route rule messages
 */
enum sfe_message_types {
	SFE_TX_CREATE_RULE_MSG,		/**< IPv4/6 create rule message */
	SFE_TX_DESTROY_RULE_MSG,	/**< IPv4/6 destroy rule message */
	SFE_RX_CONN_STATS_SYNC_MSG,	/**< IPv4/6 connection stats sync message */
	SFE_TUN6RD_ADD_UPDATE_PEER,	/**< Add/update peer for 6rd tunnel */
	SFE_MAX_MSG_TYPES,		/**< IPv4/6 message max type number */
};

/**
 * Common message structure
 */
struct sfe_cmn_msg {
	u16 version;		/**< Version id for main message format */
	u16 interface;		/**< Primary Key for all messages */
	enum sfe_cmn_response response;	/**< Primary response */
	u32 type;			/**< Decetralized request #, to be used to match response # */
	u32 error;			/**< Decentralized specific error message, response == EMSG */
	sfe_ptr_t cb;			/**< Place for callback pointer */
	sfe_ptr_t app_data;		/**< Place for app data */
	u32 len;			/**< What is the length of the message excluding this header */
};

/**
 * Common 5 tuple structure
 */
struct sfe_ipv4_5tuple {
	__be32 flow_ip;			/**< Flow IP address */
	__be32 return_ip;		/**< Return IP address */
	__be16 flow_ident;		/**< Flow ident (e.g. TCP/UDP port) */
	__be16 return_ident;		/**< Return ident (e.g. TCP/UDP port) */
	u8 protocol;		/**< Protocol number */
	u8 reserved[3];		/**< Padded for alignment */
};

/**
 * IPv4 connection rule structure.
 */
struct sfe_ipv4_connection_rule {
	u8 flow_mac[6];		/**< Flow MAC address */
	u8 return_mac[6];		/**< Return MAC address */
	s32 flow_interface_num;	/**< Flow interface number */
	s32 return_interface_num;	/**< Return interface number */
	s32 flow_top_interface_num;	/* Top flow interface number */
	s32 return_top_interface_num;/* Top return interface number */
	u32 flow_mtu;		/**< Flow interface`s MTU */
	u32 return_mtu;		/**< Return interface`s MTU */
	__be32 flow_ip_xlate;		/**< Translated flow IP address */
	__be32 return_ip_xlate;		/**< Translated return IP address */
	__be16 flow_ident_xlate;	/**< Translated flow ident (e.g. port) */
	__be16 return_ident_xlate;	/**< Translated return ident (e.g. port) */
};

/**
 * TCP connection rule structure
 */
struct sfe_protocol_tcp_rule {
	u32 flow_max_window;	/**< Flow direction's largest seen window */
	u32 return_max_window;	/**< Return direction's largest seen window */
	u32 flow_end;		/**< Flow direction's largest seen sequence + segment length */
	u32 return_end;		/**< Return direction's largest seen sequence + segment length */
	u32 flow_max_end;		/**< Flow direction's largest seen ack + max(1, win) */
	u32 return_max_end;	/**< Return direction's largest seen ack + max(1, win) */
	u8 flow_window_scale;	/**< Flow direction's window scaling factor */
	u8 return_window_scale;	/**< Return direction's window scaling factor */
	u16 reserved;		/**< Padded for alignment */
};

/**
 * PPPoE connection rules structure
 */
struct sfe_pppoe_rule {
	u16 flow_pppoe_session_id;		/**< Flow direction`s PPPoE session ID. */
	u8 flow_pppoe_remote_mac[ETH_ALEN];	/**< Flow direction`s PPPoE Server MAC address */
	u16 return_pppoe_session_id;	/**< Return direction's PPPoE session ID. */
	u8 return_pppoe_remote_mac[ETH_ALEN];	/**< Return direction's PPPoE Server MAC address */
};

/**
 * sfe_src_mac_rule
 *	Information for source MAC address rules.
 */
struct sfe_src_mac_rule {
	uint32_t mac_valid_flags;	/**< MAC address validity flags. */
	uint16_t flow_src_mac[3];	/**< Source MAC address for the flow direction. */
	uint16_t return_src_mac[3];	/**< Source MAC address for the return direction. */
};

/**
 * QoS connection rule structure
 */
struct sfe_qos_rule {
	u32 flow_qos_tag;		/**< QoS tag associated with this rule for flow direction */
	u32 return_qos_tag;	/**< QoS tag associated with this rule for return direction */
};

struct sfe_mark_rule {
	u32 flow_mark;		/**< skb mark associated with this rule for flow direction */
	u32 return_mark;	/**< skb mark associated with this rule for return direction */
};

/**
 * DSCP connection rule structure
 */
struct sfe_dscp_rule {
	u8 flow_dscp;		/**< Egress DSCP value for flow direction */
	u8 return_dscp;		/**< Egress DSCP value for return direction */
	u8 reserved[2];		/**< Padded for alignment */
};

/**
 * VLAN connection rule structure
 */
struct sfe_vlan_rule {
	u32 ingress_vlan_tag;	/**< VLAN Tag for the ingress packets */
	u32 egress_vlan_tag;	/**< VLAN Tag for egress packets */
};

/**
 * Acceleration direction rule structure
 * 	Sometimes we just want to accelerate traffic in one direction but not in another.
 */
struct sfe_acceleration_direction_rule {
	u8 flow_accel;		/**< Accelerate in flow direction */
	u8 return_accel;		/**< Accelerate in return direction */
	u8 reserved[2];		/**< Padded for alignment */
};

/**
 * The IPv4 rule create sub-message structure.
 */
struct sfe_ipv4_rule_create_msg {
	/* Request */
	u16 valid_flags;				/**< Bit flags associated with the validity of parameters */
	u16 rule_flags;				/**< Bit flags associated with the rule */

	struct sfe_ipv4_5tuple tuple;			/**< Holds values of the 5 tuple */

	struct sfe_ipv4_connection_rule conn_rule;	/**< Basic connection specific data */
	struct sfe_protocol_tcp_rule tcp_rule;		/**< TCP related accleration parameters */
	struct sfe_pppoe_rule pppoe_rule;		/**< PPPoE related accleration parameters */
	struct sfe_qos_rule qos_rule;			/**< QoS related accleration parameters */
	struct sfe_src_mac_rule src_mac_rule;		/**< Src Mac rule */
	struct sfe_mark_rule mark_rule;			/**< skb mark related accleration parameters */
	struct sfe_dscp_rule dscp_rule;			/**< DSCP related accleration parameters */
	struct sfe_vlan_rule vlan_primary_rule;		/**< Primary VLAN related accleration parameters */
	struct sfe_vlan_rule vlan_secondary_rule;	/**< Secondary VLAN related accleration parameters */
#ifdef CONFIG_XFRM
	struct sfe_acceleration_direction_rule direction_rule;/* Direction related accleration parameters*/
#endif
	/* Response */
	u32 index;					/**< Slot ID for cache stats to host OS */
};

/**
 * The IPv4 rule destroy sub-message structure.
 */
struct sfe_ipv4_rule_destroy_msg {
	struct sfe_ipv4_5tuple tuple;	/**< Holds values of the 5 tuple */
};

/**
 * The SFE IPv4 rule sync structure.
 */
struct sfe_ipv4_conn_sync {
	u32 index;			/**< Slot ID for cache stats to host OS */
	u8 protocol;		/**< Protocol number */
	__be32 flow_ip;			/**< Flow IP address */
	__be32 flow_ip_xlate;		/**< Translated flow IP address */
	__be16 flow_ident;		/**< Flow ident (e.g. port) */
	__be16 flow_ident_xlate;	/**< Translated flow ident (e.g. port) */
	u32 flow_max_window;	/**< Flow direction's largest seen window */
	u32 flow_end;		/**< Flow direction's largest seen sequence + segment length */
	u32 flow_max_end;		/**< Flow direction's largest seen ack + max(1, win) */
	u32 flow_rx_packet_count;	/**< Flow interface's RX packet count */
	u32 flow_rx_byte_count;	/**< Flow interface's RX byte count */
	u32 flow_tx_packet_count;	/**< Flow interface's TX packet count */
	u32 flow_tx_byte_count;	/**< Flow interface's TX byte count */
	u16 flow_pppoe_session_id; /**< Flow interface`s PPPoE session ID. */
	u16 flow_pppoe_remote_mac[3];
					/**< Flow interface's PPPoE remote server MAC address if there is any */
	__be32 return_ip;		/**< Return IP address */
	__be32 return_ip_xlate;		/**< Translated return IP address */
	__be16 return_ident;		/**< Return ident (e.g. port) */
	__be16 return_ident_xlate;	/**< Translated return ident (e.g. port) */
	u32 return_max_window;	/**< Return direction's largest seen window */
	u32 return_end;		/**< Return direction's largest seen sequence + segment length */
	u32 return_max_end;	/**< Return direction's largest seen ack + max(1, win) */
	u32 return_rx_packet_count;
					/**< Return interface's RX packet count */
	u32 return_rx_byte_count;	/**< Return interface's RX byte count */
	u32 return_tx_packet_count;
					/**< Return interface's TX packet count */
	u32 return_tx_byte_count;	/**< Return interface's TX byte count */
	u16 return_pppoe_session_id;
					/**< Return interface`s PPPoE session ID. */
	u16 return_pppoe_remote_mac[3];
					/**< Return interface's PPPoE remote server MAC address if there is any */
	u32 inc_ticks;		/**< Number of ticks since the last sync */
	u32 reason;		/**< Reason for the sync */

	u8 flags;			/**< Bit flags associated with the rule */
	u32 qos_tag;		/**< QoS Tag */
	u32 cause;			/**< Flush Cause */
};

/*
 * Message structure to send/receive IPv4 bridge/route commands
 */
struct sfe_ipv4_msg {
	struct sfe_cmn_msg cm;		/**< Message Header */
	union {
		struct sfe_ipv4_rule_create_msg rule_create;	/**< Message: rule create */
		struct sfe_ipv4_rule_destroy_msg rule_destroy;	/**< Message: rule destroy */
		struct sfe_ipv4_conn_sync conn_stats;	/**< Message: connection stats sync */
	} msg;
};

/**
 * Callback to be called when IPv4 message is received
 */
typedef void (*sfe_ipv4_msg_callback_t)(void *app_data, struct sfe_ipv4_msg *msg);

/**
 * IPv6 5-tuple structure.
 */
struct sfe_ipv6_5tuple {
	__be32 flow_ip[4];		/**< Flow IP address */
	__be32 return_ip[4];		/**< Return IP address */
	__be16 flow_ident;		/**< Flow ident (e.g. TCP/UDP port) */
	__be16 return_ident;		/**< Return ident (e.g. TCP/UDP port) */
	u8  protocol;		/**< Protocol number */
	u8  reserved[3];		/**< Padded for alignment */
};

/**
 * IPv6 connection rule structure.
 */
struct sfe_ipv6_connection_rule {
	u8 flow_mac[6];		/**< Flow MAC address */
	u8 return_mac[6];		/**< Return MAC address */
	s32 flow_interface_num;	/**< Flow interface number */
	s32 return_interface_num;	/**< Return interface number */
	s32 flow_top_interface_num;	/* Top flow interface number */
	s32 return_top_interface_num;/* Top return interface number */
	u32 flow_mtu;		/**< Flow interface's MTU */
	u32 return_mtu;		/**< Return interface's MTU */
};

/**
 * The IPv6 rule create sub-message structure.
 */
struct sfe_ipv6_rule_create_msg {
	/*
	 * Request
	 */
	u16 valid_flags;				/**< Bit flags associated with the validity of parameters */
	u16 rule_flags;				/**< Bit flags associated with the rule */
	struct sfe_ipv6_5tuple tuple;			/**< Holds values of the 5 tuple */
	struct sfe_ipv6_connection_rule conn_rule;	/**< Basic connection specific data */
	struct sfe_protocol_tcp_rule tcp_rule;		/**< Protocol related accleration parameters */
	struct sfe_pppoe_rule pppoe_rule;		/**< PPPoE related accleration parameters */
	struct sfe_qos_rule qos_rule;			/**< QoS related accleration parameters */
	struct sfe_src_mac_rule src_mac_rule;		/**< Src Mac rule */
	struct sfe_mark_rule mark_rule;			/**< skb mark related accleration parameters */
	struct sfe_dscp_rule dscp_rule;			/**< DSCP related accleration parameters */
	struct sfe_vlan_rule vlan_primary_rule;		/**< VLAN related accleration parameters */
	struct sfe_vlan_rule vlan_secondary_rule;	/**< VLAN related accleration parameters */
#ifdef CONFIG_XFRM
	struct sfe_acceleration_direction_rule direction_rule;/* Direction related accleration parameters*/
#endif
	/*
	 * Response
	 */
	u32 index;					/**< Slot ID for cache stats to host OS */
};

/**
 * The IPv6 rule destroy sub-message structure.
 */
struct sfe_ipv6_rule_destroy_msg {
	struct sfe_ipv6_5tuple tuple;	/**< Holds values of the 5 tuple */
};

/**
 * The SFE IPv6 rule sync structure.
 */
struct sfe_ipv6_conn_sync {
	u32 index;			/**< Slot ID for cache stats to host OS */
	u8 protocol;		/**< Protocol number */
	__be32 flow_ip[4];		/**< Flow IP address */
	__be16 flow_ident;		/**< Flow ident (e.g. port) */
	u32 flow_max_window;	/**< Flow direction's largest seen window */
	u32 flow_end;		/**< Flow direction's largest seen sequence + segment length */
	u32 flow_max_end;		/**< Flow direction's largest seen ack + max(1, win) */
	u32 flow_rx_packet_count;	/**< Flow interface's RX packet count */
	u32 flow_rx_byte_count;	/**< Flow interface's RX byte count */
	u32 flow_tx_packet_count;	/**< Flow interface's TX packet count */
	u32 flow_tx_byte_count;	/**< Flow interface's TX byte count */
	u16 flow_pppoe_session_id; /**< Flow interface`s PPPoE session ID. */
	u16 flow_pppoe_remote_mac[3];
					/**< Flow interface's PPPoE remote server MAC address if there is any */
	__be32 return_ip[4];		/**< Return IP address */
	__be16 return_ident;		/**< Return ident (e.g. port) */
	u32 return_max_window;	/**< Return direction's largest seen window */
	u32 return_end;		/**< Return direction's largest seen sequence + segment length */
	u32 return_max_end;	/**< Return direction's largest seen ack + max(1, win) */
	u32 return_rx_packet_count;
					/**< Return interface's RX packet count */
	u32 return_rx_byte_count;	/**< Return interface's RX byte count */
	u32 return_tx_packet_count;
					/**< Return interface's TX packet count */
	u32 return_tx_byte_count;	/**< Return interface's TX byte count */
	u16 return_pppoe_session_id;
					/**< Return interface`s PPPoE session ID. */
	u16 return_pppoe_remote_mac[3];
					/**< Return interface's PPPoE remote server MAC address if there is any */
	u32 inc_ticks;		/**< Number of ticks since the last sync */
	u32 reason;		/**< Reason for the sync */
	u8 flags;			/**< Bit flags associated with the rule */
	u32 qos_tag;		/**< QoS Tag */
	u32 cause;			/**< Flush cause associated with the rule */
};

/**
 * Message structure to send/receive IPv6 bridge/route commands
 */
struct sfe_ipv6_msg {
	struct sfe_cmn_msg cm;					/**< Message Header */
	union {
		struct sfe_ipv6_rule_create_msg rule_create;	/**< Message: rule create */
		struct sfe_ipv6_rule_destroy_msg rule_destroy;	/**< Message: rule destroy */
		struct sfe_ipv6_conn_sync conn_stats;		/**< Message: stats sync */
	} msg;
};

/**
 * Callback to be called when IPv6 message is received
 */
typedef void (*sfe_ipv6_msg_callback_t)(void *app_data, struct sfe_ipv6_msg *msg);

/**
 * 6rd tunnel peer addr.
 */
struct sfe_tun6rd_set_peer_msg {
	__be32 ipv6_address[4];	/* The peer's ipv6 addr*/
	__be32 dest;		/* The peer's ipv4 addr*/
};

/**
 * Message structure to send/receive 6rd tunnel messages
 */
struct sfe_tun6rd_msg {
	struct sfe_cmn_msg cm;					/* Message Header */
	union {
		struct sfe_tun6rd_set_peer_msg peer;		/* Message: add/update peer */
	} msg;
};

/*
 * SFE context instance.
 */
struct sfe_ctx_instance {
	int not_used;
};

/*
 * sfe_ipv4_max_conn_count()
 * 	Return the maximum number of IPv4 connections that the sfe acceleration engine supports
 *
 * @return int The number of connections that can be accelerated by the sfe
 */
int sfe_ipv4_max_conn_count(void);

/*
 * sfe_ipv4_tx()
 * 	Transmit an IPv4 message to the sfe
 *
 * @param sfe_ctx SFE. context
 * @param msg The IPv4 message
 *
 * @return sfe_tx_status_t The status of the Tx operation
 */
extern sfe_tx_status_t sfe_ipv4_tx(struct sfe_ctx_instance *sfe_ctx, struct sfe_ipv4_msg *msg);

/*
 * sfe_ipv4_notify_register()
 * 	Register a notifier callback for IPv4 messages from SFE
 *
 * @param cb The callback pointer
 * @param app_data The application context for this message
 *
 * @return struct sfe_ctx_instance * The SFE. context
 */
extern struct sfe_ctx_instance *sfe_ipv4_notify_register(sfe_ipv4_msg_callback_t cb, void *app_data);

/*
 * sfe_ipv4_notify_unregister()
 * 	Un-Register a notifier callback for IPv4 messages from SFE
 */
extern void sfe_ipv4_notify_unregister(void);

/*
 * sfe_ipv4_msg_init()
 * 	IPv4 message init
 */
extern void sfe_ipv4_msg_init(struct sfe_ipv4_msg *nim, u16 if_num, u32 type, u32 len,
			sfe_ipv4_msg_callback_t cb, void *app_data);

/*
 * sfe_ipv6_max_conn_count()
 * 	Return the maximum number of IPv6 connections that the sfe acceleration engine supports
 *
 * @return int The number of connections that can be accelerated by the sfe
 */
int sfe_ipv6_max_conn_count(void);

/*
 * sfe_ipv6_tx()
 * 	Transmit an IPv6 message to the sfe
 *
 * @param sfe_ctx SFE. context
 * @param msg The IPv6 message
 *
 * @return sfe_tx_status_t The status of the Tx operation
 */
extern sfe_tx_status_t sfe_ipv6_tx(struct sfe_ctx_instance *sfe_ctx, struct sfe_ipv6_msg *msg);

/*
 * sfe_ipv6_notify_register()
 * 	Register a notifier callback for IPv6 messages from SFE.
 *
 * @param cb The callback pointer
 * @param app_data The application context for this message
 *
 * @return struct sfe_ctx_instance * The SFE. context
 */
extern struct sfe_ctx_instance *sfe_ipv6_notify_register(sfe_ipv6_msg_callback_t cb, void *app_data);

/*
 * sfe_ipv6_notify_unregister()
 * Un-Register a notifier callback for IPv6 messages from SFE.
 */
extern void sfe_ipv6_notify_unregister(void);

/*
 * sfe_ipv6_msg_init()
 * 	IPv6 message init
 */
extern void sfe_ipv6_msg_init(struct sfe_ipv6_msg *nim, u16 if_num, u32 type, u32 len,
			sfe_ipv6_msg_callback_t cb, void *app_data);

/*
 * sfe_tun6rd_tx()
 * 	Transmit a tun6rd message to sfe engine
 */
sfe_tx_status_t sfe_tun6rd_tx(struct sfe_ctx_instance *sfe_ctx, struct sfe_tun6rd_msg *msg);

/*
 * sfe_tun6rd_msg_init()
 *      Initialize sfe_tun6rd msg.
 */
void sfe_tun6rd_msg_init(struct sfe_tun6rd_msg *ncm, u16 if_num, u32 type,  u32 len,
			 void *cb, void *app_data);

/*
 *
 * sfe_is_l2_feature_enabled()
 *	l2 feature flag is enabled or disabled
 */
bool sfe_is_l2_feature_enabled(void);

#endif /* __SFE_API_H */
