Changeset 1e2e0c1e in mainline
- Timestamp:
- 2010-02-17T21:15:03Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e6b7b198
- Parents:
- bfd7aac
- Location:
- uspace/srv/net
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/netif/dp8390/dp8390.c
rbfd7aac r1e2e0c1e 350 350 tmp = pq_next( tmp ); 351 351 } 352 if( ! pq_add( tmp, packet, 0, 0 )){352 if( pq_add( & tmp, packet, 0, 0 ) != EOK ){ 353 353 return EINVAL; 354 354 } … … 1006 1006 int last, count; 1007 1007 packet_t packet; 1008 packet_t queue;1009 1008 1010 1009 // if (!(dep->de_flags & DEF_READING)) … … 1045 1044 return ELIMIT; 1046 1045 }else{ 1047 queue = pq_add( dep->received_queue, packet, 0, 0 ); 1048 if( queue ){ 1049 dep->received_queue = queue; 1046 if( pq_add( & dep->received_queue, packet, 0, 0 ) == EOK ){ 1050 1047 ++ dep->received_count; 1051 1048 }else{ -
uspace/srv/net/structures/packet/packet.c
rbfd7aac r1e2e0c1e 184 184 } 185 185 186 packet_t pq_add( packet_tfirst, packet_t packet, size_t order, size_t metric ){186 int pq_add( packet_t * first, packet_t packet, size_t order, size_t metric ){ 187 187 packet_t item; 188 188 189 if( ! packet_is_valid( packet )) return NULL;189 if(( ! first ) || ( ! packet_is_valid( packet ))) return EINVAL; 190 190 pq_set_order( packet, order, metric ); 191 if( packet_is_valid( first )){192 item = first;191 if( packet_is_valid( * first )){ 192 item = * first; 193 193 do{ 194 194 if( item->order < order ){ … … 198 198 item->next = packet->packet_id; 199 199 packet->previous = item->packet_id; 200 return first;200 return EOK; 201 201 } 202 202 }else{ … … 205 205 item->previous = packet->packet_id; 206 206 item = pm_find( packet->previous ); 207 if( item ) item->next = packet->packet_id; 208 return item ? first : packet; 207 if( item ){ 208 item->next = packet->packet_id; 209 }else{ 210 * first = packet; 211 } 212 return EOK; 209 213 } 210 214 }while( packet_is_valid( item )); 211 215 } 212 return packet; 216 * first = packet; 217 return EOK; 213 218 } 214 219 -
uspace/srv/net/structures/packet/packet.h
rbfd7aac r1e2e0c1e 86 86 * The queue is sorted in the ascending order. 87 87 * The packet is inserted right before the packets of the same order value. 88 * @param[in ] first The first packet of the queue. May be NULL.88 * @param[in,out] first The first packet of the queue. Sets the first packet of the queue. The original first packet may be shifted by the new packet. 89 89 * @param[in] packet The packet to be added. 90 90 * @param[in] order The packet order value. 91 91 * @param[in] metric The metric value of the packet. 92 * @returns The first packet of the queue. The original first packet may be shifted by the new packet. 93 * @returns NULL if the packet is not valid. 92 * @returns EOK on success. 93 * @returns EINVAL if the first parameter is NULL. 94 * @returns EINVAL if the packet is not valid. 94 95 */ 95 packet_t pq_add( packet_tfirst, packet_t packet, size_t order, size_t metric );96 int pq_add( packet_t * first, packet_t packet, size_t order, size_t metric ); 96 97 97 98 /** Finds the packet with the given order. -
uspace/srv/net/structures/packet/packet_server.c
rbfd7aac r1e2e0c1e 229 229 void packet_release( packet_t packet ){ 230 230 int index; 231 int result; 231 232 232 233 // remove debug dump 233 234 // printf( "packet %d released\n", packet->packet_id ); 234 235 for( index = 0; ( index < FREE_QUEUES_COUNT - 1 ) && ( packet->length > ps_globals.sizes[ index ] ); ++ index ); 235 ps_globals.free[ index ] = pq_add(ps_globals.free[ index ], packet, packet->length, packet->length );236 assert( ps_globals.free[ index ]);236 result = pq_add( & ps_globals.free[ index ], packet, packet->length, packet->length ); 237 assert( result == EOK ); 237 238 } 238 239 -
uspace/srv/net/tl/tcp/tcp.c
rbfd7aac r1e2e0c1e 613 613 next_packet = pq_detach( packet ); 614 614 length = packet_get_data_length( packet ); 615 tmp_packet = pq_add( socket_data->incoming, packet, new_sequence_number, length ); 616 if( ! tmp_packet ){ 615 if( ERROR_OCCURRED( pq_add( & socket_data->incoming, packet, new_sequence_number, length ))){ 617 616 // remove the corrupted packets 618 617 pq_release( tcp_globals.net_phone, packet_get_id( packet )); 619 618 pq_release( tcp_globals.net_phone, packet_get_id( next_packet )); 620 619 }else{ 621 socket_data->incoming = tmp_packet;622 620 while( next_packet ){ 623 621 new_sequence_number += length; … … 939 937 packet_t next; 940 938 packet_t acknowledged = NULL; 941 packet_t first;942 939 uint32_t old; 943 940 … … 981 978 } 982 979 // add to acknowledged or release 983 first = pq_add( acknowledged, packet, 0, 0 ); 984 if( first ){ 985 acknowledged = first; 986 }else{ 980 if( pq_add( & acknowledged, packet, 0, 0 ) != EOK ){ 987 981 pq_release( tcp_globals.net_phone, packet_get_id( packet )); 988 982 } … … 1508 1502 int tcp_queue_packet( socket_core_ref socket, tcp_socket_data_ref socket_data, packet_t packet, size_t data_length ){ 1509 1503 ERROR_DECLARE; 1510 packet_t first;1511 1504 1512 1505 assert( socket ); … … 1516 1509 ERROR_PROPAGATE( tcp_queue_prepare_packet( socket, socket_data, packet, data_length )); 1517 1510 1518 first = pq_add( socket_data->outgoing, packet, socket_data->next_outgoing, data_length ); 1519 if( ! first ){ 1520 return tcp_release_and_return( packet, EINVAL ); 1521 } 1522 socket_data->outgoing = first; 1511 if( ERROR_OCCURRED( pq_add( & socket_data->outgoing, packet, socket_data->next_outgoing, data_length ))){ 1512 return tcp_release_and_return( packet, ERROR_CODE ); 1513 } 1523 1514 socket_data->next_outgoing += data_length; 1524 1515 return EOK; -
uspace/srv/net/tl/udp/udp.c
rbfd7aac r1e2e0c1e 604 604 return udp_release_and_return( packet, result ); 605 605 } 606 packet = pq_add( packet, next_packet, index, 0 ); 606 if( ERROR_OCCURRED( pq_add( & packet, next_packet, index, 0 ))){ 607 return udp_release_and_return( packet, ERROR_CODE ); 608 } 607 609 total_length += ( size_t ) result; 608 610 if( udp_globals.checksum_computing ){
Note:
See TracChangeset
for help on using the changeset viewer.