Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 4350 → Rev 4351

/branches/network/uspace/srv/net/nil/eth/eth.c
256,7 → 256,7
* @returns EINVAL if the packet is bigger than the device MTU.
* @returns ENOMEM if there is not enough memory in the packet.
*/
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype );
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu );
 
DEVICE_MAP_IMPLEMENT( eth_devices, eth_device_t )
 
270,7 → 270,7
rwlock_read_lock( & eth_globals.protos_lock );
for( index = eth_protos_count( & eth_globals.protos ) - 1; index >= 0; -- index ){
proto = eth_protos_get_index( & eth_globals.protos, index );
if( proto && proto->phone ) il_device_state_msg( proto->phone, device_id, state );
if( proto && proto->phone ) il_device_state_msg( proto->phone, device_id, state, proto->service );
}
rwlock_read_unlock( & eth_globals.protos_lock );
return EOK;
535,7 → 535,7
return EOK;
}
 
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype ){
int eth_prepare_packet( int flags, packet_t packet, uint8_t * src_addr, int ethertype, size_t mtu ){
eth_header_ex_ref header;
eth_header_ref header_dix;
eth_fcs_ref fcs;
550,8 → 550,7
if( length < 0 ) return length;
if( length < ETH_ADDR ) return EINVAL;
length = packet_get_data_length( packet );
//TODO smaller than MTU!
if( length > ETH_MAX_TAGGED_CONTENT( flags )) return EINVAL;
if( length > mtu ) return EINVAL;
if( length < ETH_MIN_TAGGED_CONTENT( flags )){
padding = packet_suffix( packet, ETH_MIN_TAGGED_CONTENT( flags ) - length );
if( ! padding ) return ENOMEM;
613,7 → 612,7
// process packet queue
next = packet;
do{
if( ERROR_OCCURRED( eth_prepare_packet( device->flags, next, ( uint8_t * ) device->addr->value, ethertype ))){
if( ERROR_OCCURRED( eth_prepare_packet( device->flags, next, ( uint8_t * ) device->addr->value, ethertype, device->mtu ))){
// release invalid packet
tmp = pq_detach( next );
pq_release( eth_globals.net_phone, packet_get_id( next ));
/branches/network/uspace/srv/net/nil/nil_remote.c
46,7 → 46,7
#include "nil_messages.h"
 
int nil_device_state_msg( int nil_phone, device_id_t device_id, int state ){
return generic_device_state_msg( nil_phone, NET_NIL_DEVICE_STATE, device_id, state );
return generic_device_state_msg( nil_phone, NET_NIL_DEVICE_STATE, device_id, state, 0 );
}
 
int nil_received_msg( int nil_phone, device_id_t device_id, packet_t packet, services_t target ){