Rev 3912 | Rev 4075 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3912 | Rev 3991 | ||
---|---|---|---|
Line 161... | Line 161... | ||
161 | int send_message( device_id_t device_id, packet_t packet ){ |
161 | int send_message( device_id_t device_id, packet_t packet ){ |
162 | ERROR_DECLARE; |
162 | ERROR_DECLARE; |
163 | 163 | ||
164 | device_ref device; |
164 | device_ref device; |
165 | size_t length; |
165 | size_t length; |
166 | packet_t received; |
166 | packet_t next; |
167 | 167 | ||
168 | ERROR_PROPAGATE( find_device( device_id, & device )); |
168 | ERROR_PROPAGATE( find_device( device_id, & device )); |
169 | if( device->state != NETIF_ACTIVE ) return EPERM; |
169 | if( device->state != NETIF_ACTIVE ) return EPERM; |
- | 170 | do{ |
|
170 | ++ device->stats.tx_packets; |
171 | ++ device->stats.tx_packets; |
171 | ++ device->stats.rx_packets; |
172 | ++ device->stats.rx_packets; |
172 | length = packet_get_data_length( packet ); |
173 | length = packet_get_data_length( packet ); |
173 | device->stats.tx_bytes += length; |
174 | device->stats.tx_bytes += length; |
174 | device->stats.rx_bytes += length; |
175 | device->stats.rx_bytes += length; |
175 | received = packet_copy( netif_globals.networking_phone, SERVICE_LO, packet ); |
- | |
176 | packet_release( netif_globals.networking_phone, packet_get_id( packet )); |
- | |
177 | if( ! received ){ |
- | |
178 | ++ device->stats.rx_dropped; |
176 | next = pq_detach( packet ); |
179 | return EOK; |
- | |
180 | } |
- | |
181 | nil_message( device, NET_NIL_RECEIVED, packet_get_id( received ), NULL ); |
177 | nil_message( device, NET_NIL_RECEIVED, packet_get_id( packet ), PACKET_SELF ); |
182 | // message = async_send_1( device->nil_phone, NET_NIL_RECEIVED, ( device_id ), & answer ); |
- | |
183 | // if( ERROR_OCCURRED( packet_send( received, device->nil_phone ))){ |
- | |
184 | // ++ device->stats.rx_dropped; |
178 | packet = next; |
185 | // } |
- | |
186 | // if( result != EOK ) ++ device->stats.rx_dropped; |
179 | }while( packet ); |
187 | return EOK; |
180 | return EOK; |
188 | } |
181 | } |
189 | 182 | ||
190 | int start_message( device_id_t device_id ){ |
183 | int start_message( device_id_t device_id ){ |
191 | return change_state_message( device_id, NETIF_ACTIVE ); |
184 | return change_state_message( device_id, NETIF_ACTIVE ); |