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