1/* 2 ************************************************************************** 3 * Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved. 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all copies. 7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 10 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 12 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 13 * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 14 ************************************************************************** 15 */ 16 17/* 18 * nss_ipv4.h 19 * NSS to HLOS interface definitions. 20 */ 21 22/* 23 * TODO: Since this is the now the public header file for writting an 24 * IPv4 message, we need to convert the entire file to doxygen. 25 */ 26 27#ifndef __NSS_IPV4_H 28#define __NSS_IPV4_H 29 30/** 31 * IPv4 bridge/route rule messages 32 */ 33enum nss_ipv4_message_types { 34 NSS_IPV4_TX_CREATE_RULE_MSG, /**< IPv4 create rule message */ 35 NSS_IPV4_TX_DESTROY_RULE_MSG, /**< IPv4 destroy rule message */ 36 NSS_IPV4_RX_DEPRECATED0, /**< Deprecated: NSS_IPV4_RX_ESTABLISH_RULE_MSG */ 37 NSS_IPV4_RX_CONN_STATS_SYNC_MSG, /**< IPv4 connection stats sync message */ 38 NSS_IPV4_RX_NODE_STATS_SYNC_MSG, /**< IPv4 generic statistics sync message */ 39 NSS_IPV4_TX_CONN_CFG_RULE_MSG, /**< IPv4 number of connections supported rule message */ 40 NSS_IPV4_TX_CREATE_MC_RULE_MSG, /**< IPv4 multicast create rule message */ 41 NSS_IPV4_TX_CONN_STATS_SYNC_MANY_MSG, /**< IPv4 request FW to send many conn sync message */ 42 NSS_IPV4_MAX_MSG_TYPES, /**< IPv4 message max type number */ 43}; 44 45/** 46 * NA IPv4 rule creation & rule update flags. 47 */ 48#define NSS_IPV4_RULE_CREATE_FLAG_NO_SEQ_CHECK 0x01 49 /**< Do not perform TCP sequence number checks */ 50#define NSS_IPV4_RULE_CREATE_FLAG_BRIDGE_FLOW 0x02 51 /**< This is a pure bridge forwarding flow */ 52#define NSS_IPV4_RULE_CREATE_FLAG_ROUTED 0x04 53 /**< Rule is for a routed connection */ 54#define NSS_IPV4_RULE_CREATE_FLAG_DSCP_MARKING 0x08 55 /**< Rule has for a DSCP marking configured*/ 56#define NSS_IPV4_RULE_CREATE_FLAG_VLAN_MARKING 0x10 57 /**< Rule has for a VLAN marking configured*/ 58#define NSS_IPV4_RULE_UPDATE_FLAG_CHANGE_MTU 0x20 59 /**< Update MTU of connection interfaces */ 60#define NSS_IPV4_RULE_CREATE_FLAG_ICMP_NO_CME_FLUSH 0x40 61 /**< Rule for not flushing CME on ICMP pkt */ 62#define NSS_IPV4_RULE_CREATE_FLAG_L2_ENCAP 0x80 63 /**< The L2 payload is not IPv4 but consists of an encapsulating protocol that carries an IPv4 payload within it. */ 64 65 66/** 67 * IPv4 rule creation validity flags. 68 */ 69#define NSS_IPV4_RULE_CREATE_CONN_VALID 0x01 /**< IPv4 Connection is valid */ 70#define NSS_IPV4_RULE_CREATE_TCP_VALID 0x02 /**< TCP Protocol fields are valid */ 71#define NSS_IPV4_RULE_CREATE_PPPOE_VALID 0x04 /**< PPPoE fields are valid */ 72#define NSS_IPV4_RULE_CREATE_QOS_VALID 0x08 /**< QoS fields are valid */ 73#define NSS_IPV4_RULE_CREATE_VLAN_VALID 0x10 /**< VLAN fields are valid */ 74#define NSS_IPV4_RULE_CREATE_DSCP_MARKING_VALID 0x20 /**< DSCP marking fields are valid */ 75#define NSS_IPV4_RULE_CREATE_VLAN_MARKING_VALID 0x40 /**< VLAN marking fields are valid */ 76#define NSS_IPV4_RULE_CREATE_SRC_MAC_VALID 0x80 /**< Src MAC address fields are valid */ 77 78/** 79 * IPv4 multicast command rule flags 80 */ 81#define NSS_IPV4_MC_RULE_CREATE_FLAG_MC_UPDATE 0x01 /**< Multicast Rule update */ 82 83/** 84 * IPv4 multicast command validity flags 85 */ 86#define NSS_IPV4_MC_RULE_CREATE_FLAG_QOS_VALID 0x01 /**< QoS fields are valid */ 87#define NSS_IPV4_MC_RULE_CREATE_FLAG_DSCP_MARKING_VALID 0x02 /**< DSCP fields are valid */ 88#define NSS_IPV4_MC_RULE_CREATE_FLAG_INGRESS_VLAN_VALID 0x04 /**< Ingress VLAN fields are valid */ 89#define NSS_IPV4_MC_RULE_CREATE_FLAG_INGRESS_PPPOE 0x08 /**< Ingress PPPoE fields are valid */ 90 91/** 92 * IPv4 multicast connection per-interface rule flags (to be used with rule_flags field of nss_ipv4_mc_if_rule structure) 93 */ 94#define NSS_IPV4_MC_RULE_CREATE_IF_FLAG_BRIDGE_FLOW 0x01 /**< Bridge Flow */ 95#define NSS_IPV4_MC_RULE_CREATE_IF_FLAG_ROUTED_FLOW 0x02 /**< Routed flow */ 96#define NSS_IPV4_MC_RULE_CREATE_IF_FLAG_JOIN 0x04 /**< Interface has joined the flow */ 97#define NSS_IPV4_MC_RULE_CREATE_IF_FLAG_LEAVE 0x08 /**< Interface has left the flow */ 98 99/** 100 * IPv4 multicast connection per-interface valid flags (to be used with valid_flags field of nss_ipv4_mc_if_rule structure) 101 */ 102#define NSS_IPV4_MC_RULE_CREATE_IF_FLAG_VLAN_VALID 0x01 /**< VLAN fields are valid */ 103#define NSS_IPV4_MC_RULE_CREATE_IF_FLAG_PPPOE_VALID 0x02 /**< PPPoE fields are valid */ 104#define NSS_IPV4_MC_RULE_CREATE_IF_FLAG_NAT_VALID 0x4 /**< Interface is configured with Source-NAT */ 105 106/** 107 * Source MAC address valid flags (to be used with mac_valid_flags field of nss_ipv4_src_mac_rule structure) 108 */ 109#define NSS_IPV4_SRC_MAC_FLOW_VALID 0x01 /**< FLOW interface MAC address is valid */ 110#define NSS_IPV4_SRC_MAC_RETURN_VALID 0x02 /**< Return interface MAC address is valid */ 111 112/** 113 * Common 5 tuple structure 114 */ 115struct nss_ipv4_5tuple { 116 uint32_t flow_ip; /**< Flow IP address */ 117 uint32_t flow_ident; /**< Flow ident (e.g. TCP/UDP port) */ 118 uint32_t return_ip; /**< Return IP address */ 119 uint32_t return_ident; /**< Return ident (e.g. TCP/UDP port) */ 120 uint8_t protocol; /**< Protocol number */ 121 uint8_t reserved[3]; /**< Padded for alignment */ 122}; 123 124/** 125 * Connection create structure 126 */ 127struct nss_ipv4_connection_rule { 128 uint16_t flow_mac[3]; /**< Flow MAC address */ 129 uint16_t return_mac[3]; /**< Return MAC address */ 130 int32_t flow_interface_num; /**< Flow interface number */ 131 int32_t return_interface_num; /**< Return interface number */ 132 uint32_t flow_mtu; /**< Flow interface`s MTU */ 133 uint32_t return_mtu; /**< Return interface`s MTU */ 134 uint32_t flow_ip_xlate; /**< Translated flow IP address */ 135 uint32_t return_ip_xlate; /**< Translated return IP address */ 136 uint32_t flow_ident_xlate; /**< Translated flow ident (e.g. port) */ 137 uint32_t return_ident_xlate; /**< Translated return ident (e.g. port) */ 138}; 139 140/** 141 * PPPoE connection rules structure 142 */ 143struct nss_ipv4_pppoe_rule { 144 uint16_t flow_pppoe_session_id; /**< Flow direction`s PPPoE session ID. */ 145 uint16_t flow_pppoe_remote_mac[3]; /**< Flow direction`s PPPoE Server MAC address */ 146 uint16_t return_pppoe_session_id; /**< Return direction's PPPoE session ID. */ 147 uint16_t return_pppoe_remote_mac[3]; /**< Return direction's PPPoE Server MAC address */ 148}; 149 150/** 151 * DSCP connection rule structure 152 */ 153struct nss_ipv4_dscp_rule { 154 uint8_t flow_dscp; /**< Egress DSCP value for flow direction */ 155 uint8_t return_dscp; /**< Egress DSCP value for return direction */ 156 uint8_t reserved[2]; /**< Padded for alignment */ 157}; 158 159/** 160 * VLAN connection rule structure 161 */ 162struct nss_ipv4_vlan_rule { 163 uint32_t ingress_vlan_tag; /**< VLAN Tag for the ingress packets */ 164 uint32_t egress_vlan_tag; /**< VLAN Tag for egress packets */ 165}; 166 167/** 168 * TCP connection rule structure 169 */ 170struct nss_ipv4_protocol_tcp_rule { 171 uint32_t flow_max_window; /**< Flow direction's largest seen window */ 172 uint32_t return_max_window; /**< Return direction's largest seen window */ 173 uint32_t flow_end; /**< Flow direction's largest seen sequence + segment length */ 174 uint32_t return_end; /**< Return direction's largest seen sequence + segment length */ 175 uint32_t flow_max_end; /**< Flow direction's largest seen ack + max(1, win) */ 176 uint32_t return_max_end; /**< Return direction's largest seen ack + max(1, win) */ 177 uint8_t flow_window_scale; /**< Flow direction's window scaling factor */ 178 uint8_t return_window_scale; /**< Return direction's window scaling factor */ 179 uint16_t reserved; /**< Padded for alignment */ 180}; 181 182/** 183 * QoS connection rule structure 184 */ 185struct nss_ipv4_qos_rule { 186 uint32_t flow_qos_tag; /**< QoS tag associated with this rule for flow direction */ 187 uint32_t return_qos_tag; /**< QoS tag associated with this rule for return direction */ 188}; 189 190/** 191 * Src MAC address rule structure 192 */ 193struct nss_ipv4_src_mac_rule { 194 uint32_t mac_valid_flags; /**< MAC address valid flags */ 195 uint16_t flow_src_mac[3]; /**< Source MAC address for flow direction */ 196 uint16_t return_src_mac[3]; /**< Source MAC address for return direction */ 197}; 198 199/** 200 * Error types for ipv4 messages 201 */ 202enum nss_ipv4_error_response_types { 203 NSS_IPV4_UNKNOWN_MSG_TYPE = 1, /**< NSS Error: Unknown error */ 204 NSS_IPV4_CR_INVALID_PNODE_ERROR, /**< NSS Error: Invalid interface number */ 205 NSS_IPV4_CR_MISSING_CONNECTION_RULE_ERROR, /**< NSS Error: Missing connection rule */ 206 NSS_IPV4_CR_BUFFER_ALLOC_FAIL_ERROR, /**< NSS Error: Buffer allocation failure */ 207 NSS_IPV4_CR_PPPOE_SESSION_CREATION_ERROR, /**< NSS Error: Unable to create PPPoE session */ 208 NSS_IPV4_DR_NO_CONNECTION_ENTRY_ERROR, /**< NSS Error: No connection found to delete */ 209 NSS_IPV4_CR_CONN_CFG_ALREADY_CONFIGURED_ERROR, /**< NSS Error: Conn cfg already done once */ 210 NSS_IPV4_CR_CONN_CFG_NOT_MULTIPLE_OF_QUANTA_ERROR, /**< NSS Error: Conn cfg input is not multiple of quanta */ 211 NSS_IPV4_CR_CONN_CFG_EXCEEDS_LIMIT_ERROR, /**< NSS Error: Conn cfg input exceeds max supported connections*/ 212 NSS_IPV4_CR_CONN_CFG_MEM_ALLOC_FAIL_ERROR, /**< NSS Error: Conn cfg mem alloc fail at NSS FW */ 213 NSS_IPV4_CR_MULTICAST_INVALID_PROTOCOL, /**< NSS Error: Invalid L4 protocol for multicast rule create */ 214 NSS_IPV4_CR_MULTICAST_UPDATE_INVALID_FLAGS, /**< NSS Error: Invalid multicast flags for multicast update */ 215 NSS_IPV4_CR_MULTICAST_UPDATE_INVALID_IF, /**< NSS Error: Invalid interface for multicast update */ 216 NSS_IPV4_LAST /**< NSS IPv4 max error response type */ 217}; 218 219/** 220 * The IPv4 rule create sub-message structure. 221 */ 222struct nss_ipv4_rule_create_msg { 223 /* Request */ 224 uint16_t valid_flags; /**< Bit flags associated with the validity of parameters */ 225 uint16_t rule_flags; /**< Bit flags associated with the rule */ 226 227 struct nss_ipv4_5tuple tuple; /**< Holds values of the 5 tuple */ 228 229 struct nss_ipv4_connection_rule conn_rule; /**< Basic connection specific data */ 230 struct nss_ipv4_protocol_tcp_rule tcp_rule; /**< TCP related accleration parameters */ 231 struct nss_ipv4_pppoe_rule pppoe_rule; /**< PPPoE related accleration parameters */ 232 struct nss_ipv4_qos_rule qos_rule; /**< QoS related accleration parameters */ 233 struct nss_ipv4_dscp_rule dscp_rule; /**< DSCP related accleration parameters */ 234 struct nss_ipv4_vlan_rule vlan_primary_rule; /**< Primary VLAN related accleration parameters */ 235 struct nss_ipv4_vlan_rule vlan_secondary_rule; /**< Secondary VLAN related accleration parameters */ 236 struct nss_ipv4_src_mac_rule src_mac_rule; /**< Source MAC address related acceleration parameters */ 237 238 /* Response */ 239 uint32_t reserved; /**< Reserved field */ 240}; 241 242/** 243 * The IPv4 multicast rule create per-interface information 244 */ 245struct nss_ipv4_mc_if_rule { 246 uint16_t rule_flags; /**< Bit flags associated with the rule */ 247 uint16_t valid_flags; /**< Bit flags associated with the validity of parameters */ 248 uint32_t xlate_src_ip; /**< Translated flow IP address */ 249 uint32_t xlate_src_ident; /**< Translated flow ident (e.g. port) */ 250 uint32_t egress_vlan_tag[MAX_VLAN_DEPTH]; /**< VLAN Tag stack for the egress packets */ 251 uint16_t pppoe_session_id; /**< PPPoE session ID. */ 252 uint16_t pppoe_remote_mac[3]; /**< PPPoE Server MAC address */ 253 uint32_t if_num; /**< Interface number */ 254 uint32_t if_mtu; /**< Interface MTU */ 255 uint16_t if_mac[3]; /**< Interface MAC address */ 256 uint8_t reserved[2]; 257}; 258 259/** 260 * The IPv4 multicast rule create sub-message structure. 261 */ 262struct nss_ipv4_mc_rule_create_msg { 263 struct nss_ipv4_5tuple tuple; /**< Holds values of the 5 tuple */ 264 265 uint32_t rule_flags; /**< Multicast command rule flags */ 266 uint32_t valid_flags; /**< Multicast command validity flags */ 267 uint32_t src_interface_num; /**< Source i/f number (virtual/physical) */ 268 uint32_t ingress_vlan_tag[MAX_VLAN_DEPTH]; /**< VLAN Tag stack for the ingress packets */ 269 uint16_t ingress_pppoe_session_id; /**< PPPoE session ID at ingress */ 270 uint16_t ingress_pppoe_remote_mac[3]; /**< PPPoE Server MAC address */ 271 uint32_t qos_tag; /**< Qos Tag for the rule */ 272 uint16_t dest_mac[3]; /**< Destination Multicast MAC address */ 273 uint16_t if_count; /**< Number of destination interfaces */ 274 uint8_t egress_dscp; /**< Egress DSCP value for flow */ 275 uint8_t reserved[3]; 276 277 struct nss_ipv4_mc_if_rule if_rule[NSS_MC_IF_MAX]; /**< Per if information */ 278}; 279 280/** 281 * The IPv4 rule destroy sub-message structure. 282 */ 283struct nss_ipv4_rule_destroy_msg { 284 struct nss_ipv4_5tuple tuple; /**< Holds values of the 5 tuple */ 285}; 286 287/** 288 * The IPv4 rule number of supported connections sub-message structure. 289 */ 290struct nss_ipv4_rule_conn_cfg_msg { 291 uint32_t num_conn; /**< Number of supported IPv4 connections */ 292}; 293 294/** 295 * IPv4 rule sync reasons. 296 */ 297#define NSS_IPV4_RULE_SYNC_REASON_STATS 0 298 /**< Sync is to synchronize stats */ 299#define NSS_IPV4_RULE_SYNC_REASON_FLUSH 1 300 /**< Sync is to flush a cache entry */ 301#define NSS_IPV4_RULE_SYNC_REASON_EVICT 2 302 /**< Sync is to evict a cache entry */ 303#define NSS_IPV4_RULE_SYNC_REASON_DESTROY 3 304 /**< Sync is to destroy a cache entry (requested by host OS) */ 305#define NSS_IPV4_RULE_SYNC_REASON_PPPOE_DESTROY 4 306 /**< Sync is to destroy a cache entry which belongs to a particular PPPoE session */ 307 308/** 309 * The NSS IPv4 rule sync structure. 310 */ 311struct nss_ipv4_conn_sync { 312 uint32_t reserved; /**< Reserved field */ 313 uint8_t protocol; /**< Protocol number */ 314 uint32_t flow_ip; /**< Flow IP address */ 315 uint32_t flow_ip_xlate; /**< Translated flow IP address */ 316 uint32_t flow_ident; /**< Flow ident (e.g. port) */ 317 uint32_t flow_ident_xlate; /**< Translated flow ident (e.g. port) */ 318 uint32_t flow_max_window; /**< Flow direction's largest seen window */ 319 uint32_t flow_end; /**< Flow direction's largest seen sequence + segment length */ 320 uint32_t flow_max_end; /**< Flow direction's largest seen ack + max(1, win) */ 321 uint32_t flow_rx_packet_count; /**< Flow interface's RX packet count */ 322 uint32_t flow_rx_byte_count; /**< Flow interface's RX byte count */ 323 uint32_t flow_tx_packet_count; /**< Flow interface's TX packet count */ 324 uint32_t flow_tx_byte_count; /**< Flow interface's TX byte count */ 325 uint16_t flow_pppoe_session_id; /**< Flow interface`s PPPoE session ID. */ 326 uint16_t flow_pppoe_remote_mac[3]; 327 /**< Flow interface's PPPoE remote server MAC address if there is any */ 328 uint32_t return_ip; /**< Return IP address */ 329 uint32_t return_ip_xlate; /**< Translated return IP address */ 330 uint32_t return_ident; /**< Return ident (e.g. port) */ 331 uint32_t return_ident_xlate; /**< Translated return ident (e.g. port) */ 332 uint32_t return_max_window; /**< Return direction's largest seen window */ 333 uint32_t return_end; /**< Return direction's largest seen sequence + segment length */ 334 uint32_t return_max_end; /**< Return direction's largest seen ack + max(1, win) */ 335 uint32_t return_rx_packet_count; 336 /**< Return interface's RX packet count */ 337 uint32_t return_rx_byte_count; /**< Return interface's RX byte count */ 338 uint32_t return_tx_packet_count; 339 /**< Return interface's TX packet count */ 340 uint32_t return_tx_byte_count; /**< Return interface's TX byte count */ 341 uint16_t return_pppoe_session_id; 342 /**< Return interface`s PPPoE session ID. */ 343 uint16_t return_pppoe_remote_mac[3]; 344 /**< Return interface's PPPoE remote server MAC address if there is any */ 345 uint32_t inc_ticks; /**< Number of ticks since the last sync */ 346 uint32_t reason; /**< Reason for the sync */ 347 348 uint8_t flags; /**< Bit flags associated with the rule */ 349 uint32_t qos_tag; /**< QoS Tag */ 350 uint32_t cause; /**< Flush Cause */ 351}; 352 353/** 354 * The NSS IPv4 conn sync many structure. 355 */ 356struct nss_ipv4_conn_sync_many_msg { 357 /* Request */ 358 uint16_t index; /**< Request conn stats from index */ 359 uint16_t size; /**< The buf size of this msg */ 360 361 /* Response */ 362 uint16_t next; /**< FW response the next conn to be requested */ 363 uint16_t count; /**< How many conn_sync included in this msg */ 364 struct nss_ipv4_conn_sync conn_sync[]; /**< Array for the stats */ 365}; 366 367/** 368 * Exception events from bridge/route handler 369 */ 370enum exception_events_ipv4 { 371 NSS_EXCEPTION_EVENT_IPV4_ICMP_HEADER_INCOMPLETE, /**< NSS Exception event: ICMP protocol header incomplete */ 372 NSS_EXCEPTION_EVENT_IPV4_ICMP_UNHANDLED_TYPE, /**< NSS Exception event: ICMP protocol unhandled type */ 373 NSS_EXCEPTION_EVENT_IPV4_ICMP_IPV4_HEADER_INCOMPLETE, /**< NSS Exception event: ICMP IPv4 header incomplete */ 374 NSS_EXCEPTION_EVENT_IPV4_ICMP_IPV4_UDP_HEADER_INCOMPLETE, /**< NSS Exception event: ICMP IPv4 UDP header incomplete */ 375 NSS_EXCEPTION_EVENT_IPV4_ICMP_IPV4_TCP_HEADER_INCOMPLETE, /**< NSS Exception event: ICMP IPv4 TCP header incomplete */ 376 NSS_EXCEPTION_EVENT_IPV4_ICMP_IPV4_UNKNOWN_PROTOCOL, /**< NSS Exception event: ICMP IPv4 unknown protocol */ 377 NSS_EXCEPTION_EVENT_IPV4_ICMP_NO_ICME, /**< NSS Exception event: ICMP no IPv4 connection match entry */ 378 NSS_EXCEPTION_EVENT_IPV4_ICMP_FLUSH_TO_HOST, /**< NSS Exception event: ICMP flush the torn down connection to host*/ 379 NSS_EXCEPTION_EVENT_IPV4_TCP_HEADER_INCOMPLETE, /**< NSS Exception event: TCP protocol header incomplete */ 380 NSS_EXCEPTION_EVENT_IPV4_TCP_NO_ICME, /**< NSS Exception event: TCP protocol no IPv4 connection match entry */ 381 NSS_EXCEPTION_EVENT_IPV4_TCP_IP_OPTION, /**< NSS Exception event: TCP protocol ip option */ 382 NSS_EXCEPTION_EVENT_IPV4_TCP_IP_FRAGMENT, /**< NSS Exception event: TCP protocol ip fragment */ 383 NSS_EXCEPTION_EVENT_IPV4_TCP_SMALL_TTL, /**< NSS Exception event: TCP protocol small ttl */ 384 NSS_EXCEPTION_EVENT_IPV4_TCP_NEEDS_FRAGMENTATION, /**< NSS Exception event: TCP protocol needs fragmentation */ 385 NSS_EXCEPTION_EVENT_IPV4_TCP_FLAGS, /**< NSS Exception event: TCP protocol flags */ 386 NSS_EXCEPTION_EVENT_IPV4_TCP_SEQ_EXCEEDS_RIGHT_EDGE, /**< NSS Exception event: TCP protocol sequential exceeds right edge */ 387 NSS_EXCEPTION_EVENT_IPV4_TCP_SMALL_DATA_OFFS, /**< NSS Exception event: TCP protocol small data offs */ 388 NSS_EXCEPTION_EVENT_IPV4_TCP_BAD_SACK, /**< NSS Exception event: TCP protocol bad sack */ 389 NSS_EXCEPTION_EVENT_IPV4_TCP_BIG_DATA_OFFS, /**< NSS Exception event: TCP protocol big data offs */ 390 NSS_EXCEPTION_EVENT_IPV4_TCP_SEQ_BEFORE_LEFT_EDGE, /**< NSS Exception event: TCP protocol sequential before left edge */ 391 NSS_EXCEPTION_EVENT_IPV4_TCP_ACK_EXCEEDS_RIGHT_EDGE, /**< NSS Exception event: TCP protocol ack exceeds right edge */ 392 NSS_EXCEPTION_EVENT_IPV4_TCP_ACK_BEFORE_LEFT_EDGE, /**< NSS Exception event: TCP protocol ack before left edge */ 393 NSS_EXCEPTION_EVENT_IPV4_UDP_HEADER_INCOMPLETE, /**< NSS Exception event: UDP protocol header incomplete */ 394 NSS_EXCEPTION_EVENT_IPV4_UDP_NO_ICME, /**< NSS Exception event: UDP protocol no IPv4 connection match entry */ 395 NSS_EXCEPTION_EVENT_IPV4_UDP_IP_OPTION, /**< NSS Exception event: UDP protocol no ip option */ 396 NSS_EXCEPTION_EVENT_IPV4_UDP_IP_FRAGMENT, /**< NSS Exception event: UDP protocol no ip fragment */ 397 NSS_EXCEPTION_EVENT_IPV4_UDP_SMALL_TTL, /**< NSS Exception event: UDP protocol small ttl */ 398 NSS_EXCEPTION_EVENT_IPV4_UDP_NEEDS_FRAGMENTATION, /**< NSS Exception event: UDP protocol needs fragmentation */ 399 NSS_EXCEPTION_EVENT_IPV4_WRONG_TARGET_MAC, /**< NSS Exception event: IPv4 wrong target MAC address */ 400 NSS_EXCEPTION_EVENT_IPV4_HEADER_INCOMPLETE, /**< NSS Exception event: Incomplete IPv4 header */ 401 NSS_EXCEPTION_EVENT_IPV4_BAD_TOTAL_LENGTH, /**< NSS Exception event: IPv4 bad total length */ 402 NSS_EXCEPTION_EVENT_IPV4_BAD_CHECKSUM, /**< NSS Exception event: IPv4 bad checksum */ 403 NSS_EXCEPTION_EVENT_IPV4_NON_INITIAL_FRAGMENT, /**< NSS Exception event: IPv4 non initial fragment */ 404 NSS_EXCEPTION_EVENT_IPV4_DATAGRAM_INCOMPLETE, /**< NSS Exception event: IPv4 datagram incomplete */ 405 NSS_EXCEPTION_EVENT_IPV4_OPTIONS_INCOMPLETE, /**< NSS Exception event: IPv4 options incomplete */ 406 NSS_EXCEPTION_EVENT_IPV4_UNKNOWN_PROTOCOL, /**< NSS Exception event: IPv4 unknown protocol */ 407 NSS_EXCEPTION_EVENT_IPV4_ESP_HEADER_INCOMPLETE, /**< NSS Exception event: IPv4 esp header incomplete */ 408 NSS_EXCEPTION_EVENT_IPV4_ESP_NO_ICME, /**< NSS Exception event: IPv4 esp no connection match entry */ 409 NSS_EXCEPTION_EVENT_IPV4_ESP_IP_OPTION, /**< NSS Exception event: IPv4 esp ip option */ 410 NSS_EXCEPTION_EVENT_IPV4_ESP_IP_FRAGMENT, /**< NSS Exception event: IPv4 esp ip fragment */ 411 NSS_EXCEPTION_EVENT_IPV4_ESP_SMALL_TTL, /**< NSS Exception event: IPv4 esp small ttl */ 412 NSS_EXCEPTION_EVENT_IPV4_ESP_NEEDS_FRAGMENTATION, /**< NSS Exception event: IPv4 esp needs fragmentation */ 413 NSS_EXCEPTION_EVENT_IPV4_IVID_MISMATCH, /**< NSS Exception event: IPv4 ivid mismatch */ 414 NSS_EXCEPTION_EVENT_IPV4_IVID_MISSING, /**< NSS Exception event: IPv4 ivid missing */ 415 NSS_EXCEPTION_EVENT_IPV4_6RD_NO_ICME, /**< NSS Exception event: IPv4 6RD no connection match entry */ 416 NSS_EXCEPTION_EVENT_IPV4_6RD_IP_OPTION, /**< NSS Exception event: IPv4 6RD ip option */ 417 NSS_EXCEPTION_EVENT_IPV4_6RD_IP_FRAGMENT, /**< NSS Exception event: IPv4 6RD ip fragment */ 418 NSS_EXCEPTION_EVENT_IPV4_6RD_NEEDS_FRAGMENTATION, /**< NSS Exception event: IPv4 6RD needs fragmentation */ 419 NSS_EXCEPTION_EVENT_IPV4_DSCP_MARKING_MISMATCH, /**< NSS Exception event: IPv4 dscp marking mismatch */ 420 NSS_EXCEPTION_EVENT_IPV4_VLAN_MARKING_MISMATCH, /**< NSS Exception event: IPv4 vlan marking mismatch */ 421 NSS_EXCEPTION_EVENT_IPV4_INTERFACE_MISMATCH, /**< NSS Exception event: IPv4 source interface mismatch */ 422 NSS_EXCEPTION_EVENT_GRE_HEADER_INCOMPLETE, /**< NSS Exception event: IPv4 GRE header is incomplete */ 423 NSS_EXCEPTION_EVENT_GRE_NO_ICME, /**< NSS Exception event: IPV4 GRE no connection match entry */ 424 NSS_EXCEPTION_EVENT_GRE_IP_OPTION, /**< NSS Exception event: IPV4 GRE ip option */ 425 NSS_EXCEPTION_EVENT_GRE_IP_FRAGMENT, /**< NSS Exception event: IPV4 GRE ip fragment */ 426 NSS_EXCEPTION_EVENT_GRE_SMALL_TTL, /**< NSS Exception event: IPV4 GRE small ttl */ 427 NSS_EXCEPTION_EVENT_GRE_NEEDS_FRAGMENTATION, /**< NSS Exception event: IPV4 GRE needs fragmentation */ 428 NSS_EXCEPTION_EVENT_IPV4_DESTROY, /**< NSS Exception event: IPv4 Destroy */ 429 NSS_EXCEPTION_EVENT_IPV4_FRAG_DF_SET, /**< NSS Exception event: IPv4 fragmentation needed, but DF set */ 430 NSS_EXCEPTION_EVENT_IPV4_FRAG_FAIL, /**< NSS Exception event: IPv4 fragmentation failure */ 431 NSS_EXCEPTION_EVENT_IPV4_ICMP_IPV4_UDPLITE_HEADER_INCOMPLETE, /**< NSS Exception event: ICMP IPv4 UDPLite header incomplete */ 432 NSS_EXCEPTION_EVENT_IPV4_UDPLITE_HEADER_INCOMPLETE, /**< NSS Exception event: UDPLite protocol header incomplete */ 433 NSS_EXCEPTION_EVENT_IPV4_UDPLITE_NO_ICME, /**< NSS Exception event: UDPLite protocol no IPv6 connection match entry */ 434 NSS_EXCEPTION_EVENT_IPV4_UDPLITE_IP_OPTION, /**< NSS Exception event: UDPLite protocol no ip option */ 435 NSS_EXCEPTION_EVENT_IPV4_UDPLITE_IP_FRAGMENT, /**< NSS Exception event: UDPLite protocol no ip fragment */ 436 NSS_EXCEPTION_EVENT_IPV4_UDPLITE_SMALL_TTL, /**< NSS Exception event: UDPLite protocol small ttl */ 437 NSS_EXCEPTION_EVENT_IPV4_UDPLITE_NEEDS_FRAGMENTATION, /**< NSS Exception event: UDPLite protocol needs fragmentation */ 438 NSS_EXCEPTION_EVENT_IPV4_MC_UDP_NO_ICME, /**< NSS Exception event: UDP protocol no multicast IPv4 connection match entry */ 439 NSS_EXCEPTION_EVENT_IPV4_MC_MEM_ALLOC_FAILURE, /**< NSS Exception event: IPv4 Multicast Memory allocation failure */ 440 NSS_EXCEPTION_EVENT_IPV4_MC_UPDATE_FAILURE, /**< NSS Exception event: IPv4 Multicast rule update failure */ 441 NSS_EXCEPTION_EVENT_IPV4_MC_PBUF_ALLOC_FAILURE, /**< NSS Exception event: IPv4 Multicast buffer allocation failure */ 442 NSS_EXCEPTION_EVENT_IPV4_MAX /**< IPv4 exception events max type number */ 443}; 444 445/** 446 * IPv4 node statistics structure 447 */ 448struct nss_ipv4_node_sync { 449 struct nss_cmn_node_stats node_stats; 450 /**< Common node stats for IPv4 */ 451 uint32_t ipv4_connection_create_requests; 452 /**< Number of IPv4 connection create requests */ 453 uint32_t ipv4_connection_create_collisions; 454 /**< Number of IPv4 connection create requests that collided with existing entries */ 455 uint32_t ipv4_connection_create_invalid_interface; 456 /**< Number of IPv4 connection create requests that had invalid interface */ 457 uint32_t ipv4_connection_destroy_requests; 458 /**< Number of IPv4 connection destroy requests */ 459 uint32_t ipv4_connection_destroy_misses; 460 /**< Number of IPv4 connection destroy requests that missed the cache */ 461 uint32_t ipv4_connection_hash_hits; 462 /**< Number of IPv4 connection hash hits */ 463 uint32_t ipv4_connection_hash_reorders; 464 /**< Number of IPv4 connection hash reorders */ 465 uint32_t ipv4_connection_flushes; 466 /**< Number of IPv4 connection flushes */ 467 uint32_t ipv4_connection_evictions; 468 /**< Number of IPv4 connection evictions */ 469 uint32_t ipv4_fragmentations; 470 /**< Number of successful IPv4 fragmentations performed*/ 471 uint32_t ipv4_mc_connection_create_requests; 472 /**< Number of IPv4 Multicast connection create requests */ 473 uint32_t ipv4_mc_connection_update_requests; 474 /**< Number of IPv4 Multicast connection update requests */ 475 uint32_t ipv4_mc_connection_create_invalid_interface; 476 /**< Number of IPv4 Multicast connection create requests that had invalid interface */ 477 uint32_t ipv4_mc_connection_destroy_requests; 478 /**< Number of IPv4 Multicast connection destroy requests */ 479 uint32_t ipv4_mc_connection_destroy_misses; 480 /**< Number of IPv4 Multicast connection destroy requests that missed the cache */ 481 uint32_t ipv4_mc_connection_flushes; 482 /**< Number of IPv4 Multicast connection flushes */ 483 uint32_t exception_events[NSS_EXCEPTION_EVENT_IPV4_MAX]; 484 /**< Number of IPv4 exception events */ 485}; 486 487/** 488 * Message structure to send/receive IPv4 bridge/route commands 489 */ 490struct nss_ipv4_msg { 491 struct nss_cmn_msg cm; /**< Message Header */ 492 union { 493 struct nss_ipv4_rule_create_msg rule_create; /**< Message: rule create */ 494 struct nss_ipv4_rule_destroy_msg rule_destroy; /**< Message: rule destroy */ 495 struct nss_ipv4_conn_sync conn_stats; /**< Message: connection stats sync */ 496 struct nss_ipv4_node_sync node_stats; /**< Message: node stats sync */ 497 struct nss_ipv4_rule_conn_cfg_msg rule_conn_cfg; /**< Message: rule connections supported */ 498 struct nss_ipv4_mc_rule_create_msg mc_rule_create; /**< Message: Multicast rule create */ 499 struct nss_ipv4_conn_sync_many_msg conn_stats_many; /**< Message: connection stats sync */ 500 } msg; 501}; 502 503extern int nss_ipv6_conn_cfg; 504 505#ifdef __KERNEL__ /* only kernel will use */ 506 507/** 508 * @brief Return the maximum number of IPv4 connections that the NSS acceleration engine supports 509 * 510 * @return int The number of connections that can be accelerated by the NSS 511 */ 512int nss_ipv4_max_conn_count(void); 513 514/** 515 * Callback to be called when IPv4 message is received 516 */ 517typedef void (*nss_ipv4_msg_callback_t)(void *app_data, struct nss_ipv4_msg *msg); 518 519/** 520 * @brief Transmit an IPv4 message to the NSS 521 * 522 * @param nss_ctx NSS context 523 * @param msg The IPv4 message 524 * 525 * @return nss_tx_status_t The status of the Tx operation 526 */ 527extern nss_tx_status_t nss_ipv4_tx(struct nss_ctx_instance *nss_ctx, struct nss_ipv4_msg *msg); 528 529/** 530 * @brief Transmit an IPv4 message to the NSS with specified size 531 * 532 * @param nss_ctx NSS context 533 * @param msg The IPv4 message 534 * @param size Actual size of this msg 535 * 536 * @return nss_tx_status_t The status of the Tx operation 537 */ 538extern nss_tx_status_t nss_ipv4_tx_with_size(struct nss_ctx_instance *nss_ctx, struct nss_ipv4_msg *msg, uint32_t size); 539 540/** 541 * @brief Register a notifier callback for IPv4 messages from NSS 542 * 543 * @param cb The callback pointer 544 * @param app_data The application context for this message 545 * 546 * @return struct nss_ctx_instance * The NSS context 547 */ 548extern struct nss_ctx_instance *nss_ipv4_notify_register(nss_ipv4_msg_callback_t cb, void *app_data); 549 550/** 551 * @brief Un-Register a notifier callback for IPv4 messages from NSS 552 * 553 * @return None 554 */ 555extern void nss_ipv4_notify_unregister(void); 556 557/** 558 * @brief Get the NSS context which is managing IPv4 559 * 560 * @return struct nss_ctx_instance * The NSS context 561 */ 562extern struct nss_ctx_instance *nss_ipv4_get_mgr(void); 563 564/** 565 * @brief IPv4 Register Handler 566 * 567 * @return None 568 */ 569extern void nss_ipv4_register_handler(void); 570 571/** 572 * @brief IPv4 sysctl register 573 * 574 * @return None 575 */ 576extern void nss_ipv4_register_sysctl(void); 577 578/** 579 * @brief IPv4 sysctl unregister 580 * 581 * @return None 582 */ 583extern void nss_ipv4_unregister_sysctl(void); 584 585/** 586 * @brief IPv4 message init 587 * 588 * @return None 589 */ 590extern void nss_ipv4_msg_init(struct nss_ipv4_msg *nim, uint16_t if_num, uint32_t type, uint32_t len, 591 nss_ipv4_msg_callback_t cb, void *app_data); 592 593/** 594 * @brief Set max number of IPv4 connections. 595 * 596 * @return 0 on success 597 */ 598extern int nss_ipv4_update_conn_count(int ipv4_max_conn); 599 600#endif /*__KERNEL__ */ 601#endif /* __NSS_IPV4_H */ 602