Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 1 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 2 | * sfe_api.h |
| 3 | * SFE exported function headers for SFE engine |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 4 | * |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 5 | * Copyright (c) 2015,2016, The Linux Foundation. All rights reserved. |
Guduri Prathyusha | 647fe3e | 2021-11-22 19:17:51 +0530 | [diff] [blame^] | 6 | * Copyright (c) 2021,2022 Qualcomm Innovation Center, Inc. All rights reserved. |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 7 | * |
| 8 | * Permission to use, copy, modify, and/or distribute this software for any |
| 9 | * purpose with or without fee is hereby granted, provided that the above |
| 10 | * copyright notice and this permission notice appear in all copies. |
| 11 | * |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 19 | */ |
| 20 | |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 21 | #ifndef __SFE_API_H |
| 22 | #define __SFE_API_H |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 23 | |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 24 | #define SFE_MAX_VLAN_DEPTH 2 |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 25 | #define SFE_VLAN_ID_NOT_CONFIGURED 0xfff |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 26 | |
| 27 | #define SFE_SPECIAL_INTERFACE_BASE 0x7f00 |
| 28 | #define SFE_SPECIAL_INTERFACE_IPV4 (SFE_SPECIAL_INTERFACE_BASE + 1) |
| 29 | #define SFE_SPECIAL_INTERFACE_IPV6 (SFE_SPECIAL_INTERFACE_BASE + 2) |
| 30 | #define SFE_SPECIAL_INTERFACE_IPSEC (SFE_SPECIAL_INTERFACE_BASE + 3) |
Xiaoping Fan | 6753961 | 2015-12-22 16:20:28 -0800 | [diff] [blame] | 31 | #define SFE_SPECIAL_INTERFACE_L2TP (SFE_SPECIAL_INTERFACE_BASE + 4) |
| 32 | #define SFE_SPECIAL_INTERFACE_PPTP (SFE_SPECIAL_INTERFACE_BASE + 5) |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 33 | |
| 34 | /** |
| 35 | * Rule creation & rule update flags. |
| 36 | */ |
| 37 | #define SFE_RULE_CREATE_FLAG_NO_SEQ_CHECK (1<<0) /**< Do not perform TCP sequence number checks */ |
| 38 | #define SFE_RULE_CREATE_FLAG_BRIDGE_FLOW (1<<1) /**< This is a pure bridge forwarding flow */ |
| 39 | #define SFE_RULE_CREATE_FLAG_ROUTED (1<<2) /**< Rule is for a routed connection */ |
| 40 | #define SFE_RULE_CREATE_FLAG_DSCP_MARKING (1<<3) /**< Rule has for a DSCP marking configured*/ |
| 41 | #define SFE_RULE_CREATE_FLAG_VLAN_MARKING (1<<4) /**< Rule has for a VLAN marking configured*/ |
| 42 | #define SFE_RULE_UPDATE_FLAG_CHANGE_MTU (1<<5) /**< Update MTU of connection interfaces */ |
| 43 | #define SFE_RULE_CREATE_FLAG_ICMP_NO_CME_FLUSH (1<<6)/**< Rule for not flushing CME on ICMP pkt */ |
| 44 | #define SFE_RULE_CREATE_FLAG_L2_ENCAP (1<<7) /**< consists of an encapsulating protocol that carries an IPv4 payload within it. */ |
Suruchi Suman | c1a4a61 | 2021-10-21 14:50:23 +0530 | [diff] [blame] | 45 | #define SFE_RULE_CREATE_FLAG_USE_FLOW_BOTTOM_INTERFACE (1<<8) /**< Use flow interface number instead of top interface. */ |
| 46 | #define SFE_RULE_CREATE_FLAG_USE_RETURN_BOTTOM_INTERFACE (1<<9) /**< Use return interface number instead of top interface. */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 47 | |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 48 | /** |
| 49 | * Rule creation validity flags. |
| 50 | */ |
| 51 | #define SFE_RULE_CREATE_CONN_VALID (1<<0) /**< IPv4 Connection is valid */ |
| 52 | #define SFE_RULE_CREATE_TCP_VALID (1<<1) /**< TCP Protocol fields are valid */ |
Guduri Prathyusha | 647fe3e | 2021-11-22 19:17:51 +0530 | [diff] [blame^] | 53 | #define SFE_RULE_CREATE_PPPOE_DECAP_VALID (1<<2) /**< PPPoE Decap fields are valid */ |
| 54 | #define SFE_RULE_CREATE_PPPOE_ENCAP_VALID (1<<3) /**< PPPoE Encap fields are valid */ |
Guduri Prathyusha | eb31c90 | 2021-11-10 20:18:50 +0530 | [diff] [blame] | 55 | #define SFE_RULE_CREATE_QOS_VALID (1<<4) /**< QoS fields are valid */ |
| 56 | #define SFE_RULE_CREATE_VLAN_VALID (1<<5) /**< VLAN fields are valid */ |
| 57 | #define SFE_RULE_CREATE_DSCP_MARKING_VALID (1<<6) /**< DSCP marking fields are valid */ |
| 58 | #define SFE_RULE_CREATE_VLAN_MARKING_VALID (1<<7) /**< VLAN marking fields are valid */ |
| 59 | #define SFE_RULE_CREATE_DIRECTION_VALID (1<<8) /**< specify acceleration directions */ |
| 60 | #define SFE_RULE_CREATE_SRC_MAC_VALID (1<<9) /**< Source MAC valid */ |
Ratheesh Kannoth | 29140aa | 2021-10-20 08:25:02 +0530 | [diff] [blame] | 61 | |
| 62 | /* |
| 63 | * Source MAC address valid flags (to be used with mac_valid_flags field of sfe_ipv4_src_mac_rule structure) |
| 64 | */ |
| 65 | #define SFE_SRC_MAC_FLOW_VALID 0x01 |
| 66 | /**< MAC address for the flow interface is valid. */ |
| 67 | #define SFE_SRC_MAC_RETURN_VALID 0x02 |
| 68 | /**< MAC address for the return interface is valid. */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 69 | |
Murat Sezgin | affcf9e | 2020-09-18 13:16:45 -0700 | [diff] [blame] | 70 | /* |
| 71 | * 32/64 bits pointer type |
| 72 | */ |
| 73 | #ifdef __LP64__ |
| 74 | typedef uint64_t sfe_ptr_t; |
| 75 | #else |
| 76 | typedef uint32_t sfe_ptr_t; |
| 77 | #endif |
| 78 | |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 79 | typedef enum sfe_rule_sync_reason { |
Xiaoping Fan | 1253cd0 | 2015-11-11 18:02:20 -0800 | [diff] [blame] | 80 | SFE_RULE_SYNC_REASON_STATS, /* Sync is to synchronize stats */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 81 | SFE_RULE_SYNC_REASON_FLUSH, /* Sync is to flush a entry */ |
| 82 | SFE_RULE_SYNC_REASON_EVICT, /* Sync is to evict a entry */ |
Xiaoping Fan | 1253cd0 | 2015-11-11 18:02:20 -0800 | [diff] [blame] | 83 | SFE_RULE_SYNC_REASON_DESTROY /* Sync is to destroy a entry(requested by connection manager) */ |
| 84 | |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 85 | } sfe_rule_sync_reason_t; |
| 86 | |
| 87 | /** |
| 88 | * Tx command status |
| 89 | */ |
| 90 | typedef enum { |
| 91 | SFE_TX_SUCCESS = 0, /**< Success */ |
| 92 | SFE_TX_FAILURE, /**< Command failure other than descriptor not available */ |
| 93 | SFE_TX_FAILURE_QUEUE, /**< Command failure due to descriptor not available */ |
| 94 | SFE_TX_FAILURE_NOT_READY, /**< Command failure due to SFE state uninitialized */ |
| 95 | SFE_TX_FAILURE_TOO_LARGE, /**< Command is too large to fit in one message */ |
| 96 | SFE_TX_FAILURE_TOO_SHORT, /**< Command/Packet is shorter than expected size */ |
| 97 | SFE_TX_FAILURE_NOT_SUPPORTED, /**< Command/Packet not accepted for forwarding */ |
| 98 | SFE_TX_FAILURE_BAD_PARAM, /**< Command failure due to bad parameters */ |
| 99 | SFE_TX_FAILURE_NOT_ENABLED, /**< Command failure due to SFE feature is not enabled */ |
| 100 | } sfe_tx_status_t; |
| 101 | |
| 102 | /** |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 103 | * Common response types. |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 104 | */ |
| 105 | enum sfe_cmn_response { |
| 106 | SFE_CMN_RESPONSE_ACK, /**< Message Acknowledge */ |
| 107 | SFE_CMN_RESPONSE_EVERSION, /**< Message Version Error */ |
| 108 | SFE_CMN_RESPONSE_EINTERFACE, /**< Message Interface Error */ |
| 109 | SFE_CMN_RESPONSE_ELENGTH, /**< Message Length Error */ |
| 110 | SFE_CMN_RESPONSE_EMSG, /**< Message Error */ |
| 111 | SFE_CMM_RESPONSE_NOTIFY, /**< Message Independant of Request */ |
| 112 | SFE_CMN_RESPONSE_LAST |
| 113 | }; |
| 114 | |
| 115 | /** |
| 116 | * IPv4 bridge/route rule messages |
| 117 | */ |
| 118 | enum sfe_message_types { |
| 119 | SFE_TX_CREATE_RULE_MSG, /**< IPv4/6 create rule message */ |
| 120 | SFE_TX_DESTROY_RULE_MSG, /**< IPv4/6 destroy rule message */ |
| 121 | SFE_RX_CONN_STATS_SYNC_MSG, /**< IPv4/6 connection stats sync message */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 122 | SFE_TUN6RD_ADD_UPDATE_PEER, /**< Add/update peer for 6rd tunnel */ |
| 123 | SFE_MAX_MSG_TYPES, /**< IPv4/6 message max type number */ |
| 124 | }; |
| 125 | |
| 126 | /** |
| 127 | * Common message structure |
| 128 | */ |
| 129 | struct sfe_cmn_msg { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 130 | u16 version; /**< Version id for main message format */ |
| 131 | u16 interface; /**< Primary Key for all messages */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 132 | enum sfe_cmn_response response; /**< Primary response */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 133 | u32 type; /**< Decetralized request #, to be used to match response # */ |
| 134 | u32 error; /**< Decentralized specific error message, response == EMSG */ |
Murat Sezgin | affcf9e | 2020-09-18 13:16:45 -0700 | [diff] [blame] | 135 | sfe_ptr_t cb; /**< Place for callback pointer */ |
| 136 | sfe_ptr_t app_data; /**< Place for app data */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 137 | u32 len; /**< What is the length of the message excluding this header */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 138 | }; |
| 139 | |
| 140 | /** |
| 141 | * Common 5 tuple structure |
| 142 | */ |
| 143 | struct sfe_ipv4_5tuple { |
| 144 | __be32 flow_ip; /**< Flow IP address */ |
| 145 | __be32 return_ip; /**< Return IP address */ |
| 146 | __be16 flow_ident; /**< Flow ident (e.g. TCP/UDP port) */ |
| 147 | __be16 return_ident; /**< Return ident (e.g. TCP/UDP port) */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 148 | u8 protocol; /**< Protocol number */ |
| 149 | u8 reserved[3]; /**< Padded for alignment */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | /** |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 153 | * IPv4 connection rule structure. |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 154 | */ |
| 155 | struct sfe_ipv4_connection_rule { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 156 | u8 flow_mac[6]; /**< Flow MAC address */ |
| 157 | u8 return_mac[6]; /**< Return MAC address */ |
| 158 | s32 flow_interface_num; /**< Flow interface number */ |
| 159 | s32 return_interface_num; /**< Return interface number */ |
| 160 | s32 flow_top_interface_num; /* Top flow interface number */ |
| 161 | s32 return_top_interface_num;/* Top return interface number */ |
| 162 | u32 flow_mtu; /**< Flow interface`s MTU */ |
| 163 | u32 return_mtu; /**< Return interface`s MTU */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 164 | __be32 flow_ip_xlate; /**< Translated flow IP address */ |
| 165 | __be32 return_ip_xlate; /**< Translated return IP address */ |
| 166 | __be16 flow_ident_xlate; /**< Translated flow ident (e.g. port) */ |
| 167 | __be16 return_ident_xlate; /**< Translated return ident (e.g. port) */ |
| 168 | }; |
| 169 | |
| 170 | /** |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 171 | * TCP connection rule structure |
| 172 | */ |
| 173 | struct sfe_protocol_tcp_rule { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 174 | u32 flow_max_window; /**< Flow direction's largest seen window */ |
| 175 | u32 return_max_window; /**< Return direction's largest seen window */ |
| 176 | u32 flow_end; /**< Flow direction's largest seen sequence + segment length */ |
| 177 | u32 return_end; /**< Return direction's largest seen sequence + segment length */ |
| 178 | u32 flow_max_end; /**< Flow direction's largest seen ack + max(1, win) */ |
| 179 | u32 return_max_end; /**< Return direction's largest seen ack + max(1, win) */ |
| 180 | u8 flow_window_scale; /**< Flow direction's window scaling factor */ |
| 181 | u8 return_window_scale; /**< Return direction's window scaling factor */ |
| 182 | u16 reserved; /**< Padded for alignment */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 183 | }; |
| 184 | |
| 185 | /** |
| 186 | * PPPoE connection rules structure |
| 187 | */ |
| 188 | struct sfe_pppoe_rule { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 189 | u16 flow_pppoe_session_id; /**< Flow direction`s PPPoE session ID. */ |
Guduri Prathyusha | eb31c90 | 2021-11-10 20:18:50 +0530 | [diff] [blame] | 190 | u8 flow_pppoe_remote_mac[ETH_ALEN]; /**< Flow direction`s PPPoE Server MAC address */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 191 | u16 return_pppoe_session_id; /**< Return direction's PPPoE session ID. */ |
Guduri Prathyusha | eb31c90 | 2021-11-10 20:18:50 +0530 | [diff] [blame] | 192 | u8 return_pppoe_remote_mac[ETH_ALEN]; /**< Return direction's PPPoE Server MAC address */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 193 | }; |
| 194 | |
Suruchi Suman | c1a4a61 | 2021-10-21 14:50:23 +0530 | [diff] [blame] | 195 | /** |
Ratheesh Kannoth | 29140aa | 2021-10-20 08:25:02 +0530 | [diff] [blame] | 196 | * sfe_src_mac_rule |
| 197 | * Information for source MAC address rules. |
| 198 | */ |
| 199 | struct sfe_src_mac_rule { |
| 200 | uint32_t mac_valid_flags; /**< MAC address validity flags. */ |
| 201 | uint16_t flow_src_mac[3]; /**< Source MAC address for the flow direction. */ |
| 202 | uint16_t return_src_mac[3]; /**< Source MAC address for the return direction. */ |
| 203 | }; |
| 204 | |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 205 | /** |
| 206 | * QoS connection rule structure |
| 207 | */ |
| 208 | struct sfe_qos_rule { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 209 | u32 flow_qos_tag; /**< QoS tag associated with this rule for flow direction */ |
| 210 | u32 return_qos_tag; /**< QoS tag associated with this rule for return direction */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 211 | }; |
| 212 | |
| 213 | /** |
| 214 | * DSCP connection rule structure |
| 215 | */ |
| 216 | struct sfe_dscp_rule { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 217 | u8 flow_dscp; /**< Egress DSCP value for flow direction */ |
| 218 | u8 return_dscp; /**< Egress DSCP value for return direction */ |
| 219 | u8 reserved[2]; /**< Padded for alignment */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 220 | }; |
| 221 | |
| 222 | /** |
| 223 | * VLAN connection rule structure |
| 224 | */ |
| 225 | struct sfe_vlan_rule { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 226 | u32 ingress_vlan_tag; /**< VLAN Tag for the ingress packets */ |
| 227 | u32 egress_vlan_tag; /**< VLAN Tag for egress packets */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 228 | }; |
| 229 | |
| 230 | /** |
Xiaoping Fan | ee0afe0 | 2015-09-10 17:34:00 -0700 | [diff] [blame] | 231 | * Acceleration direction rule structure |
| 232 | * Sometimes we just want to accelerate traffic in one direction but not in another. |
| 233 | */ |
| 234 | struct sfe_acceleration_direction_rule { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 235 | u8 flow_accel; /**< Accelerate in flow direction */ |
| 236 | u8 return_accel; /**< Accelerate in return direction */ |
| 237 | u8 reserved[2]; /**< Padded for alignment */ |
Xiaoping Fan | ee0afe0 | 2015-09-10 17:34:00 -0700 | [diff] [blame] | 238 | }; |
| 239 | |
| 240 | /** |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 241 | * The IPv4 rule create sub-message structure. |
| 242 | */ |
| 243 | struct sfe_ipv4_rule_create_msg { |
| 244 | /* Request */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 245 | u16 valid_flags; /**< Bit flags associated with the validity of parameters */ |
| 246 | u16 rule_flags; /**< Bit flags associated with the rule */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 247 | |
| 248 | struct sfe_ipv4_5tuple tuple; /**< Holds values of the 5 tuple */ |
| 249 | |
| 250 | struct sfe_ipv4_connection_rule conn_rule; /**< Basic connection specific data */ |
| 251 | struct sfe_protocol_tcp_rule tcp_rule; /**< TCP related accleration parameters */ |
| 252 | struct sfe_pppoe_rule pppoe_rule; /**< PPPoE related accleration parameters */ |
| 253 | struct sfe_qos_rule qos_rule; /**< QoS related accleration parameters */ |
Ratheesh Kannoth | 29140aa | 2021-10-20 08:25:02 +0530 | [diff] [blame] | 254 | struct sfe_src_mac_rule src_mac_rule; /**< Src Mac rule */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 255 | struct sfe_dscp_rule dscp_rule; /**< DSCP related accleration parameters */ |
| 256 | struct sfe_vlan_rule vlan_primary_rule; /**< Primary VLAN related accleration parameters */ |
| 257 | struct sfe_vlan_rule vlan_secondary_rule; /**< Secondary VLAN related accleration parameters */ |
Xiaoping Fan | ee0afe0 | 2015-09-10 17:34:00 -0700 | [diff] [blame] | 258 | #ifdef CONFIG_XFRM |
| 259 | struct sfe_acceleration_direction_rule direction_rule;/* Direction related accleration parameters*/ |
| 260 | #endif |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 261 | /* Response */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 262 | u32 index; /**< Slot ID for cache stats to host OS */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 263 | }; |
| 264 | |
| 265 | /** |
| 266 | * The IPv4 rule destroy sub-message structure. |
| 267 | */ |
| 268 | struct sfe_ipv4_rule_destroy_msg { |
| 269 | struct sfe_ipv4_5tuple tuple; /**< Holds values of the 5 tuple */ |
| 270 | }; |
| 271 | |
| 272 | /** |
| 273 | * The SFE IPv4 rule sync structure. |
| 274 | */ |
| 275 | struct sfe_ipv4_conn_sync { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 276 | u32 index; /**< Slot ID for cache stats to host OS */ |
| 277 | u8 protocol; /**< Protocol number */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 278 | __be32 flow_ip; /**< Flow IP address */ |
| 279 | __be32 flow_ip_xlate; /**< Translated flow IP address */ |
| 280 | __be16 flow_ident; /**< Flow ident (e.g. port) */ |
| 281 | __be16 flow_ident_xlate; /**< Translated flow ident (e.g. port) */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 282 | u32 flow_max_window; /**< Flow direction's largest seen window */ |
| 283 | u32 flow_end; /**< Flow direction's largest seen sequence + segment length */ |
| 284 | u32 flow_max_end; /**< Flow direction's largest seen ack + max(1, win) */ |
| 285 | u32 flow_rx_packet_count; /**< Flow interface's RX packet count */ |
| 286 | u32 flow_rx_byte_count; /**< Flow interface's RX byte count */ |
| 287 | u32 flow_tx_packet_count; /**< Flow interface's TX packet count */ |
| 288 | u32 flow_tx_byte_count; /**< Flow interface's TX byte count */ |
| 289 | u16 flow_pppoe_session_id; /**< Flow interface`s PPPoE session ID. */ |
| 290 | u16 flow_pppoe_remote_mac[3]; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 291 | /**< Flow interface's PPPoE remote server MAC address if there is any */ |
| 292 | __be32 return_ip; /**< Return IP address */ |
| 293 | __be32 return_ip_xlate; /**< Translated return IP address */ |
| 294 | __be16 return_ident; /**< Return ident (e.g. port) */ |
| 295 | __be16 return_ident_xlate; /**< Translated return ident (e.g. port) */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 296 | u32 return_max_window; /**< Return direction's largest seen window */ |
| 297 | u32 return_end; /**< Return direction's largest seen sequence + segment length */ |
| 298 | u32 return_max_end; /**< Return direction's largest seen ack + max(1, win) */ |
| 299 | u32 return_rx_packet_count; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 300 | /**< Return interface's RX packet count */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 301 | u32 return_rx_byte_count; /**< Return interface's RX byte count */ |
| 302 | u32 return_tx_packet_count; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 303 | /**< Return interface's TX packet count */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 304 | u32 return_tx_byte_count; /**< Return interface's TX byte count */ |
| 305 | u16 return_pppoe_session_id; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 306 | /**< Return interface`s PPPoE session ID. */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 307 | u16 return_pppoe_remote_mac[3]; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 308 | /**< Return interface's PPPoE remote server MAC address if there is any */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 309 | u32 inc_ticks; /**< Number of ticks since the last sync */ |
| 310 | u32 reason; /**< Reason for the sync */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 311 | |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 312 | u8 flags; /**< Bit flags associated with the rule */ |
| 313 | u32 qos_tag; /**< QoS Tag */ |
| 314 | u32 cause; /**< Flush Cause */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 315 | }; |
| 316 | |
| 317 | /* |
| 318 | * Message structure to send/receive IPv4 bridge/route commands |
| 319 | */ |
| 320 | struct sfe_ipv4_msg { |
| 321 | struct sfe_cmn_msg cm; /**< Message Header */ |
| 322 | union { |
| 323 | struct sfe_ipv4_rule_create_msg rule_create; /**< Message: rule create */ |
| 324 | struct sfe_ipv4_rule_destroy_msg rule_destroy; /**< Message: rule destroy */ |
| 325 | struct sfe_ipv4_conn_sync conn_stats; /**< Message: connection stats sync */ |
| 326 | } msg; |
| 327 | }; |
| 328 | |
| 329 | /** |
| 330 | * Callback to be called when IPv4 message is received |
| 331 | */ |
| 332 | typedef void (*sfe_ipv4_msg_callback_t)(void *app_data, struct sfe_ipv4_msg *msg); |
| 333 | |
| 334 | /** |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 335 | * IPv6 5-tuple structure. |
| 336 | */ |
| 337 | struct sfe_ipv6_5tuple { |
| 338 | __be32 flow_ip[4]; /**< Flow IP address */ |
| 339 | __be32 return_ip[4]; /**< Return IP address */ |
| 340 | __be16 flow_ident; /**< Flow ident (e.g. TCP/UDP port) */ |
| 341 | __be16 return_ident; /**< Return ident (e.g. TCP/UDP port) */ |
| 342 | u8 protocol; /**< Protocol number */ |
| 343 | u8 reserved[3]; /**< Padded for alignment */ |
| 344 | }; |
| 345 | |
| 346 | /** |
| 347 | * IPv6 connection rule structure. |
| 348 | */ |
| 349 | struct sfe_ipv6_connection_rule { |
| 350 | u8 flow_mac[6]; /**< Flow MAC address */ |
| 351 | u8 return_mac[6]; /**< Return MAC address */ |
| 352 | s32 flow_interface_num; /**< Flow interface number */ |
| 353 | s32 return_interface_num; /**< Return interface number */ |
| 354 | s32 flow_top_interface_num; /* Top flow interface number */ |
| 355 | s32 return_top_interface_num;/* Top return interface number */ |
| 356 | u32 flow_mtu; /**< Flow interface's MTU */ |
| 357 | u32 return_mtu; /**< Return interface's MTU */ |
| 358 | }; |
| 359 | |
| 360 | /** |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 361 | * The IPv6 rule create sub-message structure. |
| 362 | */ |
| 363 | struct sfe_ipv6_rule_create_msg { |
| 364 | /* |
| 365 | * Request |
| 366 | */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 367 | u16 valid_flags; /**< Bit flags associated with the validity of parameters */ |
| 368 | u16 rule_flags; /**< Bit flags associated with the rule */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 369 | struct sfe_ipv6_5tuple tuple; /**< Holds values of the 5 tuple */ |
| 370 | struct sfe_ipv6_connection_rule conn_rule; /**< Basic connection specific data */ |
| 371 | struct sfe_protocol_tcp_rule tcp_rule; /**< Protocol related accleration parameters */ |
| 372 | struct sfe_pppoe_rule pppoe_rule; /**< PPPoE related accleration parameters */ |
| 373 | struct sfe_qos_rule qos_rule; /**< QoS related accleration parameters */ |
Ratheesh Kannoth | 29140aa | 2021-10-20 08:25:02 +0530 | [diff] [blame] | 374 | struct sfe_src_mac_rule src_mac_rule; /**< Src Mac rule */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 375 | struct sfe_dscp_rule dscp_rule; /**< DSCP related accleration parameters */ |
| 376 | struct sfe_vlan_rule vlan_primary_rule; /**< VLAN related accleration parameters */ |
| 377 | struct sfe_vlan_rule vlan_secondary_rule; /**< VLAN related accleration parameters */ |
Xiaoping Fan | ee0afe0 | 2015-09-10 17:34:00 -0700 | [diff] [blame] | 378 | #ifdef CONFIG_XFRM |
| 379 | struct sfe_acceleration_direction_rule direction_rule;/* Direction related accleration parameters*/ |
| 380 | #endif |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 381 | /* |
| 382 | * Response |
| 383 | */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 384 | u32 index; /**< Slot ID for cache stats to host OS */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 385 | }; |
| 386 | |
| 387 | /** |
| 388 | * The IPv6 rule destroy sub-message structure. |
| 389 | */ |
| 390 | struct sfe_ipv6_rule_destroy_msg { |
| 391 | struct sfe_ipv6_5tuple tuple; /**< Holds values of the 5 tuple */ |
| 392 | }; |
| 393 | |
| 394 | /** |
| 395 | * The SFE IPv6 rule sync structure. |
| 396 | */ |
| 397 | struct sfe_ipv6_conn_sync { |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 398 | u32 index; /**< Slot ID for cache stats to host OS */ |
| 399 | u8 protocol; /**< Protocol number */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 400 | __be32 flow_ip[4]; /**< Flow IP address */ |
| 401 | __be16 flow_ident; /**< Flow ident (e.g. port) */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 402 | u32 flow_max_window; /**< Flow direction's largest seen window */ |
| 403 | u32 flow_end; /**< Flow direction's largest seen sequence + segment length */ |
| 404 | u32 flow_max_end; /**< Flow direction's largest seen ack + max(1, win) */ |
| 405 | u32 flow_rx_packet_count; /**< Flow interface's RX packet count */ |
| 406 | u32 flow_rx_byte_count; /**< Flow interface's RX byte count */ |
| 407 | u32 flow_tx_packet_count; /**< Flow interface's TX packet count */ |
| 408 | u32 flow_tx_byte_count; /**< Flow interface's TX byte count */ |
| 409 | u16 flow_pppoe_session_id; /**< Flow interface`s PPPoE session ID. */ |
| 410 | u16 flow_pppoe_remote_mac[3]; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 411 | /**< Flow interface's PPPoE remote server MAC address if there is any */ |
| 412 | __be32 return_ip[4]; /**< Return IP address */ |
| 413 | __be16 return_ident; /**< Return ident (e.g. port) */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 414 | u32 return_max_window; /**< Return direction's largest seen window */ |
| 415 | u32 return_end; /**< Return direction's largest seen sequence + segment length */ |
| 416 | u32 return_max_end; /**< Return direction's largest seen ack + max(1, win) */ |
| 417 | u32 return_rx_packet_count; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 418 | /**< Return interface's RX packet count */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 419 | u32 return_rx_byte_count; /**< Return interface's RX byte count */ |
| 420 | u32 return_tx_packet_count; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 421 | /**< Return interface's TX packet count */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 422 | u32 return_tx_byte_count; /**< Return interface's TX byte count */ |
| 423 | u16 return_pppoe_session_id; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 424 | /**< Return interface`s PPPoE session ID. */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 425 | u16 return_pppoe_remote_mac[3]; |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 426 | /**< Return interface's PPPoE remote server MAC address if there is any */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 427 | u32 inc_ticks; /**< Number of ticks since the last sync */ |
| 428 | u32 reason; /**< Reason for the sync */ |
| 429 | u8 flags; /**< Bit flags associated with the rule */ |
| 430 | u32 qos_tag; /**< QoS Tag */ |
| 431 | u32 cause; /**< Flush cause associated with the rule */ |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 432 | }; |
| 433 | |
| 434 | /** |
| 435 | * Message structure to send/receive IPv6 bridge/route commands |
| 436 | */ |
| 437 | struct sfe_ipv6_msg { |
| 438 | struct sfe_cmn_msg cm; /**< Message Header */ |
| 439 | union { |
| 440 | struct sfe_ipv6_rule_create_msg rule_create; /**< Message: rule create */ |
| 441 | struct sfe_ipv6_rule_destroy_msg rule_destroy; /**< Message: rule destroy */ |
| 442 | struct sfe_ipv6_conn_sync conn_stats; /**< Message: stats sync */ |
| 443 | } msg; |
| 444 | }; |
| 445 | |
| 446 | /** |
| 447 | * Callback to be called when IPv6 message is received |
| 448 | */ |
| 449 | typedef void (*sfe_ipv6_msg_callback_t)(void *app_data, struct sfe_ipv6_msg *msg); |
| 450 | |
| 451 | /** |
| 452 | * 6rd tunnel peer addr. |
| 453 | */ |
| 454 | struct sfe_tun6rd_set_peer_msg { |
| 455 | __be32 ipv6_address[4]; /* The peer's ipv6 addr*/ |
| 456 | __be32 dest; /* The peer's ipv4 addr*/ |
| 457 | }; |
| 458 | |
| 459 | /** |
| 460 | * Message structure to send/receive 6rd tunnel messages |
| 461 | */ |
| 462 | struct sfe_tun6rd_msg { |
| 463 | struct sfe_cmn_msg cm; /* Message Header */ |
| 464 | union { |
| 465 | struct sfe_tun6rd_set_peer_msg peer; /* Message: add/update peer */ |
| 466 | } msg; |
| 467 | }; |
| 468 | |
| 469 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 470 | * SFE context instance. |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 471 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 472 | struct sfe_ctx_instance { |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 473 | int not_used; |
| 474 | }; |
| 475 | |
| 476 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 477 | * sfe_ipv4_max_conn_count() |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 478 | * Return the maximum number of IPv4 connections that the sfe acceleration engine supports |
| 479 | * |
| 480 | * @return int The number of connections that can be accelerated by the sfe |
| 481 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 482 | int sfe_ipv4_max_conn_count(void); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 483 | |
| 484 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 485 | * sfe_ipv4_tx() |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 486 | * Transmit an IPv4 message to the sfe |
| 487 | * |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 488 | * @param sfe_ctx SFE. context |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 489 | * @param msg The IPv4 message |
| 490 | * |
| 491 | * @return sfe_tx_status_t The status of the Tx operation |
| 492 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 493 | extern sfe_tx_status_t sfe_ipv4_tx(struct sfe_ctx_instance *sfe_ctx, struct sfe_ipv4_msg *msg); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 494 | |
| 495 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 496 | * sfe_ipv4_notify_register() |
| 497 | * Register a notifier callback for IPv4 messages from SFE |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 498 | * |
| 499 | * @param cb The callback pointer |
| 500 | * @param app_data The application context for this message |
| 501 | * |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 502 | * @return struct sfe_ctx_instance * The SFE. context |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 503 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 504 | extern struct sfe_ctx_instance *sfe_ipv4_notify_register(sfe_ipv4_msg_callback_t cb, void *app_data); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 505 | |
| 506 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 507 | * sfe_ipv4_notify_unregister() |
| 508 | * Un-Register a notifier callback for IPv4 messages from SFE |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 509 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 510 | extern void sfe_ipv4_notify_unregister(void); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 511 | |
| 512 | /* |
| 513 | * sfe_ipv4_msg_init() |
| 514 | * IPv4 message init |
| 515 | */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 516 | extern void sfe_ipv4_msg_init(struct sfe_ipv4_msg *nim, u16 if_num, u32 type, u32 len, |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 517 | sfe_ipv4_msg_callback_t cb, void *app_data); |
| 518 | |
| 519 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 520 | * sfe_ipv6_max_conn_count() |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 521 | * Return the maximum number of IPv6 connections that the sfe acceleration engine supports |
| 522 | * |
| 523 | * @return int The number of connections that can be accelerated by the sfe |
| 524 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 525 | int sfe_ipv6_max_conn_count(void); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 526 | |
| 527 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 528 | * sfe_ipv6_tx() |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 529 | * Transmit an IPv6 message to the sfe |
| 530 | * |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 531 | * @param sfe_ctx SFE. context |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 532 | * @param msg The IPv6 message |
| 533 | * |
| 534 | * @return sfe_tx_status_t The status of the Tx operation |
| 535 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 536 | extern sfe_tx_status_t sfe_ipv6_tx(struct sfe_ctx_instance *sfe_ctx, struct sfe_ipv6_msg *msg); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 537 | |
| 538 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 539 | * sfe_ipv6_notify_register() |
| 540 | * Register a notifier callback for IPv6 messages from SFE. |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 541 | * |
| 542 | * @param cb The callback pointer |
| 543 | * @param app_data The application context for this message |
| 544 | * |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 545 | * @return struct sfe_ctx_instance * The SFE. context |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 546 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 547 | extern struct sfe_ctx_instance *sfe_ipv6_notify_register(sfe_ipv6_msg_callback_t cb, void *app_data); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 548 | |
| 549 | /* |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 550 | * sfe_ipv6_notify_unregister() |
| 551 | * Un-Register a notifier callback for IPv6 messages from SFE. |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 552 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 553 | extern void sfe_ipv6_notify_unregister(void); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 554 | |
| 555 | /* |
| 556 | * sfe_ipv6_msg_init() |
| 557 | * IPv6 message init |
| 558 | */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 559 | extern void sfe_ipv6_msg_init(struct sfe_ipv6_msg *nim, u16 if_num, u32 type, u32 len, |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 560 | sfe_ipv6_msg_callback_t cb, void *app_data); |
| 561 | |
| 562 | /* |
| 563 | * sfe_tun6rd_tx() |
| 564 | * Transmit a tun6rd message to sfe engine |
| 565 | */ |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 566 | sfe_tx_status_t sfe_tun6rd_tx(struct sfe_ctx_instance *sfe_ctx, struct sfe_tun6rd_msg *msg); |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 567 | |
| 568 | /* |
| 569 | * sfe_tun6rd_msg_init() |
| 570 | * Initialize sfe_tun6rd msg. |
| 571 | */ |
Xiaoping Fan | 6a1672f | 2016-08-17 19:58:12 -0700 | [diff] [blame] | 572 | void sfe_tun6rd_msg_init(struct sfe_tun6rd_msg *ncm, u16 if_num, u32 type, u32 len, |
Xiaoping Fan | 0493b2d | 2015-08-21 19:09:38 -0700 | [diff] [blame] | 573 | void *cb, void *app_data); |
| 574 | |
Ratheesh Kannoth | 24fb1db | 2021-10-20 07:28:06 +0530 | [diff] [blame] | 575 | #endif /* __SFE_API_H */ |