Changeset 9520af7 in mainline for uspace/srv/net/tcp/conn.c
- Timestamp:
- 2017-09-12T15:48:01Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1d40c93d
- Parents:
- 0a1e7e4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/conn.c
r0a1e7e4 r9520af7 47 47 #include "iqueue.h" 48 48 #include "pdu.h" 49 #include "rqueue.h" 49 50 #include "segment.h" 50 51 #include "seq_no.h" … … 65 66 /** Connection association map */ 66 67 static amap_t *amap; 68 /** Taken after tcp_conn_t lock */ 67 69 static FIBRIL_MUTEX_INITIALIZE(amap_lock); 70 71 /** Internal loopback configuration */ 72 tcp_lb_t tcp_conn_lb = tcp_lb_none; 68 73 69 74 static void tcp_conn_seg_process(tcp_conn_t *, tcp_segment_t *); … … 71 76 static void tcp_conn_tw_timer_clear(tcp_conn_t *); 72 77 static void tcp_transmit_segment(inet_ep2_t *, tcp_segment_t *); 78 static void tcp_conn_trim_seg_to_wnd(tcp_conn_t *, tcp_segment_t *); 79 static void tcp_reply_rst(inet_ep2_t *, tcp_segment_t *); 73 80 74 81 static tcp_tqueue_cb_t tcp_conn_tqueue_cb = { … … 324 331 * Remove connection from the connection map. 325 332 */ 326 void tcp_conn_remove(tcp_conn_t *conn)333 static void tcp_conn_remove(tcp_conn_t *conn) 327 334 { 328 335 if (!conn->mapped) … … 369 376 void tcp_conn_sync(tcp_conn_t *conn) 370 377 { 378 assert(fibril_mutex_is_locked(&conn->lock)); 379 371 380 /* XXX select ISS */ 372 381 conn->iss = 1; … … 1358 1367 * @param seg Segment 1359 1368 */ 1360 void tcp_conn_trim_seg_to_wnd(tcp_conn_t *conn, tcp_segment_t *seg)1369 static void tcp_conn_trim_seg_to_wnd(tcp_conn_t *conn, tcp_segment_t *seg) 1361 1370 { 1362 1371 uint32_t left, right; … … 1382 1391 } 1383 1392 1393 /** Transmit segment over network. 1394 * 1395 * @param epp Endpoint pair with source and destination information 1396 * @param seg Segment (ownership retained by caller) 1397 */ 1384 1398 static void tcp_transmit_segment(inet_ep2_t *epp, tcp_segment_t *seg) 1385 1399 { 1400 tcp_pdu_t *pdu; 1401 tcp_segment_t *dseg; 1402 inet_ep2_t rident; 1403 1386 1404 log_msg(LOG_DEFAULT, LVL_DEBUG, 1387 1405 "tcp_transmit_segment(l:(%u),f:(%u), %p)", … … 1393 1411 tcp_segment_dump(seg); 1394 1412 1395 // tcp_rqueue_bounce_seg(sp, seg); 1396 // tcp_ncsim_bounce_seg(sp, seg); 1397 1398 tcp_pdu_t *pdu; 1413 if (tcp_conn_lb == tcp_lb_segment) { 1414 /* Loop back segment */ 1415 // tcp_ncsim_bounce_seg(sp, seg); 1416 1417 /* Reverse the identification */ 1418 tcp_ep2_flipped(epp, &rident); 1419 1420 /* Insert segment back into rqueue */ 1421 dseg = tcp_segment_dup(seg); 1422 tcp_rqueue_insert_seg(&rident, dseg); 1423 return; 1424 } 1399 1425 1400 1426 if (tcp_pdu_encode(epp, seg, &pdu) != EOK) { … … 1403 1429 } 1404 1430 1431 if (tcp_conn_lb == tcp_lb_pdu) { 1432 /* Loop back PDU */ 1433 if (tcp_pdu_decode(pdu, &rident, &dseg) != EOK) { 1434 log_msg(LOG_DEFAULT, LVL_WARN, "Not enough memory. Segment dropped."); 1435 tcp_pdu_delete(pdu); 1436 return; 1437 } 1438 1439 tcp_pdu_delete(pdu); 1440 1441 /* Insert decoded segment into rqueue */ 1442 tcp_rqueue_insert_seg(&rident, dseg); 1443 return; 1444 } 1445 1405 1446 tcp_transmit_pdu(pdu); 1406 1447 tcp_pdu_delete(pdu); … … 1425 1466 * @param seg Incoming segment 1426 1467 */ 1427 void tcp_reply_rst(inet_ep2_t *epp, tcp_segment_t *seg)1468 static void tcp_reply_rst(inet_ep2_t *epp, tcp_segment_t *seg) 1428 1469 { 1429 1470 tcp_segment_t *rseg;
Note:
See TracChangeset
for help on using the changeset viewer.