Changeset 674 for trunk/kernel/devices/dev_nic.c
- Timestamp:
- Nov 20, 2020, 12:04:01 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/kernel/devices/dev_nic.c
r668 r674 54 54 55 55 // set chdev name 56 if( is_rx ) snprint f( chdev->name , 16 , "nic%d_rx" , channel );57 else snprint f( chdev->name , 16 , "nic%d_tx" , channel );56 if( is_rx ) snprintk( chdev->name , 16 , "nic%d_rx" , channel ); 57 else snprintk( chdev->name , 16 , "nic%d_tx" , channel ); 58 58 59 59 // initialize the root of the listening sockets list … … 360 360 361 361 /////////////////////////////////////////////////////////////////////////////////////////// 362 // This static function can becalled by the NIC_TX or NIC_RX server threads to unblock362 // This static function is called by the NIC_TX or NIC_RX server threads to unblock 363 363 // the TX client thread after completion (success or error) of a TX command registered 364 364 // in a socket identified by the <socket_xp> argument. The <status> argument defines … … 401 401 402 402 /////////////////////////////////////////////////////////////////////////////////////////// 403 // This static function can becalled by the NIC_TX or NIC_RX server threads to unblock403 // This static function is called by the NIC_TX or NIC_RX server threads to unblock 404 404 // the RX client thread after completion (success or error) of an RX command registered 405 405 // in a socket identified by the <socket_xp> argument. The <status> argument defines … … 440 440 441 441 } // end dev_nic_unblock_rx_client() 442 443 444 442 445 443 /////////////////////////////////////////////////////////////////////////////////////////// … … 680 678 // get status & space from rx_buf 681 679 status = remote_buf_status( socket_rbuf_xp ); 682 space = NIC_RX_BUF_SIZE - status;680 space = CONFIG_SOCK_RX_BUF_SIZE - status; 683 681 684 682 // get client thread … … 1268 1266 1269 1267 // compute empty space in rx_buf 1270 uint32_t space = NIC_RX_BUF_SIZE - status;1268 uint32_t space = CONFIG_SOCK_RX_BUF_SIZE - status; 1271 1269 1272 1270 // compute number of bytes to move : min (space , seg_data_len) … … 1406 1404 // update socket.state 1407 1405 hal_remote_s32( XPTR( socket_cxy , &socket_ptr->state ), 1408 TCP_STATE_CLOSED ); // TODO change to TIME_WAIT1406 TCP_STATE_CLOSED ); 1409 1407 1410 1408 // make an ACK request to R2T queue … … 1415 1413 // report success to TX client thread 1416 1414 dev_nic_unblock_tx_client( socket_xp , CMD_STS_SUCCESS ); 1417 1418 // TODO start the MSL timer / turn off others timers1419 1420 1415 } 1421 1416 } … … 1424 1419 // update socket.state 1425 1420 hal_remote_s32( XPTR( socket_cxy , &socket_ptr->state ), 1426 TCP_STATE_CLOSED ); // todo change to TIME_WAIT 1427 1428 // TODO start the MSL timer / turn off others timers 1429 1430 } 1431 else if( socket_state == TCP_STATE_TIME_WAIT ) 1432 { 1433 // TODO wait msl_time_out before unblocking TX thread 1434 1435 // update socket.state when ACK received 1436 hal_remote_s32( XPTR( socket_cxy , &socket_ptr->state ), 1437 TCP_STATE_CLOSED ); 1438 1439 // unblock TX client thead for success 1421 TCP_STATE_CLOSED ); 1422 1423 // report success to TX client thread 1440 1424 dev_nic_unblock_tx_client( socket_xp , CMD_STS_SUCCESS ); 1425 1441 1426 } 1442 1427 else if( socket_state == TCP_STATE_CLOSE_WAIT ) … … 1491 1476 1492 1477 // check socket type and state 1493 assert( (socket_type == SOCK_STREAM ) , "illegal socket type" );1494 assert( (socket_state == TCP_STATE_LISTEN ) , "illegal socket state" );1478 assert( __FUNCTION__, (socket_type == SOCK_STREAM ) , "illegal socket type" ); 1479 assert( __FUNCTION__, (socket_state == TCP_STATE_LISTEN ) , "illegal socket state" ); 1495 1480 1496 1481 // get relevant socket infos for matching … … 1638 1623 1639 1624 // check chdev direction and type 1640 assert( (chdev->func == DEV_FUNC_NIC) && (chdev->is_rx == true) ,1625 assert( __FUNCTION__, (chdev->func == DEV_FUNC_NIC) && (chdev->is_rx == true) , 1641 1626 "illegal chdev type or direction" ); 1642 1627 … … 2374 2359 // initialize socket tx_nxt, and rx_wnd 2375 2360 hal_remote_s32(XPTR(socket_cxy , &socket_ptr->tx_nxt), TCP_ISS_SERVER ); 2376 hal_remote_s32(XPTR(socket_cxy , &socket_ptr->rx_wnd), NIC_RX_BUF_SIZE);2361 hal_remote_s32(XPTR(socket_cxy , &socket_ptr->rx_wnd), CONFIG_SOCK_RX_BUF_SIZE); 2377 2362 2378 2363 // build TCP ACK-SYN segment … … 2624 2609 void dev_nic_tx_server( chdev_t * chdev ) 2625 2610 { 2626 uint8_t k_buf[ NIC_KERNEL_BUF_SIZE]; // buffer for one packet2611 uint8_t k_buf[CONFIG_SOCK_PKT_BUF_SIZE]; // buffer for one packet 2627 2612 2628 2613 xptr_t queue_root_xp; // extended pointer on sockets list root … … 2650 2635 2651 2636 // check chdev direction and type 2652 assert( (chdev->func == DEV_FUNC_NIC) && (chdev->is_rx == false) ,2637 assert( __FUNCTION__, (chdev->func == DEV_FUNC_NIC) && (chdev->is_rx == false) , 2653 2638 "illegal chdev type or direction" ); 2654 2639
Note: See TracChangeset
for help on using the changeset viewer.