blob: ec8b2befb75b0a1155ddcdae3e02b158924f8e7e [file] [log] [blame]
Tushar Mathurff8741b2015-12-02 20:28:59 +05301/*
2 **************************************************************************
Stephen Wang3e2dbd12018-03-14 17:28:17 -07003 * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
Tushar Mathurff8741b2015-12-02 20:28:59 +05304 * 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#include "nss_tx_rx_common.h"
18#include "nss_dtls_stats.h"
19
20#define NSS_DTLS_TX_TIMEOUT 3000 /* 3 Seconds */
21
22/*
23 * Data structures to store DTLS nss debug stats
24 */
Yu Huang8c107082017-07-24 14:58:26 -070025static DEFINE_SPINLOCK(nss_dtls_session_stats_lock);
26static struct nss_dtls_stats_session session_stats[NSS_MAX_DTLS_SESSIONS];
Tushar Mathurff8741b2015-12-02 20:28:59 +053027
28/*
29 * Private data structure
30 */
31static struct nss_dtls_pvt {
32 struct semaphore sem;
33 struct completion complete;
34 int response;
35 void *cb;
36 void *app_data;
37} dtls_pvt;
38
Tushar Mathurff8741b2015-12-02 20:28:59 +053039/*
40 * nss_dtls_verify_if_num()
41 * Verify if_num passed to us.
42 */
43static bool nss_dtls_verify_if_num(uint32_t if_num)
44{
45 if (nss_is_dynamic_interface(if_num) == false)
46 return false;
47
Stephen Wange8b8d0d2017-02-24 17:05:22 -080048 if (nss_dynamic_interface_get_type(nss_dtls_get_context(), if_num)
Tushar Mathurff8741b2015-12-02 20:28:59 +053049 != NSS_DYNAMIC_INTERFACE_TYPE_DTLS)
50 return false;
51
52 return true;
53}
54
55/*
56 * nss_dtls_session_stats_sync
57 * Per DTLS session debug stats
58 */
59static void nss_dtls_session_stats_sync(struct nss_ctx_instance *nss_ctx,
60 struct nss_dtls_session_stats *stats_msg,
61 uint16_t if_num)
62{
63 int i;
Yu Huang8c107082017-07-24 14:58:26 -070064 struct nss_dtls_stats_session *s = NULL;
Tushar Mathurff8741b2015-12-02 20:28:59 +053065
66 NSS_VERIFY_CTX_MAGIC(nss_ctx);
67
Yu Huang8c107082017-07-24 14:58:26 -070068 spin_lock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +053069 for (i = 0; i < NSS_MAX_DTLS_SESSIONS; i++) {
Yu Huang8c107082017-07-24 14:58:26 -070070 if (session_stats[i].if_num != if_num) {
Tushar Mathurff8741b2015-12-02 20:28:59 +053071 continue;
72 }
73
Yu Huang8c107082017-07-24 14:58:26 -070074 s = &session_stats[i];
Tushar Mathurff8741b2015-12-02 20:28:59 +053075 break;
76 }
77
78 if (!s) {
Yu Huang8c107082017-07-24 14:58:26 -070079 spin_unlock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +053080 return;
81 }
82
Yu Huang8c107082017-07-24 14:58:26 -070083 s->stats[NSS_DTLS_STATS_SESSION_RX_PKTS] += stats_msg->node_stats.rx_packets;
84 s->stats[NSS_DTLS_STATS_SESSION_TX_PKTS] += stats_msg->node_stats.tx_packets;
ratheesh kannoth93ba95c2017-07-13 15:52:52 +053085 for (i = 0; i < NSS_MAX_NUM_PRI; i++) {
Yu Huang8c107082017-07-24 14:58:26 -070086 s->stats[NSS_DTLS_STATS_SESSION_RX_QUEUE_0_DROPPED + i] += stats_msg->node_stats.rx_dropped[i];
ratheesh kannoth93ba95c2017-07-13 15:52:52 +053087 }
Yu Huang8c107082017-07-24 14:58:26 -070088 s->stats[NSS_DTLS_STATS_SESSION_RX_AUTH_DONE] += stats_msg->rx_auth_done;
89 s->stats[NSS_DTLS_STATS_SESSION_TX_AUTH_DONE] += stats_msg->tx_auth_done;
90 s->stats[NSS_DTLS_STATS_SESSION_RX_CIPHER_DONE] += stats_msg->rx_cipher_done;
91 s->stats[NSS_DTLS_STATS_SESSION_TX_CIPHER_DONE] += stats_msg->tx_cipher_done;
92 s->stats[NSS_DTLS_STATS_SESSION_RX_CBUF_ALLOC_FAIL] += stats_msg->rx_cbuf_alloc_fail;
93 s->stats[NSS_DTLS_STATS_SESSION_TX_CBUF_ALLOC_FAIL] += stats_msg->tx_cbuf_alloc_fail;
94 s->stats[NSS_DTLS_STATS_SESSION_TX_CENQUEUE_FAIL] += stats_msg->tx_cenqueue_fail;
95 s->stats[NSS_DTLS_STATS_SESSION_RX_CENQUEUE_FAIL] += stats_msg->rx_cenqueue_fail;
96 s->stats[NSS_DTLS_STATS_SESSION_TX_DROPPED_HROOM] += stats_msg->tx_dropped_hroom;
97 s->stats[NSS_DTLS_STATS_SESSION_TX_DROPPED_TROOM] += stats_msg->tx_dropped_troom;
98 s->stats[NSS_DTLS_STATS_SESSION_TX_FORWARD_ENQUEUE_FAIL] += stats_msg->tx_forward_enqueue_fail;
99 s->stats[NSS_DTLS_STATS_SESSION_RX_FORWARD_ENQUEUE_FAIL] += stats_msg->rx_forward_enqueue_fail;
100 s->stats[NSS_DTLS_STATS_SESSION_RX_INVALID_VERSION] += stats_msg->rx_invalid_version;
101 s->stats[NSS_DTLS_STATS_SESSION_RX_INVALID_EPOCH] += stats_msg->rx_invalid_epoch;
102 s->stats[NSS_DTLS_STATS_SESSION_RX_MALFORMED] += stats_msg->rx_malformed;
103 s->stats[NSS_DTLS_STATS_SESSION_RX_CIPHER_FAIL] += stats_msg->rx_cipher_fail;
104 s->stats[NSS_DTLS_STATS_SESSION_RX_AUTH_FAIL] += stats_msg->rx_auth_fail;
105 s->stats[NSS_DTLS_STATS_SESSION_RX_CAPWAP_CLASSIFY_FAIL] += stats_msg->rx_capwap_classify_fail;
106 s->stats[NSS_DTLS_STATS_SESSION_RX_SINGLE_REC_DGRAM] += stats_msg->rx_single_rec_dgram;
107 s->stats[NSS_DTLS_STATS_SESSION_RX_MULTI_REC_DGRAM] += stats_msg->rx_multi_rec_dgram;
108 s->stats[NSS_DTLS_STATS_SESSION_RX_REPLAY_FAIL] += stats_msg->rx_replay_fail;
109 s->stats[NSS_DTLS_STATS_SESSION_RX_REPLAY_DUPLICATE] += stats_msg->rx_replay_duplicate;
110 s->stats[NSS_DTLS_STATS_SESSION_RX_REPLAY_OUT_OF_WINDOW] += stats_msg->rx_replay_out_of_window;
111 s->stats[NSS_DTLS_STATS_SESSION_OUTFLOW_QUEUE_FULL] += stats_msg->outflow_queue_full;
112 s->stats[NSS_DTLS_STATS_SESSION_DECAP_QUEUE_FULL] += stats_msg->decap_queue_full;
113 s->stats[NSS_DTLS_STATS_SESSION_PBUF_ALLOC_FAIL] += stats_msg->pbuf_alloc_fail;
114 s->stats[NSS_DTLS_STATS_SESSION_PBUF_COPY_FAIL] += stats_msg->pbuf_copy_fail;
115 s->stats[NSS_DTLS_STATS_SESSION_EPOCH] = stats_msg->epoch;
116 s->stats[NSS_DTLS_STATS_SESSION_TX_SEQ_HIGH] = stats_msg->tx_seq_high;
117 s->stats[NSS_DTLS_STATS_SESSION_TX_SEQ_LOW] = stats_msg->tx_seq_low;
118 spin_unlock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530119}
120
121/*
Yu Huang8c107082017-07-24 14:58:26 -0700122 * nss_dtls_session_stats_get()
Tushar Mathurff8741b2015-12-02 20:28:59 +0530123 * Get session DTLS statitics.
124 */
Yu Huang8c107082017-07-24 14:58:26 -0700125void nss_dtls_session_stats_get(struct nss_dtls_stats_session *stats)
Tushar Mathurff8741b2015-12-02 20:28:59 +0530126{
127 int i;
128
129 if (!stats) {
130 nss_warning("No memory to copy dtls session stats");
131 return;
132 }
133
Yu Huang8c107082017-07-24 14:58:26 -0700134 spin_lock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530135 for (i = 0; i < NSS_MAX_DTLS_SESSIONS; i++) {
Yu Huang8c107082017-07-24 14:58:26 -0700136 if (session_stats[i].valid) {
137 memcpy(stats, &session_stats[i],
138 sizeof(struct nss_dtls_stats_session));
Tushar Mathurff8741b2015-12-02 20:28:59 +0530139 stats++;
140 }
141 }
Yu Huang8c107082017-07-24 14:58:26 -0700142 spin_unlock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530143}
144
145/*
146 * nss_dtls_handler()
147 * Handle NSS -> HLOS messages for dtls tunnel
148 */
149static void nss_dtls_handler(struct nss_ctx_instance *nss_ctx,
150 struct nss_cmn_msg *ncm,
151 __attribute__((unused))void *app_data)
152{
153 struct nss_dtls_msg *ntm = (struct nss_dtls_msg *)ncm;
154 void *ctx;
155
156 nss_dtls_msg_callback_t cb;
157
158 NSS_VERIFY_CTX_MAGIC(nss_ctx);
159 BUG_ON(!nss_dtls_verify_if_num(ncm->interface));
160
161 /*
162 * Is this a valid request/response packet?
163 */
164 if (ncm->type >= NSS_DTLS_MSG_MAX) {
165 nss_warning("%p: received invalid message %d "
166 "for DTLS interface %d",
167 nss_ctx, ncm->type, ncm->interface);
168 return;
169 }
170
Suruchi Agarwalef8a8702016-01-08 12:40:08 -0800171 if (nss_cmn_get_msg_len(ncm) > sizeof(struct nss_dtls_msg)) {
Tushar Mathurff8741b2015-12-02 20:28:59 +0530172 nss_warning("%p: dtls message length is invalid: %d",
173 nss_ctx, ncm->len);
174 return;
175 }
176
177 switch (ntm->cm.type) {
178 case NSS_DTLS_MSG_SESSION_STATS:
179 nss_dtls_session_stats_sync(nss_ctx,
180 &ntm->msg.stats,
181 ncm->interface);
182 break;
183 }
184
185 /*
186 * Update the callback and app_data for NOTIFY messages
187 */
Suruchi Agarwale4ad24a2018-06-11 12:03:46 +0530188 if (ncm->response == NSS_CMN_RESPONSE_NOTIFY) {
Stephen Wangaed46332016-12-12 17:29:03 -0800189 ncm->cb = (nss_ptr_t)nss_ctx->nss_top->dtls_msg_callback;
Stephen Wang84e0e992016-09-07 12:31:40 -0700190 ncm->app_data = (nss_ptr_t)nss_ctx->subsys_dp_register[ncm->interface].app_data;
Tushar Mathurff8741b2015-12-02 20:28:59 +0530191 }
192
193 /*
194 * Log failures
195 */
196 nss_core_log_msg_failures(nss_ctx, ncm);
197
198 /*
199 * callback
200 */
201 cb = (nss_dtls_msg_callback_t)ncm->cb;
202 ctx = (void *)ncm->app_data;
203
204 /*
205 * call dtls session callback
206 */
207 if (!cb) {
208 nss_warning("%p: No callback for dtls session interface %d",
209 nss_ctx, ncm->interface);
210 return;
211 }
212
213 cb(ctx, ntm);
214}
215
216/*
217 * nss_dtls_callback()
218 * Callback to handle the completion of NSS->HLOS messages.
219 */
220static void nss_dtls_callback(void *app_data, struct nss_dtls_msg *nim)
221{
222 nss_dtls_msg_callback_t callback = (nss_dtls_msg_callback_t)dtls_pvt.cb;
223 void *data = dtls_pvt.app_data;
224
225 dtls_pvt.cb = NULL;
226 dtls_pvt.app_data = NULL;
227
228 if (nim->cm.response != NSS_CMN_RESPONSE_ACK) {
229 nss_warning("dtls Error response %d\n", nim->cm.response);
230
231 dtls_pvt.response = NSS_TX_FAILURE;
232 if (callback) {
233 callback(data, nim);
234 }
235
236 complete(&dtls_pvt.complete);
237 return;
238 }
239
240 dtls_pvt.response = NSS_TX_SUCCESS;
241 if (callback) {
242 callback(data, nim);
243 }
244
245 complete(&dtls_pvt.complete);
246}
247
248/*
249 * nss_dtls_tx_buf()
250 * Transmit buffer over DTLS interface
251 */
252nss_tx_status_t nss_dtls_tx_buf(struct sk_buff *skb, uint32_t if_num,
253 struct nss_ctx_instance *nss_ctx)
254{
Tushar Mathurff8741b2015-12-02 20:28:59 +0530255 BUG_ON(!nss_dtls_verify_if_num(if_num));
256
Stephen Wang3e2dbd12018-03-14 17:28:17 -0700257 return nss_core_send_packet(nss_ctx, skb, if_num, H2N_BIT_FLAG_VIRTUAL_BUFFER);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530258}
259EXPORT_SYMBOL(nss_dtls_tx_buf);
260
261/*
262 * nss_dtls_tx_msg()
263 * Transmit a DTLS message to NSS firmware
264 */
265nss_tx_status_t nss_dtls_tx_msg(struct nss_ctx_instance *nss_ctx,
266 struct nss_dtls_msg *msg)
267{
Tushar Mathurff8741b2015-12-02 20:28:59 +0530268 struct nss_cmn_msg *ncm = &msg->cm;
Tushar Mathurff8741b2015-12-02 20:28:59 +0530269
270 /*
271 * Sanity check the message
272 */
273 BUG_ON(!nss_dtls_verify_if_num(ncm->interface));
274
Tushar Mathurff8741b2015-12-02 20:28:59 +0530275 if (ncm->type > NSS_DTLS_MSG_MAX) {
276 nss_warning("%p: dtls message type out of range: %d",
277 nss_ctx, ncm->type);
278 return NSS_TX_FAILURE;
279 }
280
Stephen Wang3e2dbd12018-03-14 17:28:17 -0700281 return nss_core_send_cmd(nss_ctx, msg, sizeof(*msg), NSS_NBUF_PAYLOAD_SIZE);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530282}
283EXPORT_SYMBOL(nss_dtls_tx_msg);
284
285/*
286 * nss_dtls_tx_msg()
287 * Transmit a DTLS message to NSS firmware synchronously.
288 */
289nss_tx_status_t nss_dtls_tx_msg_sync(struct nss_ctx_instance *nss_ctx, struct nss_dtls_msg *msg)
290{
291
292 nss_tx_status_t status;
293 int ret = 0;
294
295 down(&dtls_pvt.sem);
296 dtls_pvt.cb = (void *)msg->cm.cb;
297 dtls_pvt.app_data = (void *)msg->cm.app_data;
298
Stephen Wangaed46332016-12-12 17:29:03 -0800299 msg->cm.cb = (nss_ptr_t)nss_dtls_callback;
300 msg->cm.app_data = (nss_ptr_t)NULL;
Tushar Mathurff8741b2015-12-02 20:28:59 +0530301
302 status = nss_dtls_tx_msg(nss_ctx, msg);
303 if (status != NSS_TX_SUCCESS) {
304 nss_warning("%p: dtls_tx_msg failed\n", nss_ctx);
305 up(&dtls_pvt.sem);
306 return status;
307 }
308
309 ret = wait_for_completion_timeout(&dtls_pvt.complete, msecs_to_jiffies(NSS_DTLS_TX_TIMEOUT));
310
311 if (!ret) {
312 nss_warning("%p: DTLS msg tx failed due to timeout\n", nss_ctx);
313 dtls_pvt.response = NSS_TX_FAILURE;
314 }
315
316 status = dtls_pvt.response;
317 up(&dtls_pvt.sem);
318 return status;
319}
320EXPORT_SYMBOL(nss_dtls_tx_msg_sync);
321
322/*
323 ***********************************
324 * Register/Unregister/Miscellaneous APIs
325 ***********************************
326 */
327
328/*
329 * nss_dtls_register_if()
330 */
331struct nss_ctx_instance *nss_dtls_register_if(uint32_t if_num,
332 nss_dtls_data_callback_t cb,
333 nss_dtls_msg_callback_t ev_cb,
334 struct net_device *netdev,
335 uint32_t features,
336 void *app_ctx)
337{
338 int32_t i;
339
340 struct nss_ctx_instance *nss_ctx = nss_dtls_get_context();
341
342 BUG_ON(!nss_dtls_verify_if_num(if_num));
343
Yu Huang8c107082017-07-24 14:58:26 -0700344 spin_lock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530345 for (i = 0; i < NSS_MAX_DTLS_SESSIONS; i++) {
Yu Huang8c107082017-07-24 14:58:26 -0700346 if (!session_stats[i].valid) {
347 session_stats[i].valid = true;
348 session_stats[i].if_num = if_num;
349 session_stats[i].if_index = netdev->ifindex;
Tushar Mathurff8741b2015-12-02 20:28:59 +0530350 break;
351 }
352 }
Yu Huang8c107082017-07-24 14:58:26 -0700353 spin_unlock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530354
355 if (i == NSS_MAX_DTLS_SESSIONS) {
356 nss_warning("%p: Cannot find free slot for "
357 "DTLS session stats, I/F:%u\n", nss_ctx, if_num);
358 return NULL;
359 }
360
Stephen Wang84e0e992016-09-07 12:31:40 -0700361 if (nss_ctx->subsys_dp_register[if_num].ndev) {
Tushar Mathurff8741b2015-12-02 20:28:59 +0530362 nss_warning("%p: Cannot find free slot for "
363 "DTLS NSS I/F:%u\n", nss_ctx, if_num);
364
365 return NULL;
366 }
367
Jackson Bockus7ca70ec2017-07-17 13:47:29 -0700368 nss_core_register_subsys_dp(nss_ctx, if_num, cb, NULL, app_ctx, netdev, features);
Tanmay V Jagdalea8533d52018-04-24 21:40:02 +0530369 nss_ctx->subsys_dp_register[if_num].type = NSS_DYNAMIC_INTERFACE_TYPE_DTLS;
Tushar Mathurff8741b2015-12-02 20:28:59 +0530370
371 nss_top_main.dtls_msg_callback = ev_cb;
Thomas Wu91f4bdf2017-06-09 12:03:02 -0700372 nss_core_register_handler(nss_ctx, if_num, nss_dtls_handler, app_ctx);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530373
Stephen Wang90c67de2016-04-26 15:15:59 -0700374 return nss_ctx;
Tushar Mathurff8741b2015-12-02 20:28:59 +0530375}
376EXPORT_SYMBOL(nss_dtls_register_if);
377
378/*
379 * nss_dtls_unregister_if()
380 */
381void nss_dtls_unregister_if(uint32_t if_num)
382{
Stephen Wang84e0e992016-09-07 12:31:40 -0700383 struct nss_ctx_instance *nss_ctx = nss_dtls_get_context();
Tushar Mathurff8741b2015-12-02 20:28:59 +0530384 int32_t i;
385
Tushar Mathurff8741b2015-12-02 20:28:59 +0530386 BUG_ON(!nss_dtls_verify_if_num(if_num));
387
Yu Huang8c107082017-07-24 14:58:26 -0700388 spin_lock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530389 for (i = 0; i < NSS_MAX_DTLS_SESSIONS; i++) {
Yu Huang8c107082017-07-24 14:58:26 -0700390 if (session_stats[i].if_num == if_num) {
391 memset(&session_stats[i], 0,
392 sizeof(struct nss_dtls_stats_session));
Tushar Mathurff8741b2015-12-02 20:28:59 +0530393 break;
394 }
395 }
Yu Huang8c107082017-07-24 14:58:26 -0700396 spin_unlock_bh(&nss_dtls_session_stats_lock);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530397
398 if (i == NSS_MAX_DTLS_SESSIONS) {
Stephen Wang84e0e992016-09-07 12:31:40 -0700399 nss_warning("%p: Cannot find debug stats for DTLS session %d\n", nss_ctx, if_num);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530400 return;
401 }
402
Stephen Wang84e0e992016-09-07 12:31:40 -0700403 if (!nss_ctx->subsys_dp_register[if_num].ndev) {
404 nss_warning("%p: Cannot find registered netdev for DTLS NSS I/F:%u\n", nss_ctx, if_num);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530405
406 return;
407 }
408
Jackson Bockus7ca70ec2017-07-17 13:47:29 -0700409 nss_core_unregister_subsys_dp(nss_ctx, if_num);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530410
411 nss_top_main.dtls_msg_callback = NULL;
Thomas Wu91f4bdf2017-06-09 12:03:02 -0700412 nss_core_unregister_handler(nss_ctx, if_num);
Tushar Mathurff8741b2015-12-02 20:28:59 +0530413}
414EXPORT_SYMBOL(nss_dtls_unregister_if);
415
416/*
417 * nss_get_dtls_context()
418 */
419struct nss_ctx_instance *nss_dtls_get_context(void)
420{
421 return (struct nss_ctx_instance *)&nss_top_main.nss[nss_top_main.dtls_handler_id];
422}
423EXPORT_SYMBOL(nss_dtls_get_context);
424
425/*
426 * nss_dtls_msg_init()
427 * Initialize nss_dtls msg.
428 */
429void nss_dtls_msg_init(struct nss_dtls_msg *ncm, uint16_t if_num,
430 uint32_t type, uint32_t len, void *cb, void *app_data)
431{
432 nss_cmn_msg_init(&ncm->cm, if_num, type, len, cb, app_data);
433}
434EXPORT_SYMBOL(nss_dtls_msg_init);
435
436/*
437 * nss_dtls_get_ifnum_with_coreid()
438 */
439int32_t nss_dtls_get_ifnum_with_coreid(int32_t if_num)
440{
441 struct nss_ctx_instance *nss_ctx = nss_dtls_get_context();
442
443 NSS_VERIFY_CTX_MAGIC(nss_ctx);
444 return NSS_INTERFACE_NUM_APPEND_COREID(nss_ctx, if_num);
445}
446EXPORT_SYMBOL(nss_dtls_get_ifnum_with_coreid);
447
448/*
449 * nss_dtls_register_handler()
450 */
451void nss_dtls_register_handler(void)
452{
453 sema_init(&dtls_pvt.sem, 1);
454 init_completion(&dtls_pvt.complete);
Yu Huang8c107082017-07-24 14:58:26 -0700455
456 nss_dtls_stats_dentry_create();
Tushar Mathurff8741b2015-12-02 20:28:59 +0530457}