Radha krishna Simha Jiguru | 62a29e6 | 2014-04-04 17:28:53 +0530 | [diff] [blame] | 1 | /* |
| 2 | * ************************************************************************** |
| 3 | * Copyright (c) 2014, Qualcomm Atheros, Inc. |
| 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_tunipip6.h |
| 19 | * NSS TO HLOS interface definitions. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __NSS_TUNIPIP6_H |
| 23 | #define __NSS_TUNIPIP6_H |
| 24 | |
| 25 | /* |
| 26 | * DS-Lite (IPv4 in IPv6) tunnel messages |
| 27 | */ |
| 28 | |
| 29 | /** |
| 30 | * Request/Response types |
| 31 | */ |
| 32 | enum nss_tunipip6_metadata_types { |
| 33 | NSS_TUNIPIP6_TX_IF_CREATE, |
| 34 | NSS_TUNIPIP6_TX_IF_DESTROY, |
| 35 | NSS_TUNIPIP6_RX_STATS_SYNC, |
| 36 | NSS_TUNIPIP6_MAX, |
| 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * DS-Lite configuration command structure |
| 41 | */ |
| 42 | struct nss_tunipip6_create_msg { |
| 43 | uint32_t saddr[4]; /* Tunnel source address */ |
| 44 | uint32_t daddr[4]; /* Tunnel destination address */ |
| 45 | uint32_t flowlabel; /* Tunnel ipv6 flowlabel */ |
| 46 | uint32_t flags; /* Tunnel additional flags */ |
| 47 | uint8_t hop_limit; /* Tunnel ipv6 hop limit */ |
| 48 | uint8_t reserved; /* Place holder */ |
| 49 | uint16_t reserved1; /* Place holder */ |
| 50 | }; |
| 51 | |
| 52 | /** |
| 53 | * DS-Lite tunnel interface down command structure |
| 54 | */ |
| 55 | struct nss_tunipip6_destroy_msg { |
| 56 | uint32_t reserved; /* Place holder */ |
| 57 | }; |
| 58 | |
| 59 | /** |
| 60 | * The NSS DS-Lite statistics sync structure. |
| 61 | */ |
| 62 | struct nss_tunipip6_stats_sync_msg { |
| 63 | struct nss_cmn_node_stats node_stats; |
| 64 | }; |
| 65 | |
| 66 | /** |
| 67 | * Message structure to send/receive DS-Lite commands |
| 68 | */ |
| 69 | struct nss_tunipip6_msg { |
| 70 | struct nss_cmn_msg cm; /* Message Header */ |
| 71 | union { |
| 72 | struct nss_tunipip6_create_msg tunipip6_create; /* Message: Create DS-Lite tunnel */ |
| 73 | struct nss_tunipip6_destroy_msg tunipip6_destroy; /* Message: Destroy DS-Lite tunnel */ |
| 74 | struct nss_tunipip6_stats_sync_msg stats_sync; /* Message: interface stats sync */ |
| 75 | } msg; |
| 76 | }; |
| 77 | |
| 78 | /** |
| 79 | * Callback to receive tun6rd messages |
| 80 | */ |
| 81 | typedef void (*nss_tunipip6_msg_callback_t)(void *app_data, struct nss_tunipip6_msg *msg); |
| 82 | |
| 83 | /** |
| 84 | * API to send tun6rd messages |
| 85 | */ |
| 86 | extern nss_tx_status_t nss_tunipip6_tx(struct nss_ctx_instance *nss_ctx, struct nss_tunipip6_msg *msg); |
| 87 | |
| 88 | /** |
| 89 | * Callback to receive ipip6 callback |
| 90 | */ |
| 91 | typedef void (*nss_tunipip6_callback_t)(void *app_data, void *os_buf); |
| 92 | |
| 93 | /* |
| 94 | * @brief Register to send/receive ipip6 tunnel messages to NSS |
| 95 | * |
| 96 | * @param tunipip6_callback Callback |
| 97 | * @param ctx ipip6 tunnel context |
| 98 | * |
| 99 | * @return void* NSS context |
| 100 | */ |
| 101 | extern struct nss_ctx_instance *nss_register_tunipip6_if(uint32_t if_num, nss_tunipip6_callback_t tunipip6_callback, |
| 102 | nss_tunipip6_msg_callback_t event_callback, struct net_device *netdev); |
| 103 | |
| 104 | /** |
| 105 | * @brief Unregister ipip6 tunnel interface with NSS |
| 106 | */ |
| 107 | extern void nss_unregister_tunipip6_if(uint32_t if_num); |
| 108 | |
| 109 | #endif /* __NSS_TUN6RD_H */ |