Subversion Repositories HelenOS

Rev

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

Rev 4708 Rev 4722
Line 60... Line 60...
60
 
60
 
61
#include "nildummy.h"
61
#include "nildummy.h"
62
 
62
 
63
/** Default maximum transmission unit.
63
/** Default maximum transmission unit.
64
 */
64
 */
65
#define DEFAULT_MTU 1500
65
#define NET_DEFAULT_MTU 1500
66
 
66
 
67
/** Network interface layer module global data.
67
/** Network interface layer module global data.
68
 */
68
 */
69
nildummy_globals_t  nildummy_globals;
69
nildummy_globals_t  nildummy_globals;
70
 
70
 
Line 172... Line 172...
172
            printf( "Device %d already exists\n", device->device_id );
172
            printf( "Device %d already exists\n", device->device_id );
173
            fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
173
            fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
174
            return EEXIST;
174
            return EEXIST;
175
        }else{
175
        }else{
176
            // update mtu
176
            // update mtu
-
 
177
            if( mtu > 0 ){
177
            device->mtu = mtu;
178
                device->mtu = mtu;
-
 
179
            }else{
-
 
180
                device->mtu = NET_DEFAULT_MTU;
-
 
181
            }
178
            printf( "Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu );
182
            printf( "Device %d already exists:\tMTU\t= %d\n", device->device_id, device->mtu );
179
            fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
183
            fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
180
            // notify the upper layer module
184
            // notify the upper layer module
181
            fibril_rwlock_read_lock( & nildummy_globals.protos_lock );
185
            fibril_rwlock_read_lock( & nildummy_globals.protos_lock );
182
            if( nildummy_globals.proto.phone ){
186
            if( nildummy_globals.proto.phone ){
Line 192... Line 196...
192
        device->device_id = device_id;
196
        device->device_id = device_id;
193
        device->service = service;
197
        device->service = service;
194
        if( mtu > 0 ){
198
        if( mtu > 0 ){
195
            device->mtu = mtu;
199
            device->mtu = mtu;
196
        }else{
200
        }else{
197
            device->mtu = DEFAULT_MTU;
201
            device->mtu = NET_DEFAULT_MTU;
198
        }
202
        }
199
        // bind the device driver
203
        // bind the device driver
200
        device->phone = netif_bind_service( device->service, device->device_id, SERVICE_ETHERNET, nildummy_receiver );
204
        device->phone = netif_bind_service( device->service, device->device_id, SERVICE_ETHERNET, nildummy_receiver );
201
        if( device->phone < 0 ){
205
        if( device->phone < 0 ){
202
            fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );
206
            fibril_rwlock_write_unlock( & nildummy_globals.devices_lock );