Revisited the mtu handling. Poor net_server users can now force a lower
MTU by using a setting file. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7634 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -55,8 +55,10 @@ ipro1000_read_settings(ipro1000_device *device)
|
||||
|
||||
param = get_driver_parameter(handle, "mtu", "0", "0");
|
||||
mtu = atoi(param);
|
||||
if (mtu >= 64 && mtu <= 1500)
|
||||
device->mtu = mtu;
|
||||
if (mtu >= 50 && mtu <= 1500)
|
||||
device->maxframesize = mtu + ENET_HEADER_SIZE;
|
||||
else
|
||||
dprintf("ipro1000: unsupported mtu setting '%s' ignored\n", param);
|
||||
|
||||
unload_driver_settings(handle);
|
||||
}
|
||||
@@ -103,7 +105,7 @@ ipro1000_open(const char *name, uint32 flags, void** cookie)
|
||||
device->pciDev = device->pciInfo->device;
|
||||
device->pciFunc = device->pciInfo->function;
|
||||
device->adapter = 0;
|
||||
device->mtu = 1500; // XXX is MAXIMUM_ETHERNET_FRAME_SIZE = 1518 too much?
|
||||
device->maxframesize = 1514; // XXX is MAXIMUM_ETHERNET_FRAME_SIZE = 1518 too much?
|
||||
|
||||
ipro1000_read_settings(device);
|
||||
|
||||
@@ -328,8 +330,8 @@ ipro1000_control(void *cookie, uint32 op, void *arg, size_t len)
|
||||
return B_OK;
|
||||
|
||||
case ETHER_GETFRAMESIZE:
|
||||
TRACE("ipro1000_control() ETHER_GETFRAMESIZE, MTU = %d\n", device->mtu);
|
||||
*(uint32*)arg = device->mtu;
|
||||
TRACE("ipro1000_control() ETHER_GETFRAMESIZE, framesize = %d (MTU = %d)\n", device->maxframesize, device->maxframesize - ENET_HEADER_SIZE);
|
||||
*(uint32*)arg = device->maxframesize;
|
||||
return B_OK;
|
||||
|
||||
default:
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef struct device {
|
||||
volatile bool nonblocking;
|
||||
volatile bool closed;
|
||||
|
||||
uint32 mtu;
|
||||
uint32 maxframesize; // 14 bytes header + MTU
|
||||
uint8 macaddr[6];
|
||||
} ipro1000_device;
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
# Sample settings file for the ipro1000 driver
|
||||
#
|
||||
# This file should be moved to the directory ~/config/settings/kernel/drivers/
|
||||
# and must be RENAMED into "ipro1000"
|
||||
|
||||
# Currently supported settings are:
|
||||
#
|
||||
# mtu <value>
|
||||
#
|
||||
# where value can be in the range 50 to 1500
|
||||
#
|
||||
# to fix upload problems with DSL, use
|
||||
#
|
||||
# mtu 1492
|
||||
Reference in New Issue
Block a user