Subversion Repositories HelenOS

Rev

Rev 4704 | Rev 4728 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4704 Rev 4722
Line 322... Line 322...
322
            printf( "Device %d already exists\n", device->device_id );
322
            printf( "Device %d already exists\n", device->device_id );
323
            fibril_rwlock_write_unlock( & eth_globals.devices_lock );
323
            fibril_rwlock_write_unlock( & eth_globals.devices_lock );
324
            return EEXIST;
324
            return EEXIST;
325
        }else{
325
        }else{
326
            // update mtu
326
            // update mtu
-
 
327
            if(( mtu > 0 ) && ( mtu <= ETH_MAX_TAGGED_CONTENT( device->flags ))){
327
            device->mtu = mtu;
328
                device->mtu = mtu;
-
 
329
            }else{
-
 
330
                 device->mtu = ETH_MAX_TAGGED_CONTENT( device->flags );
-
 
331
            }
328
            printf( "Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu );
332
            printf( "Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu );
329
            fibril_rwlock_write_unlock( & eth_globals.devices_lock );
333
            fibril_rwlock_write_unlock( & eth_globals.devices_lock );
330
            // notify all upper layer modules
334
            // notify all upper layer modules
331
            fibril_rwlock_read_lock( & eth_globals.protos_lock );
335
            fibril_rwlock_read_lock( & eth_globals.protos_lock );
332
            for( index = 0; index < eth_protos_count( & eth_globals.protos ); ++ index ){
336
            for( index = 0; index < eth_protos_count( & eth_globals.protos ); ++ index ){
Line 343... Line 347...
343
        device = ( eth_device_ref ) malloc( sizeof( eth_device_t ));
347
        device = ( eth_device_ref ) malloc( sizeof( eth_device_t ));
344
        if( ! device ) return ENOMEM;
348
        if( ! device ) return ENOMEM;
345
        device->device_id = device_id;
349
        device->device_id = device_id;
346
        device->service = service;
350
        device->service = service;
347
        device->flags = 0;
351
        device->flags = 0;
348
        device->mtu = (( mtu > 0 ) && ( mtu <= ETH_MAX_TAGGED_CONTENT( device->flags ))) ? mtu : ETH_MAX_TAGGED_CONTENT( device->flags );
352
        if(( mtu > 0 ) && ( mtu <= ETH_MAX_TAGGED_CONTENT( device->flags ))){
-
 
353
            device->mtu = mtu;
-
 
354
        }else{
-
 
355
             device->mtu = ETH_MAX_TAGGED_CONTENT( device->flags );
-
 
356
        }
349
        configuration = & names[ 0 ];
357
        configuration = & names[ 0 ];
350
        if( ERROR_OCCURRED( net_get_device_conf_req( eth_globals.net_phone, device->device_id, & configuration, count, & data ))){
358
        if( ERROR_OCCURRED( net_get_device_conf_req( eth_globals.net_phone, device->device_id, & configuration, count, & data ))){
351
            fibril_rwlock_write_unlock( & eth_globals.devices_lock );
359
            fibril_rwlock_write_unlock( & eth_globals.devices_lock );
352
            free( device );
360
            free( device );
353
            return ERROR_CODE;
361
            return ERROR_CODE;