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_tun6rd.h |
| 19 | * NSS TO HLOS interface definitions. |
| 20 | */ |
| 21 | |
| 22 | #ifndef __NSS_TUN6RD_H |
| 23 | #define __NSS_TUN6RD_H |
| 24 | |
| 25 | /* |
| 26 | * 6RD (IPv6 in IPv4) tunnel messages |
| 27 | */ |
| 28 | |
| 29 | /** |
| 30 | * Request/Response types |
| 31 | */ |
| 32 | enum nss_tun6rd_metadata_types { |
| 33 | NSS_TUN6RD_TX_IF_CREATE, |
| 34 | NSS_TUN6RD_TX_IF_DESTROY, |
| 35 | NSS_TUN6RD_RX_STATS_SYNC, |
| 36 | NSS_TUN6RD_MAX, |
| 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * 6rd configuration command structure |
| 41 | */ |
| 42 | struct nss_tun6rd_create_msg { |
| 43 | uint32_t prefix[4]; /* 6rd prefix */ |
| 44 | uint32_t relay_prefix; /* Relay prefix */ |
| 45 | uint16_t prefixlen; /* 6rd prefix len */ |
| 46 | uint16_t relay_prefixlen;/* Relay prefix length*/ |
| 47 | uint32_t saddr; /* Tunnel source address */ |
| 48 | uint32_t daddr; /* Tunnel destination addresss */ |
| 49 | uint8_t tos; /* Tunnel tos field */ |
| 50 | uint8_t ttl; /* Tunnel ttl field */ |
| 51 | uint16_t reserved; /* Reserved field */ |
| 52 | }; |
| 53 | |
| 54 | /** |
| 55 | * 6rd tunnel interface down command structure |
| 56 | */ |
| 57 | struct nss_tun6rd_destroy_msg { |
| 58 | uint32_t prefix[4]; /* Place holder */ |
| 59 | }; |
| 60 | |
| 61 | /** |
| 62 | * The NSS tun6rd statistics sync structure. |
| 63 | */ |
| 64 | struct nss_tun6rd_stats_sync_msg { |
| 65 | struct nss_cmn_node_stats node_stats; |
| 66 | }; |
| 67 | |
| 68 | /** |
| 69 | * Message structure to send/receive 6rd commands |
| 70 | */ |
| 71 | struct nss_tun6rd_msg { |
| 72 | struct nss_cmn_msg cm; /* Message Header */ |
| 73 | union { |
| 74 | struct nss_tun6rd_create_msg tun6rd_create; /* Message: Create 6rd tunnel */ |
| 75 | struct nss_tun6rd_destroy_msg tun6rd_destroy; /* Message: Destroy 6rd tunnel */ |
| 76 | struct nss_tun6rd_stats_sync_msg stats_sync; /* Message: interface stats sync */ |
| 77 | } msg; |
| 78 | }; |
| 79 | |
| 80 | /** |
| 81 | * Callback to receive tun6rd messages |
| 82 | */ |
| 83 | typedef void (*nss_tun6rd_msg_callback_t)(void *app_data, struct nss_tun6rd_msg *msg); |
| 84 | |
| 85 | /** |
| 86 | * API to send tun6rd messages |
| 87 | **/ |
| 88 | extern nss_tx_status_t nss_tun6rd_tx(struct nss_ctx_instance *nss_ctx, struct nss_tun6rd_msg *msg); |
| 89 | |
| 90 | /** |
| 91 | * Callback to receive 6rd callback |
| 92 | */ |
| 93 | typedef void (*nss_tun6rd_callback_t)(void *app_data, void *os_buf); |
| 94 | |
| 95 | /** |
| 96 | * @brief Register to send/receive 6rd tunnel messages to NSS |
| 97 | * |
| 98 | * @param tun6rd_callback Callback |
| 99 | * @param ctx 6rd tunnel context |
| 100 | * |
| 101 | * @return void* NSS context |
| 102 | */ |
| 103 | extern struct nss_ctx_instance *nss_register_tun6rd_if(uint32_t if_num, nss_tun6rd_callback_t tun6rd_callback, |
| 104 | nss_tun6rd_msg_callback_t msg_callback, struct net_device *netdev); |
| 105 | |
| 106 | /** |
| 107 | * @brief Unregister 6rd tunnel interface with NSS |
| 108 | */ |
| 109 | extern void nss_unregister_tun6rd_if(uint32_t if_num); |
| 110 | |
| 111 | #endif /* __NSS_TUN6RD_H */ |