Rev 4723 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4723 | Rev 4743 | ||
---|---|---|---|
Line 320... | Line 320... | ||
320 | } |
320 | } |
321 | 321 | ||
322 | int queue_packet( dpeth_t * dep, packet_t packet ){ |
322 | int queue_packet( dpeth_t * dep, packet_t packet ){ |
323 | packet_t tmp; |
323 | packet_t tmp; |
324 | 324 | ||
325 | if( dep->packet_count > 1 ){ |
325 | if( dep->packet_count >= MAX_PACKETS ){ |
326 | if( ! pq_add( pq_previous( dep->packet_queue ), packet, 0, 0 )){ |
326 | netif_pq_release( packet_get_id( packet )); |
327 | return EINVAL; |
327 | return ELIMIT; |
328 | } |
328 | } |
- | 329 | ||
- | 330 | tmp = dep->packet_queue; |
|
- | 331 | while( pq_next( tmp )){ |
|
- | 332 | tmp = pq_next( tmp ); |
|
329 | }else{ |
333 | } |
330 | tmp = pq_add( dep->packet_queue, packet, 0, 0 ); |
334 | if( ! pq_add( tmp, packet, 0, 0 )){ |
331 | if( ! tmp ) return EINVAL; |
335 | return EINVAL; |
- | 336 | } |
|
- | 337 | if( ! dep->packet_count ){ |
|
332 | dep->packet_queue = tmp; |
338 | dep->packet_queue = packet; |
333 | } |
339 | } |
334 | ++ dep->packet_count; |
340 | ++ dep->packet_count; |
335 | return EBUSY; |
341 | return EBUSY; |
336 | } |
342 | } |
337 | 343 | ||
Line 1013... | Line 1019... | ||
1013 | 1019 | ||
1014 | dep->de_read_s = length; |
1020 | dep->de_read_s = length; |
1015 | dep->de_flags |= DEF_PACK_RECV; |
1021 | dep->de_flags |= DEF_PACK_RECV; |
1016 | // dep->de_flags &= ~DEF_READING; |
1022 | // dep->de_flags &= ~DEF_READING; |
1017 | 1023 | ||
1018 | queue = pq_add( dep->received_queue, packet, 0, 0 ); |
- | |
1019 | if( queue ){ |
- | |
1020 | dep->received_queue = queue; |
1024 | if( dep->received_count >= MAX_PACKETS ){ |
1021 | }else{ |
- | |
1022 | netif_pq_release( packet_get_id( packet )); |
1025 | netif_pq_release( packet_get_id( packet )); |
- | 1026 | return ELIMIT; |
|
- | 1027 | }else{ |
|
- | 1028 | queue = pq_add( dep->received_queue, packet, 0, 0 ); |
|
- | 1029 | if( queue ){ |
|
- | 1030 | dep->received_queue = queue; |
|
- | 1031 | ++ dep->received_count; |
|
- | 1032 | }else{ |
|
- | 1033 | netif_pq_release( packet_get_id( packet )); |
|
- | 1034 | } |
|
1023 | } |
1035 | } |
1024 | return OK; |
1036 | return OK; |
1025 | } |
1037 | } |
1026 | 1038 | ||
1027 | /*===========================================================================* |
1039 | /*===========================================================================* |