sctputil.c (207099) | sctputil.c (208160) |
---|---|
1/*- 2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 32 33#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are met: 6 * 7 * a) Redistributions of source code must retain the above copyright notice, 8 * this list of conditions and the following disclaimer. --- 17 unchanged lines hidden (view full) --- 26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 28 * THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31/* $KAME: sctputil.c,v 1.37 2005/03/07 23:26:09 itojun Exp $ */ 32 33#include <sys/cdefs.h> |
34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 207099 2010-04-23 08:19:47Z tuexen $"); | 34__FBSDID("$FreeBSD: head/sys/netinet/sctputil.c 208160 2010-05-16 17:03:56Z rrs $"); |
35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> 39#include <netinet/sctp_var.h> 40#include <netinet/sctp_sysctl.h> 41#ifdef INET6 42#endif 43#include <netinet/sctp_header.h> 44#include <netinet/sctp_output.h> 45#include <netinet/sctp_uio.h> 46#include <netinet/sctp_timer.h> 47#include <netinet/sctp_indata.h>/* for sctp_deliver_data() */ 48#include <netinet/sctp_auth.h> 49#include <netinet/sctp_asconf.h> 50#include <netinet/sctp_cc_functions.h> | 35 36#include <netinet/sctp_os.h> 37#include <netinet/sctp_pcb.h> 38#include <netinet/sctputil.h> 39#include <netinet/sctp_var.h> 40#include <netinet/sctp_sysctl.h> 41#ifdef INET6 42#endif 43#include <netinet/sctp_header.h> 44#include <netinet/sctp_output.h> 45#include <netinet/sctp_uio.h> 46#include <netinet/sctp_timer.h> 47#include <netinet/sctp_indata.h>/* for sctp_deliver_data() */ 48#include <netinet/sctp_auth.h> 49#include <netinet/sctp_asconf.h> 50#include <netinet/sctp_cc_functions.h> |
51#include <netinet/sctp_bsd_addr.h> |
|
51 52#define NUMBER_OF_MTU_SIZES 18 53 54 55#if defined(__Windows__) && !defined(SCTP_LOCAL_TRACE_BUF) 56#include "eventrace_netinet.h" 57#include "sctputil.tmh" /* this is the file that will be auto 58 * generated */ --- 1191 unchanged lines hidden (view full) --- 1250 SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP); 1251 asoc->mapping_array = new_array1; 1252 asoc->nr_mapping_array = new_array2; 1253 asoc->mapping_array_size = new_size; 1254 return (0); 1255} 1256 1257 | 52 53#define NUMBER_OF_MTU_SIZES 18 54 55 56#if defined(__Windows__) && !defined(SCTP_LOCAL_TRACE_BUF) 57#include "eventrace_netinet.h" 58#include "sctputil.tmh" /* this is the file that will be auto 59 * generated */ --- 1191 unchanged lines hidden (view full) --- 1251 SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP); 1252 asoc->mapping_array = new_array1; 1253 asoc->nr_mapping_array = new_array2; 1254 asoc->mapping_array_size = new_size; 1255 return (0); 1256} 1257 1258 |
1258#if defined(SCTP_USE_THREAD_BASED_ITERATOR) | |
1259static void 1260sctp_iterator_work(struct sctp_iterator *it) 1261{ 1262 int iteration_count = 0; 1263 int inp_skip = 0; 1264 1265 SCTP_ITERATOR_LOCK(); 1266 if (it->inp) { --- 5 unchanged lines hidden (view full) --- 1272 SCTP_ITERATOR_UNLOCK(); 1273 if (it->function_atend != NULL) { 1274 (*it->function_atend) (it->pointer, it->val); 1275 } 1276 SCTP_FREE(it, SCTP_M_ITER); 1277 return; 1278 } 1279select_a_new_ep: | 1259static void 1260sctp_iterator_work(struct sctp_iterator *it) 1261{ 1262 int iteration_count = 0; 1263 int inp_skip = 0; 1264 1265 SCTP_ITERATOR_LOCK(); 1266 if (it->inp) { --- 5 unchanged lines hidden (view full) --- 1272 SCTP_ITERATOR_UNLOCK(); 1273 if (it->function_atend != NULL) { 1274 (*it->function_atend) (it->pointer, it->val); 1275 } 1276 SCTP_FREE(it, SCTP_M_ITER); 1277 return; 1278 } 1279select_a_new_ep: |
1280 SCTP_INP_WLOCK(it->inp); | 1280 SCTP_INP_RLOCK(it->inp); |
1281 while (((it->pcb_flags) && 1282 ((it->inp->sctp_flags & it->pcb_flags) != it->pcb_flags)) || 1283 ((it->pcb_features) && 1284 ((it->inp->sctp_features & it->pcb_features) != it->pcb_features))) { 1285 /* endpoint flags or features don't match, so keep looking */ 1286 if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { | 1281 while (((it->pcb_flags) && 1282 ((it->inp->sctp_flags & it->pcb_flags) != it->pcb_flags)) || 1283 ((it->pcb_features) && 1284 ((it->inp->sctp_features & it->pcb_features) != it->pcb_features))) { 1285 /* endpoint flags or features don't match, so keep looking */ 1286 if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { |
1287 SCTP_INP_WUNLOCK(it->inp); | 1287 SCTP_INP_RUNLOCK(it->inp); |
1288 goto done_with_iterator; 1289 } | 1288 goto done_with_iterator; 1289 } |
1290 SCTP_INP_WUNLOCK(it->inp); | 1290 SCTP_INP_RUNLOCK(it->inp); |
1291 it->inp = LIST_NEXT(it->inp, sctp_list); 1292 if (it->inp == NULL) { 1293 goto done_with_iterator; 1294 } | 1291 it->inp = LIST_NEXT(it->inp, sctp_list); 1292 if (it->inp == NULL) { 1293 goto done_with_iterator; 1294 } |
1295 SCTP_INP_WLOCK(it->inp); | 1295 SCTP_INP_RLOCK(it->inp); |
1296 } | 1296 } |
1297 1298 SCTP_INP_WUNLOCK(it->inp); 1299 SCTP_INP_RLOCK(it->inp); 1300 | |
1301 /* now go through each assoc which is in the desired state */ 1302 if (it->done_current_ep == 0) { 1303 if (it->function_inp != NULL) 1304 inp_skip = (*it->function_inp) (it->inp, it->pointer, it->val); 1305 it->done_current_ep = 1; 1306 } 1307 if (it->stcb == NULL) { 1308 /* run the per instance function */ --- 16 unchanged lines hidden (view full) --- 1325 goto next_assoc; 1326 } 1327 /* see if we have limited out the iterator loop */ 1328 iteration_count++; 1329 if (iteration_count > SCTP_ITERATOR_MAX_AT_ONCE) { 1330 /* Pause to let others grab the lock */ 1331 atomic_add_int(&it->stcb->asoc.refcnt, 1); 1332 SCTP_TCB_UNLOCK(it->stcb); | 1297 /* now go through each assoc which is in the desired state */ 1298 if (it->done_current_ep == 0) { 1299 if (it->function_inp != NULL) 1300 inp_skip = (*it->function_inp) (it->inp, it->pointer, it->val); 1301 it->done_current_ep = 1; 1302 } 1303 if (it->stcb == NULL) { 1304 /* run the per instance function */ --- 16 unchanged lines hidden (view full) --- 1321 goto next_assoc; 1322 } 1323 /* see if we have limited out the iterator loop */ 1324 iteration_count++; 1325 if (iteration_count > SCTP_ITERATOR_MAX_AT_ONCE) { 1326 /* Pause to let others grab the lock */ 1327 atomic_add_int(&it->stcb->asoc.refcnt, 1); 1328 SCTP_TCB_UNLOCK(it->stcb); |
1333 | |
1334 SCTP_INP_INCR_REF(it->inp); 1335 SCTP_INP_RUNLOCK(it->inp); 1336 SCTP_ITERATOR_UNLOCK(); 1337 SCTP_ITERATOR_LOCK(); | 1329 SCTP_INP_INCR_REF(it->inp); 1330 SCTP_INP_RUNLOCK(it->inp); 1331 SCTP_ITERATOR_UNLOCK(); 1332 SCTP_ITERATOR_LOCK(); |
1333 if (sctp_it_ctl.iterator_flags) { 1334 /* We won't be staying here */ 1335 SCTP_INP_DECR_REF(it->inp); 1336 atomic_add_int(&it->stcb->asoc.refcnt, -1); 1337 if (sctp_it_ctl.iterator_flags & 1338 SCTP_ITERATOR_MUST_EXIT) { 1339 goto done_with_iterator; 1340 } 1341 if (sctp_it_ctl.iterator_flags & 1342 SCTP_ITERATOR_STOP_CUR_IT) { 1343 sctp_it_ctl.iterator_flags &= ~SCTP_ITERATOR_STOP_CUR_IT; 1344 goto done_with_iterator; 1345 } 1346 if (sctp_it_ctl.iterator_flags & 1347 SCTP_ITERATOR_STOP_CUR_INP) { 1348 sctp_it_ctl.iterator_flags &= ~SCTP_ITERATOR_STOP_CUR_INP; 1349 goto no_stcb; 1350 } 1351 /* If we reach here huh? */ 1352 printf("Unknown it ctl flag %x\n", 1353 sctp_it_ctl.iterator_flags); 1354 sctp_it_ctl.iterator_flags = 0; 1355 } |
|
1338 SCTP_INP_RLOCK(it->inp); | 1356 SCTP_INP_RLOCK(it->inp); |
1339 | |
1340 SCTP_INP_DECR_REF(it->inp); 1341 SCTP_TCB_LOCK(it->stcb); 1342 atomic_add_int(&it->stcb->asoc.refcnt, -1); 1343 iteration_count = 0; 1344 } 1345 /* run function on this one */ 1346 (*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val); 1347 --- 15 unchanged lines hidden (view full) --- 1363 it->val); 1364 } 1365 } 1366 } 1367 SCTP_INP_RUNLOCK(it->inp); 1368no_stcb: 1369 /* done with all assocs on this endpoint, move on to next endpoint */ 1370 it->done_current_ep = 0; | 1357 SCTP_INP_DECR_REF(it->inp); 1358 SCTP_TCB_LOCK(it->stcb); 1359 atomic_add_int(&it->stcb->asoc.refcnt, -1); 1360 iteration_count = 0; 1361 } 1362 /* run function on this one */ 1363 (*it->function_assoc) (it->inp, it->stcb, it->pointer, it->val); 1364 --- 15 unchanged lines hidden (view full) --- 1380 it->val); 1381 } 1382 } 1383 } 1384 SCTP_INP_RUNLOCK(it->inp); 1385no_stcb: 1386 /* done with all assocs on this endpoint, move on to next endpoint */ 1387 it->done_current_ep = 0; |
1371 SCTP_INP_WLOCK(it->inp); 1372 SCTP_INP_WUNLOCK(it->inp); | |
1373 if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { 1374 it->inp = NULL; 1375 } else { 1376 SCTP_INP_INFO_RLOCK(); 1377 it->inp = LIST_NEXT(it->inp, sctp_list); 1378 SCTP_INP_INFO_RUNLOCK(); 1379 } 1380 if (it->inp == NULL) { --- 4 unchanged lines hidden (view full) --- 1385 1386void 1387sctp_iterator_worker(void) 1388{ 1389 struct sctp_iterator *it = NULL; 1390 1391 /* This function is called with the WQ lock in place */ 1392 | 1388 if (it->iterator_flags & SCTP_ITERATOR_DO_SINGLE_INP) { 1389 it->inp = NULL; 1390 } else { 1391 SCTP_INP_INFO_RLOCK(); 1392 it->inp = LIST_NEXT(it->inp, sctp_list); 1393 SCTP_INP_INFO_RUNLOCK(); 1394 } 1395 if (it->inp == NULL) { --- 4 unchanged lines hidden (view full) --- 1400 1401void 1402sctp_iterator_worker(void) 1403{ 1404 struct sctp_iterator *it = NULL; 1405 1406 /* This function is called with the WQ lock in place */ 1407 |
1393 SCTP_BASE_INFO(iterator_running) = 1; 1394again: 1395 it = TAILQ_FIRST(&SCTP_BASE_INFO(iteratorhead)); | 1408 sctp_it_ctl.iterator_running = 1; 1409 sctp_it_ctl.cur_it = it = TAILQ_FIRST(&sctp_it_ctl.iteratorhead); |
1396 while (it) { 1397 /* now lets work on this one */ | 1410 while (it) { 1411 /* now lets work on this one */ |
1398 TAILQ_REMOVE(&SCTP_BASE_INFO(iteratorhead), it, sctp_nxt_itr); | 1412 TAILQ_REMOVE(&sctp_it_ctl.iteratorhead, it, sctp_nxt_itr); |
1399 SCTP_IPI_ITERATOR_WQ_UNLOCK(); | 1413 SCTP_IPI_ITERATOR_WQ_UNLOCK(); |
1414 CURVNET_SET(it->vn); |
|
1400 sctp_iterator_work(it); | 1415 sctp_iterator_work(it); |
1416 1417 CURVNET_RESTORE(); |
|
1401 SCTP_IPI_ITERATOR_WQ_LOCK(); | 1418 SCTP_IPI_ITERATOR_WQ_LOCK(); |
1419 if (sctp_it_ctl.iterator_flags & SCTP_ITERATOR_MUST_EXIT) { 1420 sctp_it_ctl.cur_it = NULL; 1421 break; 1422 } |
|
1402 /* sa_ignore FREED_MEMORY */ | 1423 /* sa_ignore FREED_MEMORY */ |
1403 it = TAILQ_FIRST(&SCTP_BASE_INFO(iteratorhead)); | 1424 sctp_it_ctl.cur_it = it = TAILQ_FIRST(&sctp_it_ctl.iteratorhead); |
1404 } | 1425 } |
1405 if (TAILQ_FIRST(&SCTP_BASE_INFO(iteratorhead))) { 1406 goto again; 1407 } 1408 SCTP_BASE_INFO(iterator_running) = 0; | 1426 sctp_it_ctl.iterator_running = 0; |
1409 return; 1410} 1411 | 1427 return; 1428} 1429 |
1412#endif | |
1413 | 1430 |
1414 | |
1415static void 1416sctp_handle_addr_wq(void) 1417{ 1418 /* deal with the ADDR wq from the rtsock calls */ 1419 struct sctp_laddr *wi; 1420 struct sctp_asconf_iterator *asc; 1421 1422 SCTP_MALLOC(asc, struct sctp_asconf_iterator *, 1423 sizeof(struct sctp_asconf_iterator), SCTP_M_ASC_IT); 1424 if (asc == NULL) { 1425 /* Try later, no memory */ 1426 sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, 1427 (struct sctp_inpcb *)NULL, 1428 (struct sctp_tcb *)NULL, 1429 (struct sctp_nets *)NULL); 1430 return; 1431 } 1432 LIST_INIT(&asc->list_of_work); 1433 asc->cnt = 0; | 1431static void 1432sctp_handle_addr_wq(void) 1433{ 1434 /* deal with the ADDR wq from the rtsock calls */ 1435 struct sctp_laddr *wi; 1436 struct sctp_asconf_iterator *asc; 1437 1438 SCTP_MALLOC(asc, struct sctp_asconf_iterator *, 1439 sizeof(struct sctp_asconf_iterator), SCTP_M_ASC_IT); 1440 if (asc == NULL) { 1441 /* Try later, no memory */ 1442 sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, 1443 (struct sctp_inpcb *)NULL, 1444 (struct sctp_tcb *)NULL, 1445 (struct sctp_nets *)NULL); 1446 return; 1447 } 1448 LIST_INIT(&asc->list_of_work); 1449 asc->cnt = 0; |
1434 SCTP_IPI_ITERATOR_WQ_LOCK(); | 1450 1451 SCTP_WQ_ADDR_LOCK(); |
1435 wi = LIST_FIRST(&SCTP_BASE_INFO(addr_wq)); 1436 while (wi != NULL) { 1437 LIST_REMOVE(wi, sctp_nxt_addr); 1438 LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr); 1439 asc->cnt++; 1440 wi = LIST_FIRST(&SCTP_BASE_INFO(addr_wq)); 1441 } | 1452 wi = LIST_FIRST(&SCTP_BASE_INFO(addr_wq)); 1453 while (wi != NULL) { 1454 LIST_REMOVE(wi, sctp_nxt_addr); 1455 LIST_INSERT_HEAD(&asc->list_of_work, wi, sctp_nxt_addr); 1456 asc->cnt++; 1457 wi = LIST_FIRST(&SCTP_BASE_INFO(addr_wq)); 1458 } |
1442 SCTP_IPI_ITERATOR_WQ_UNLOCK(); | 1459 SCTP_WQ_ADDR_UNLOCK(); 1460 |
1443 if (asc->cnt == 0) { 1444 SCTP_FREE(asc, SCTP_M_ASC_IT); 1445 } else { 1446 (void)sctp_initiate_iterator(sctp_asconf_iterator_ep, 1447 sctp_asconf_iterator_stcb, 1448 NULL, /* No ep end for boundall */ 1449 SCTP_PCB_FLAGS_BOUNDALL, 1450 SCTP_PCB_ANY_FEATURES, --- 14 unchanged lines hidden (view full) --- 1465 struct sctp_nets *net; 1466 struct sctp_timer *tmr; 1467 1468#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 1469 struct socket *so; 1470 1471#endif 1472 int did_output, type; | 1461 if (asc->cnt == 0) { 1462 SCTP_FREE(asc, SCTP_M_ASC_IT); 1463 } else { 1464 (void)sctp_initiate_iterator(sctp_asconf_iterator_ep, 1465 sctp_asconf_iterator_stcb, 1466 NULL, /* No ep end for boundall */ 1467 SCTP_PCB_FLAGS_BOUNDALL, 1468 SCTP_PCB_ANY_FEATURES, --- 14 unchanged lines hidden (view full) --- 1483 struct sctp_nets *net; 1484 struct sctp_timer *tmr; 1485 1486#if defined (__APPLE__) || defined(SCTP_SO_LOCK_TESTING) 1487 struct socket *so; 1488 1489#endif 1490 int did_output, type; |
1473 struct sctp_iterator *it = NULL; | |
1474 1475 tmr = (struct sctp_timer *)t; 1476 inp = (struct sctp_inpcb *)tmr->ep; 1477 stcb = (struct sctp_tcb *)tmr->tcb; 1478 net = (struct sctp_nets *)tmr->net; 1479 CURVNET_SET((struct vnet *)tmr->vnet); 1480 did_output = 1; 1481 --- 22 unchanged lines hidden (view full) --- 1504 } 1505 tmr->stopped_from = 0xa002; 1506 if ((tmr->type != SCTP_TIMER_TYPE_ADDR_WQ) && (inp == NULL)) { 1507 CURVNET_RESTORE(); 1508 return; 1509 } 1510 /* if this is an iterator timeout, get the struct and clear inp */ 1511 tmr->stopped_from = 0xa003; | 1491 1492 tmr = (struct sctp_timer *)t; 1493 inp = (struct sctp_inpcb *)tmr->ep; 1494 stcb = (struct sctp_tcb *)tmr->tcb; 1495 net = (struct sctp_nets *)tmr->net; 1496 CURVNET_SET((struct vnet *)tmr->vnet); 1497 did_output = 1; 1498 --- 22 unchanged lines hidden (view full) --- 1521 } 1522 tmr->stopped_from = 0xa002; 1523 if ((tmr->type != SCTP_TIMER_TYPE_ADDR_WQ) && (inp == NULL)) { 1524 CURVNET_RESTORE(); 1525 return; 1526 } 1527 /* if this is an iterator timeout, get the struct and clear inp */ 1528 tmr->stopped_from = 0xa003; |
1512 if (tmr->type == SCTP_TIMER_TYPE_ITERATOR) { 1513 it = (struct sctp_iterator *)inp; 1514 inp = NULL; 1515 } | |
1516 type = tmr->type; 1517 if (inp) { 1518 SCTP_INP_INCR_REF(inp); 1519 if ((inp->sctp_socket == 0) && 1520 ((tmr->type != SCTP_TIMER_TYPE_INPKILL) && 1521 (tmr->type != SCTP_TIMER_TYPE_INIT) && 1522 (tmr->type != SCTP_TIMER_TYPE_SEND) && 1523 (tmr->type != SCTP_TIMER_TYPE_RECV) && --- 82 unchanged lines hidden (view full) --- 1606 } 1607 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { 1608 SCTP_ZERO_COPY_SENDQ_EVENT(inp, inp->sctp_socket); 1609 } 1610 break; 1611 case SCTP_TIMER_TYPE_ADDR_WQ: 1612 sctp_handle_addr_wq(); 1613 break; | 1529 type = tmr->type; 1530 if (inp) { 1531 SCTP_INP_INCR_REF(inp); 1532 if ((inp->sctp_socket == 0) && 1533 ((tmr->type != SCTP_TIMER_TYPE_INPKILL) && 1534 (tmr->type != SCTP_TIMER_TYPE_INIT) && 1535 (tmr->type != SCTP_TIMER_TYPE_SEND) && 1536 (tmr->type != SCTP_TIMER_TYPE_RECV) && --- 82 unchanged lines hidden (view full) --- 1619 } 1620 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ZERO_COPY_ACTIVE)) { 1621 SCTP_ZERO_COPY_SENDQ_EVENT(inp, inp->sctp_socket); 1622 } 1623 break; 1624 case SCTP_TIMER_TYPE_ADDR_WQ: 1625 sctp_handle_addr_wq(); 1626 break; |
1614 case SCTP_TIMER_TYPE_ITERATOR: 1615 SCTP_STAT_INCR(sctps_timoiterator); 1616 sctp_iterator_timer(it); 1617 break; | |
1618 case SCTP_TIMER_TYPE_SEND: 1619 if ((stcb == NULL) || (inp == NULL)) { 1620 break; 1621 } 1622 SCTP_STAT_INCR(sctps_timodata); 1623 stcb->asoc.timodata++; 1624 stcb->asoc.num_send_timers_up--; 1625 if (stcb->asoc.num_send_timers_up < 0) { --- 331 unchanged lines hidden (view full) --- 1957 tmr = &inp->sctp_ep.zero_copy_sendq_timer; 1958 to_ticks = SCTP_ZERO_COPY_SENDQ_TICK_DELAY; 1959 break; 1960 case SCTP_TIMER_TYPE_ADDR_WQ: 1961 /* Only 1 tick away :-) */ 1962 tmr = &SCTP_BASE_INFO(addr_wq_timer); 1963 to_ticks = SCTP_ADDRESS_TICK_DELAY; 1964 break; | 1627 case SCTP_TIMER_TYPE_SEND: 1628 if ((stcb == NULL) || (inp == NULL)) { 1629 break; 1630 } 1631 SCTP_STAT_INCR(sctps_timodata); 1632 stcb->asoc.timodata++; 1633 stcb->asoc.num_send_timers_up--; 1634 if (stcb->asoc.num_send_timers_up < 0) { --- 331 unchanged lines hidden (view full) --- 1966 tmr = &inp->sctp_ep.zero_copy_sendq_timer; 1967 to_ticks = SCTP_ZERO_COPY_SENDQ_TICK_DELAY; 1968 break; 1969 case SCTP_TIMER_TYPE_ADDR_WQ: 1970 /* Only 1 tick away :-) */ 1971 tmr = &SCTP_BASE_INFO(addr_wq_timer); 1972 to_ticks = SCTP_ADDRESS_TICK_DELAY; 1973 break; |
1965 case SCTP_TIMER_TYPE_ITERATOR: 1966 { 1967 struct sctp_iterator *it; 1968 1969 it = (struct sctp_iterator *)inp; 1970 tmr = &it->tmr; 1971 to_ticks = SCTP_ITERATOR_TICKS; 1972 } 1973 break; | |
1974 case SCTP_TIMER_TYPE_SEND: 1975 /* Here we use the RTO timer */ 1976 { 1977 int rto_val; 1978 1979 if ((stcb == NULL) || (net == NULL)) { 1980 return; 1981 } --- 340 unchanged lines hidden (view full) --- 2322 break; 2323 case SCTP_TIMER_TYPE_EARLYFR: 2324 if ((stcb == NULL) || (net == NULL)) { 2325 return; 2326 } 2327 tmr = &net->fr_timer; 2328 SCTP_STAT_INCR(sctps_earlyfrstop); 2329 break; | 1974 case SCTP_TIMER_TYPE_SEND: 1975 /* Here we use the RTO timer */ 1976 { 1977 int rto_val; 1978 1979 if ((stcb == NULL) || (net == NULL)) { 1980 return; 1981 } --- 340 unchanged lines hidden (view full) --- 2322 break; 2323 case SCTP_TIMER_TYPE_EARLYFR: 2324 if ((stcb == NULL) || (net == NULL)) { 2325 return; 2326 } 2327 tmr = &net->fr_timer; 2328 SCTP_STAT_INCR(sctps_earlyfrstop); 2329 break; |
2330 case SCTP_TIMER_TYPE_ITERATOR: 2331 { 2332 struct sctp_iterator *it; 2333 2334 it = (struct sctp_iterator *)inp; 2335 tmr = &it->tmr; 2336 } 2337 break; | |
2338 case SCTP_TIMER_TYPE_SEND: 2339 if ((stcb == NULL) || (net == NULL)) { 2340 return; 2341 } 2342 tmr = &net->rxt_timer; 2343 break; 2344 case SCTP_TIMER_TYPE_INIT: 2345 if ((stcb == NULL) || (net == NULL)) { --- 3803 unchanged lines hidden (view full) --- 6149 SCTP_INCR_LADDR_COUNT(); 6150 bzero(wi, sizeof(*wi)); 6151 (void)SCTP_GETTIME_TIMEVAL(&wi->start_time); 6152 wi->ifa = ifa; 6153 wi->action = SCTP_SET_PRIM_ADDR; 6154 atomic_add_int(&ifa->refcount, 1); 6155 6156 /* Now add it to the work queue */ | 2330 case SCTP_TIMER_TYPE_SEND: 2331 if ((stcb == NULL) || (net == NULL)) { 2332 return; 2333 } 2334 tmr = &net->rxt_timer; 2335 break; 2336 case SCTP_TIMER_TYPE_INIT: 2337 if ((stcb == NULL) || (net == NULL)) { --- 3803 unchanged lines hidden (view full) --- 6141 SCTP_INCR_LADDR_COUNT(); 6142 bzero(wi, sizeof(*wi)); 6143 (void)SCTP_GETTIME_TIMEVAL(&wi->start_time); 6144 wi->ifa = ifa; 6145 wi->action = SCTP_SET_PRIM_ADDR; 6146 atomic_add_int(&ifa->refcount, 1); 6147 6148 /* Now add it to the work queue */ |
6157 SCTP_IPI_ITERATOR_WQ_LOCK(); | 6149 SCTP_WQ_ADDR_LOCK(); |
6158 /* 6159 * Should this really be a tailq? As it is we will process the 6160 * newest first :-0 6161 */ 6162 LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr); | 6150 /* 6151 * Should this really be a tailq? As it is we will process the 6152 * newest first :-0 6153 */ 6154 LIST_INSERT_HEAD(&SCTP_BASE_INFO(addr_wq), wi, sctp_nxt_addr); |
6163 SCTP_IPI_ITERATOR_WQ_UNLOCK(); | 6155 SCTP_WQ_ADDR_UNLOCK(); |
6164 sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, 6165 (struct sctp_inpcb *)NULL, 6166 (struct sctp_tcb *)NULL, 6167 (struct sctp_nets *)NULL); 6168 return (0); 6169} 6170 6171 --- 772 unchanged lines hidden --- | 6156 sctp_timer_start(SCTP_TIMER_TYPE_ADDR_WQ, 6157 (struct sctp_inpcb *)NULL, 6158 (struct sctp_tcb *)NULL, 6159 (struct sctp_nets *)NULL); 6160 return (0); 6161} 6162 6163 --- 772 unchanged lines hidden --- |