blob: 9e6d286cc61121a97eec9e1074a6c35c105d11a6 [file] [log] [blame]
Sol Kavy879eb8b2014-04-07 19:11:31 -07001/*
2 **************************************************************************
Vijay Dewangan488e5372014-12-29 21:40:11 -08003 * Copyright (c) 2014 - 2015, The Linux Foundation. All rights reserved.
Sol Kavy879eb8b2014-04-07 19:11:31 -07004 * 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_ipv6.c
19 * NSS IPv6 APIs
20 */
Sol Kavy879eb8b2014-04-07 19:11:31 -070021#include "nss_tx_rx_common.h"
Sol Kavy879eb8b2014-04-07 19:11:31 -070022
Vijay Dewangan4861f4e2014-10-14 16:56:35 -070023int nss_ipv6_conn_cfg __read_mostly = NSS_DEFAULT_NUM_CONN;
24static struct nss_conn_cfg_pvt i6cfgp;
Vijay Dewangan9db18752014-09-15 16:25:01 -070025
Sol Kavy879eb8b2014-04-07 19:11:31 -070026/*
Gareth Williams958aa822015-02-04 19:36:39 +000027 * nss_ipv6_max_conn_count()
28 * Return the maximum number of IPv6 connections that the NSS acceleration engine supports.
29 */
30int nss_ipv6_max_conn_count(void)
31{
32 return nss_ipv6_conn_cfg;
33}
34EXPORT_SYMBOL(nss_ipv6_max_conn_count);
35
36/*
Sol Kavy879eb8b2014-04-07 19:11:31 -070037 * nss_ipv6_driver_conn_sync_update()
38 * Update driver specific information from the messsage.
39 */
40static void nss_ipv6_driver_conn_sync_update(struct nss_ctx_instance *nss_ctx, struct nss_ipv6_conn_sync *nics)
41{
42 struct nss_top_instance *nss_top = nss_ctx->nss_top;
Sol Kavy879eb8b2014-04-07 19:11:31 -070043
44 /*
45 * Update statistics maintained by NSS driver
46 */
47 spin_lock_bh(&nss_top->stats_lock);
48 nss_top->stats_ipv6[NSS_STATS_IPV6_ACCELERATED_RX_PKTS] += nics->flow_rx_packet_count + nics->return_rx_packet_count;
49 nss_top->stats_ipv6[NSS_STATS_IPV6_ACCELERATED_RX_BYTES] += nics->flow_rx_byte_count + nics->return_rx_byte_count;
50 nss_top->stats_ipv6[NSS_STATS_IPV6_ACCELERATED_TX_PKTS] += nics->flow_tx_packet_count + nics->return_tx_packet_count;
51 nss_top->stats_ipv6[NSS_STATS_IPV6_ACCELERATED_TX_BYTES] += nics->flow_tx_byte_count + nics->return_tx_byte_count;
Abhishek Rastogi55f39452014-05-08 19:23:29 +053052 spin_unlock_bh(&nss_top->stats_lock);
Sol Kavy879eb8b2014-04-07 19:11:31 -070053}
54
55/*
Murat Sezgin0c0561d2014-04-09 18:55:58 -070056 * nss_ipv6_driver_node_sync_update)
57 * Update driver specific information from the messsage.
58 */
59static void nss_ipv6_driver_node_sync_update(struct nss_ctx_instance *nss_ctx, struct nss_ipv6_node_sync *nins)
60{
61 struct nss_top_instance *nss_top = nss_ctx->nss_top;
62 uint32_t i;
63
64 /*
65 * Update statistics maintained by NSS driver
66 */
67 spin_lock_bh(&nss_top->stats_lock);
68 nss_top->stats_node[NSS_IPV6_RX_INTERFACE][NSS_STATS_NODE_RX_PKTS] += nins->node_stats.rx_packets;
69 nss_top->stats_node[NSS_IPV6_RX_INTERFACE][NSS_STATS_NODE_RX_BYTES] += nins->node_stats.rx_bytes;
70 nss_top->stats_node[NSS_IPV6_RX_INTERFACE][NSS_STATS_NODE_RX_DROPPED] += nins->node_stats.rx_dropped;
71 nss_top->stats_node[NSS_IPV6_RX_INTERFACE][NSS_STATS_NODE_TX_PKTS] += nins->node_stats.tx_packets;
72 nss_top->stats_node[NSS_IPV6_RX_INTERFACE][NSS_STATS_NODE_TX_BYTES] += nins->node_stats.tx_bytes;
73
Murat Sezgin0c0561d2014-04-09 18:55:58 -070074 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_CREATE_REQUESTS] += nins->ipv6_connection_create_requests;
75 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_CREATE_COLLISIONS] += nins->ipv6_connection_create_collisions;
76 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_CREATE_INVALID_INTERFACE] += nins->ipv6_connection_create_invalid_interface;
77 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_DESTROY_REQUESTS] += nins->ipv6_connection_destroy_requests;
78 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_DESTROY_MISSES] += nins->ipv6_connection_destroy_misses;
79 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_HASH_HITS] += nins->ipv6_connection_hash_hits;
80 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_HASH_REORDERS] += nins->ipv6_connection_hash_reorders;
81 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_FLUSHES] += nins->ipv6_connection_flushes;
82 nss_top->stats_ipv6[NSS_STATS_IPV6_CONNECTION_EVICTIONS] += nins->ipv6_connection_evictions;
83
84 for (i = 0; i < NSS_EXCEPTION_EVENT_IPV6_MAX; i++) {
85 nss_top->stats_if_exception_ipv6[i] += nins->exception_events[i];
86 }
87 spin_unlock_bh(&nss_top->stats_lock);
88}
89
90/*
Sol Kavy879eb8b2014-04-07 19:11:31 -070091 * nss_ipv6_rx_msg_handler()
92 * Handle NSS -> HLOS messages for IPv6 bridge/route
93 */
94static void nss_ipv6_rx_msg_handler(struct nss_ctx_instance *nss_ctx, struct nss_cmn_msg *ncm, __attribute__((unused))void *app_data)
95{
96 struct nss_ipv6_msg *nim = (struct nss_ipv6_msg *)ncm;
97 nss_ipv6_msg_callback_t cb;
98
99 BUG_ON(ncm->interface != NSS_IPV6_RX_INTERFACE);
100
101 /*
102 * Is this a valid request/response packet?
103 */
Murat Sezgin5c8c7362014-09-02 17:58:21 -0700104 if (ncm->type >= NSS_IPV6_MAX_MSG_TYPES) {
Sol Kavy879eb8b2014-04-07 19:11:31 -0700105 nss_warning("%p: received invalid message %d for IPv6 interface", nss_ctx, nim->cm.type);
106 return;
107 }
108
109 if (ncm->len > sizeof(struct nss_ipv6_msg)) {
110 nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface);
111 return;
112 }
113
114 /*
115 * Log failures
116 */
117 nss_core_log_msg_failures(nss_ctx, ncm);
118
119 /*
120 * Handle deprecated messages. Eventually these messages should be removed.
121 */
122 switch (nim->cm.type) {
Murat Sezgin0c0561d2014-04-09 18:55:58 -0700123 case NSS_IPV6_RX_NODE_STATS_SYNC_MSG:
124 /*
125 * Update driver statistics on node sync.
126 */
127 nss_ipv6_driver_node_sync_update(nss_ctx, &nim->msg.node_stats);
128 break;
129
Sol Kavy879eb8b2014-04-07 19:11:31 -0700130 case NSS_IPV6_RX_CONN_STATS_SYNC_MSG:
131 /*
132 * Update driver statistics on connection sync.
133 */
134 nss_ipv6_driver_conn_sync_update(nss_ctx, &nim->msg.conn_stats);
Sakthi Vignesh Radhakrishnan515f8c22014-06-21 15:04:19 -0700135 break;
Sol Kavy879eb8b2014-04-07 19:11:31 -0700136 }
Abhishek Rastogi55f39452014-05-08 19:23:29 +0530137
Sol Kavy879eb8b2014-04-07 19:11:31 -0700138 /*
139 * Update the callback and app_data for NOTIFY messages, IPv6 sends all notify messages
140 * to the same callback/app_data.
141 */
142 if (nim->cm.response == NSS_CMM_RESPONSE_NOTIFY) {
143 ncm->cb = (uint32_t)nss_ctx->nss_top->ipv6_callback;
144 ncm->app_data = (uint32_t)nss_ctx->nss_top->ipv6_ctx;
145 }
146
147 /*
148 * Do we have a callback?
149 */
150 if (!ncm->cb) {
151 return;
152 }
153
154 /*
155 * Callback
156 */
157 cb = (nss_ipv6_msg_callback_t)ncm->cb;
158 cb((void *)ncm->app_data, nim);
159}
160
161/*
162 * nss_ipv6_tx()
163 * Transmit an ipv6 message to the FW.
164 */
165nss_tx_status_t nss_ipv6_tx(struct nss_ctx_instance *nss_ctx, struct nss_ipv6_msg *nim)
166{
167 struct nss_ipv6_msg *nim2;
168 struct nss_cmn_msg *ncm = &nim->cm;
169 struct sk_buff *nbuf;
170 int32_t status;
171
172 NSS_VERIFY_CTX_MAGIC(nss_ctx);
173 if (unlikely(nss_ctx->state != NSS_CORE_STATE_INITIALIZED)) {
174 nss_warning("%p: ipv6 msg dropped as core not ready", nss_ctx);
175 return NSS_TX_FAILURE_NOT_READY;
176 }
177
178 /*
179 * Sanity check the message
180 */
181 if (ncm->interface != NSS_IPV6_RX_INTERFACE) {
182 nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface);
183 return NSS_TX_FAILURE;
184 }
185
Murat Sezgin5c8c7362014-09-02 17:58:21 -0700186 if (ncm->type >= NSS_IPV6_MAX_MSG_TYPES) {
Sol Kavy879eb8b2014-04-07 19:11:31 -0700187 nss_warning("%p: message type out of range: %d", nss_ctx, ncm->type);
188 return NSS_TX_FAILURE;
189 }
190
191 if (ncm->len > sizeof(struct nss_ipv6_msg)) {
192 nss_warning("%p: tx request for another interface: %d", nss_ctx, ncm->interface);
193 return NSS_TX_FAILURE;
194 }
195
Pamidipati, Vijayb6e38842014-09-16 10:26:05 +0530196 nbuf = dev_alloc_skb(NSS_NBUF_PAYLOAD_SIZE);
Sol Kavy879eb8b2014-04-07 19:11:31 -0700197 if (unlikely(!nbuf)) {
Sundarajan Srinivasan62fee7e2015-01-22 11:13:10 -0800198 NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_NBUF_ALLOC_FAILS]);
Sol Kavy879eb8b2014-04-07 19:11:31 -0700199 nss_warning("%p: msg dropped as command allocation failed", nss_ctx);
200 return NSS_TX_FAILURE;
201 }
202
203 /*
204 * Copy the message to our skb.
205 */
206 nim2 = (struct nss_ipv6_msg *)skb_put(nbuf, sizeof(struct nss_ipv6_msg));
207 memcpy(nim2, nim, sizeof(struct nss_ipv6_msg));
208
209 status = nss_core_send_buffer(nss_ctx, 0, nbuf, NSS_IF_CMD_QUEUE, H2N_BUFFER_CTRL, 0);
210 if (status != NSS_CORE_STATUS_SUCCESS) {
Pamidipati, Vijayb6e38842014-09-16 10:26:05 +0530211 dev_kfree_skb_any(nbuf);
Sol Kavy879eb8b2014-04-07 19:11:31 -0700212 nss_warning("%p: Unable to enqueue 'Destroy IPv6' rule\n", nss_ctx);
213 return NSS_TX_FAILURE;
214 }
215
216 nss_hal_send_interrupt(nss_ctx->nmap, nss_ctx->h2n_desc_rings[NSS_IF_CMD_QUEUE].desc_ring.int_bit,
217 NSS_REGS_H2N_INTR_STATUS_DATA_COMMAND_QUEUE);
218
219 NSS_PKT_STATS_INCREMENT(nss_ctx, &nss_ctx->nss_top->stats_drv[NSS_STATS_DRV_TX_CMD_REQ]);
220 return NSS_TX_SUCCESS;
221}
222
223/*
224 **********************************
225 Register/Unregister/Miscellaneous APIs
226 **********************************
227 */
228
229/*
230 * nss_ipv6_notify_register()
231 * Register to received IPv6 events.
232 *
233 * NOTE: Do we want to pass an nss_ctx here so that we can register for ipv6 on any core?
234 */
235struct nss_ctx_instance *nss_ipv6_notify_register(nss_ipv6_msg_callback_t cb, void *app_data)
236{
237 /*
238 * TODO: We need to have a new array in support of the new API
239 * TODO: If we use a per-context array, we would move the array into nss_ctx based.
240 */
241 nss_top_main.ipv6_callback = cb;
242 nss_top_main.ipv6_ctx = app_data;
243 return &nss_top_main.nss[nss_top_main.ipv6_handler_id];
244}
245
246/*
247 * nss_ipv6_notify_unregister()
248 * Unregister to received IPv6 events.
249 *
250 * NOTE: Do we want to pass an nss_ctx here so that we can register for ipv6 on any core?
251 */
252void nss_ipv6_notify_unregister(void)
253{
254 nss_top_main.ipv6_callback = NULL;
255}
256
257/*
258 * nss_ipv6_get_mgr()
259 *
260 * TODO: This only suppports a single ipv6, do we ever want to support more?
261 */
262struct nss_ctx_instance *nss_ipv6_get_mgr(void)
263{
264 return (void *)&nss_top_main.nss[nss_top_main.ipv6_handler_id];
265}
266
267/*
268 * nss_ipv6_register_handler()
269 * Register our handler to receive messages for this interface
270 */
271void nss_ipv6_register_handler()
272{
273 if (nss_core_register_handler(NSS_IPV6_RX_INTERFACE, nss_ipv6_rx_msg_handler, NULL) != NSS_CORE_STATUS_SUCCESS) {
274 nss_warning("IPv6 handler failed to register");
275 }
276}
277
Vijay Dewangan9db18752014-09-15 16:25:01 -0700278/*
279 * nss_ipv6_conn_cfg_callback()
280 * call back function for the ipv6 connection configuration handler
281 */
Sundarajan Srinivasan02e6c2b2014-10-06 11:51:12 -0700282static void nss_ipv6_conn_cfg_callback(void *app_data, struct nss_ipv6_msg *nim)
Vijay Dewangan9db18752014-09-15 16:25:01 -0700283{
284 if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700285 /*
286 * Error, hence we are not updating the nss_ipv4_conn_cfg
287 * Restore the current_value to its previous state
288 */
Vijay Dewangan488e5372014-12-29 21:40:11 -0800289 i6cfgp.response = NSS_FAILURE;
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700290 complete(&i6cfgp.complete);
Vijay Dewangan9db18752014-09-15 16:25:01 -0700291 return;
292 }
293
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700294 /*
295 * Sucess at NSS FW, hence updating nss_ipv4_conn_cfg, with the valid value
296 * saved at the sysctl handler.
297 */
Vijay Dewangan9db18752014-09-15 16:25:01 -0700298 nss_info("IPv6 connection configuration success: %d\n", nim->cm.error);
Vijay Dewangan488e5372014-12-29 21:40:11 -0800299 i6cfgp.response = NSS_SUCCESS;
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700300 complete(&i6cfgp.complete);
Vijay Dewangan9db18752014-09-15 16:25:01 -0700301}
302
303
304/*
305 * nss_ipv6_conn_cfg_handler()
306 * Sets the number of connections for IPv6
307 */
308static int nss_ipv6_conn_cfg_handler(ctl_table *ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos)
309{
310 struct nss_top_instance *nss_top = &nss_top_main;
311 struct nss_ctx_instance *nss_ctx = &nss_top->nss[0];
312 struct nss_ipv6_msg nim;
313 struct nss_ipv6_rule_conn_cfg_msg *nirccm;
314 nss_tx_status_t nss_tx_status;
Vijay Dewangan488e5372014-12-29 21:40:11 -0800315 int ret = NSS_FAILURE;
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700316 uint32_t sum_of_conn;
317
318 /*
319 * Acquiring semaphore
320 */
321 down(&i6cfgp.sem);
322
323 /*
324 * Take a snapshot of the current value
325 */
326 i6cfgp.current_value = nss_ipv6_conn_cfg;
327
328 ret = proc_dointvec(ctl, write, buffer, lenp, ppos);
329 if (ret || (!write)) {
330 up(&i6cfgp.sem);
331 return ret;
332 }
Vijay Dewangan9db18752014-09-15 16:25:01 -0700333
334 /*
335 * Specifications for input
336 * 1) The input should be power of 2.
337 * 2) Input for ipv4 and ipv6 sum togther should not exceed 8k
338 * 3) Min. value should be at leat 256 connections. This is the
339 * minimum connections we will support for each of them.
340 */
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700341 sum_of_conn = nss_ipv4_conn_cfg + nss_ipv6_conn_cfg;
342 if ((nss_ipv6_conn_cfg & NSS_NUM_CONN_QUANTA_MASK) ||
343 (sum_of_conn > NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6) ||
344 (nss_ipv6_conn_cfg < NSS_MIN_NUM_CONN)) {
Vijay Dewangan9db18752014-09-15 16:25:01 -0700345 nss_warning("%p: input supported connections (%d) does not adhere\
346 specifications\n1) not power of 2,\n2) is less than \
347 min val: %d, OR\n IPv4/6 total exceeds %d\n",
348 nss_ctx,
349 nss_ipv6_conn_cfg,
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700350 NSS_MIN_NUM_CONN,
351 NSS_MAX_TOTAL_NUM_CONN_IPV4_IPV6);
Stephen Wang06761022015-03-03 16:38:42 -0800352 goto failure;
Vijay Dewangan9db18752014-09-15 16:25:01 -0700353 }
354
Vijay Dewangan9db18752014-09-15 16:25:01 -0700355
356 nss_info("%p: IPv6 supported connections: %d\n", nss_ctx, nss_ipv6_conn_cfg);
357
Sundarajan Srinivasan02e6c2b2014-10-06 11:51:12 -0700358 nss_ipv6_msg_init(&nim, NSS_IPV6_RX_INTERFACE, NSS_IPV6_TX_CONN_CFG_RULE_MSG,
Sundarajan Srinivasan30a53d42015-01-30 10:52:08 -0800359 sizeof(struct nss_ipv6_rule_conn_cfg_msg), nss_ipv6_conn_cfg_callback, NULL);
Vijay Dewangan9db18752014-09-15 16:25:01 -0700360
361 nirccm = &nim.msg.rule_conn_cfg;
362 nirccm->num_conn = htonl(nss_ipv6_conn_cfg);
363 nss_tx_status = nss_ipv6_tx(nss_ctx, &nim);
364
365 if (nss_tx_status != NSS_TX_SUCCESS) {
366 nss_warning("%p: nss_tx error setting IPv6 Connections: %d\n",
367 nss_ctx,
368 nss_ipv6_conn_cfg);
Stephen Wang06761022015-03-03 16:38:42 -0800369 goto failure;
Vijay Dewangan9db18752014-09-15 16:25:01 -0700370 }
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700371
372 /*
373 * Blocking call, wait till we get ACK for this msg.
374 */
375 ret = wait_for_completion_timeout(&i6cfgp.complete, msecs_to_jiffies(NSS_CONN_CFG_TIMEOUT));
376 if (ret == 0) {
377 nss_warning("%p: Waiting for ack timed out\n", nss_ctx);
Stephen Wang06761022015-03-03 16:38:42 -0800378 goto failure;
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700379 }
380
381 /*
382 * ACK/NACK received from NSS FW
383 * If ACK: Callback function will update nss_ipv4_conn_cfg with
384 * i6cfgp.num_conn_valid, which holds the user input
385 */
Vijay Dewangan488e5372014-12-29 21:40:11 -0800386 if (NSS_FAILURE == i6cfgp.response) {
Stephen Wang06761022015-03-03 16:38:42 -0800387 goto failure;
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700388 }
389
390 up(&i6cfgp.sem);
Vijay Dewangan488e5372014-12-29 21:40:11 -0800391 return NSS_SUCCESS;
Stephen Wang06761022015-03-03 16:38:42 -0800392
393failure:
394 /*
395 * Restore the current_value to its previous state
396 */
397 nss_ipv6_conn_cfg = i6cfgp.current_value;
398 up(&i6cfgp.sem);
399 return NSS_FAILURE;
Vijay Dewangan9db18752014-09-15 16:25:01 -0700400}
401
402static ctl_table nss_ipv6_table[] = {
403 {
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700404 .procname = "ipv6_conn",
405 .data = &nss_ipv6_conn_cfg,
406 .maxlen = sizeof(int),
407 .mode = 0644,
Vijay Dewangan9db18752014-09-15 16:25:01 -0700408 .proc_handler = &nss_ipv6_conn_cfg_handler,
409 },
410 { }
411};
412
413static ctl_table nss_ipv6_dir[] = {
414 {
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700415 .procname = "ipv6cfg",
416 .mode = 0555,
417 .child = nss_ipv6_table,
Vijay Dewangan9db18752014-09-15 16:25:01 -0700418 },
419 { }
420};
421
422static ctl_table nss_ipv6_root_dir[] = {
423 {
424 .procname = "nss",
425 .mode = 0555,
426 .child = nss_ipv6_dir,
427 },
428 { }
429};
430
431static ctl_table nss_ipv6_root[] = {
432 {
433 .procname = "dev",
434 .mode = 0555,
435 .child = nss_ipv6_root_dir,
436 },
437 { }
438};
439
440static struct ctl_table_header *nss_ipv6_header;
441
442/*
443 * nss_ipv6_register_sysctl()
444 * Register sysctl specific to ipv4
445 */
446void nss_ipv6_register_sysctl(void)
447{
448 /*
449 * Register sysctl table.
450 */
451 nss_ipv6_header = register_sysctl_table(nss_ipv6_root);
Vijay Dewangan4861f4e2014-10-14 16:56:35 -0700452 sema_init(&i6cfgp.sem, 1);
453 init_completion(&i6cfgp.complete);
454 i6cfgp.current_value = nss_ipv6_conn_cfg;
Vijay Dewangan9db18752014-09-15 16:25:01 -0700455}
456
457/*
458 * nss_ipv6_unregister_sysctl()
459 * Unregister sysctl specific to ipv4
460 */
461void nss_ipv6_unregister_sysctl(void)
462{
463 /*
464 * Unregister sysctl table.
465 */
466 if (nss_ipv6_header) {
467 unregister_sysctl_table(nss_ipv6_header);
468 }
469}
470
Sundarajan Srinivasan02e6c2b2014-10-06 11:51:12 -0700471/*
472 * nss_ipv6_msg_init()
473 * Initialize IPv6 message.
474 */
475void nss_ipv6_msg_init(struct nss_ipv6_msg *nim, uint16_t if_num, uint32_t type, uint32_t len,
Sundarajan Srinivasan30a53d42015-01-30 10:52:08 -0800476 nss_ipv6_msg_callback_t cb, void *app_data)
Sundarajan Srinivasan02e6c2b2014-10-06 11:51:12 -0700477{
478 nss_cmn_msg_init(&nim->cm, if_num, type, len, (void *)cb, app_data);
479}
480
Sol Kavy879eb8b2014-04-07 19:11:31 -0700481EXPORT_SYMBOL(nss_ipv6_tx);
482EXPORT_SYMBOL(nss_ipv6_notify_register);
483EXPORT_SYMBOL(nss_ipv6_notify_unregister);
484EXPORT_SYMBOL(nss_ipv6_get_mgr);
485EXPORT_SYMBOL(nss_ipv6_register_handler);
Vijay Dewangan9db18752014-09-15 16:25:01 -0700486EXPORT_SYMBOL(nss_ipv6_register_sysctl);
487EXPORT_SYMBOL(nss_ipv6_unregister_sysctl);
Sundarajan Srinivasan02e6c2b2014-10-06 11:51:12 -0700488EXPORT_SYMBOL(nss_ipv6_msg_init);