made mtu configureable and lowered default to 1500
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7633 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <driver_settings.h>
|
||||||
|
|
||||||
//#define DEBUG
|
//#define DEBUG
|
||||||
|
|
||||||
@@ -40,6 +41,27 @@ static int32 gOpenMask = 0;
|
|||||||
int em_attach(device_t);
|
int em_attach(device_t);
|
||||||
int em_detach(device_t);
|
int em_detach(device_t);
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
ipro1000_read_settings(ipro1000_device *device)
|
||||||
|
{
|
||||||
|
void *handle;
|
||||||
|
const char *param;
|
||||||
|
int mtu;
|
||||||
|
|
||||||
|
handle = load_driver_settings("ipro1000");
|
||||||
|
if (!handle)
|
||||||
|
return;
|
||||||
|
|
||||||
|
param = get_driver_parameter(handle, "mtu", "0", "0");
|
||||||
|
mtu = atoi(param);
|
||||||
|
if (mtu >= 64 && mtu <= 1500)
|
||||||
|
device->mtu = mtu;
|
||||||
|
|
||||||
|
unload_driver_settings(handle);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
ipro1000_open(const char *name, uint32 flags, void** cookie)
|
ipro1000_open(const char *name, uint32 flags, void** cookie)
|
||||||
{
|
{
|
||||||
@@ -81,6 +103,9 @@ ipro1000_open(const char *name, uint32 flags, void** cookie)
|
|||||||
device->pciDev = device->pciInfo->device;
|
device->pciDev = device->pciInfo->device;
|
||||||
device->pciFunc = device->pciInfo->function;
|
device->pciFunc = device->pciInfo->function;
|
||||||
device->adapter = 0;
|
device->adapter = 0;
|
||||||
|
device->mtu = 1500; // XXX is MAXIMUM_ETHERNET_FRAME_SIZE = 1518 too much?
|
||||||
|
|
||||||
|
ipro1000_read_settings(device);
|
||||||
|
|
||||||
if (em_attach(device) != 0) {
|
if (em_attach(device) != 0) {
|
||||||
TRACE("em_attach failed\n");
|
TRACE("em_attach failed\n");
|
||||||
@@ -105,7 +130,6 @@ ipro1000_close(void* cookie)
|
|||||||
|
|
||||||
device->closed = true;
|
device->closed = true;
|
||||||
release_sem(ifp->if_rcv_sem);
|
release_sem(ifp->if_rcv_sem);
|
||||||
// release_sem(device->txFreeSem);
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -304,8 +328,8 @@ ipro1000_control(void *cookie, uint32 op, void *arg, size_t len)
|
|||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
case ETHER_GETFRAMESIZE:
|
case ETHER_GETFRAMESIZE:
|
||||||
TRACE("ipro1000_control() ETHER_GETFRAMESIZE\n");
|
TRACE("ipro1000_control() ETHER_GETFRAMESIZE, MTU = %d\n", device->mtu);
|
||||||
*(uint32*)arg = MAXIMUM_ETHERNET_FRAME_SIZE;
|
*(uint32*)arg = device->mtu;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ typedef struct device {
|
|||||||
volatile bool nonblocking;
|
volatile bool nonblocking;
|
||||||
volatile bool closed;
|
volatile bool closed;
|
||||||
|
|
||||||
|
uint32 mtu;
|
||||||
uint8 macaddr[6];
|
uint8 macaddr[6];
|
||||||
} ipro1000_device;
|
} ipro1000_device;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user