Prepared implementation of ETHER_GETLINKSTATE - it would need a bit more work to

get it to work as intended, though.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20537 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-04-03 14:57:28 +00:00
parent ae4444d031
commit a34967de86
3 changed files with 64 additions and 33 deletions

View File

@ -16,13 +16,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <KernelExport.h>
#include <Errors.h>
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <driver_settings.h>
#include "debug.h"
#include "device.h"
@ -31,6 +25,17 @@
#include "if_em.h"
#include "if_compat.h"
#include <KernelExport.h>
#include <driver_settings.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
# include <net/if_media.h>
#endif
#undef malloc
#undef free
@ -331,11 +336,28 @@ ipro1000_control(void *cookie, uint32 op, void *arg, size_t len)
DEVICE_DEBUGOUT2("ipro1000_control() ETHER_GETFRAMESIZE, framesize = %d (MTU = %d)", device->maxframesize, device->maxframesize - ENET_HEADER_SIZE);
*(uint32*)arg = device->maxframesize;
return B_OK;
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
#if 0
case ETHER_GETLINKSTATE:
{
ether_link_state_t state;
state.link_media = (info->link ? IFM_ACTIVE : 0)
| (info->full_duplex ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX)
| (info->speed == LINK_SPEED_100_MBIT ? IFM_100_TX : IFM_10_T);
state.link_speed = info->speed == LINK_SPEED_100_MBIT
? 100000 : 10000;
state.link_quality = 1000;
return user_memcpy(buffer, &state, sizeof(ether_link_state_t));
}
#endif
#endif
default:
DEVICE_DEBUGOUT("ipro1000_control() Invalid command");
break;
}
return B_ERROR;
return B_BAD_VALUE;
}

View File

@ -38,23 +38,30 @@
#define IFCAP_TXCSUM 0x0010
#define IFCAP_RXCSUM 0x0020
#define IFM_ACTIVE 0x0001
#define IFM_FDX 0x0002
#define IFM_HDX 0x0004
#define IFM_10_T 0x0008
#define IFM_100_TX 0x0010
#define IFM_1000_T 0x0020
#define IFM_1000_TX 0x0040
#define IFM_1000_SX 0x0080
#define IFM_ETHER 0x0100
#define IFM_AUTO 0x0200
#define IFM_AVALID 0x0400
#define IFM_GMASK (IFM_FDX | IFM_HDX)
#define IFM_TYPE_MASK (IFM_ETHER)
#define IFM_SUBTYPE_MASK (IFM_AUTO | IFM_1000_SX | IFM_1000_TX | IFM_1000_T | IFM_100_TX | IFM_10_T)
#define IFM_TYPE(media) ((media) & IFM_TYPE_MASK)
#define IFM_SUBTYPE(media) ((media) & IFM_SUBTYPE_MASK)
#ifdef HAIKU_TARGET_PLATFORM_HAIKU
# define IFM_FDX IFM_FULL_DUPLEX
# define IFM_HDX IFM_HALF_DUPLEX
# define IFM_1000_TX 17
# define IFM_1000_SX 18
#else
# define IFM_ACTIVE 0x0001
# define IFM_FDX 0x0002
# define IFM_HDX 0x0004
# define IFM_10_T 0x0008
# define IFM_100_TX 0x0010
# define IFM_1000_T 0x0020
# define IFM_1000_TX 0x0040
# define IFM_1000_SX 0x0080
# define IFM_ETHER 0x0100
# define IFM_AUTO 0x0200
# define IFM_AVALID 0x0400
# define IFM_GMASK (IFM_FDX | IFM_HDX)
# define IFM_TYPE_MASK (IFM_ETHER)
# define IFM_SUBTYPE_MASK \
(IFM_AUTO | IFM_1000_SX | IFM_1000_TX | IFM_1000_T | IFM_100_TX | IFM_10_T)
# define IFM_TYPE(media) ((media) & IFM_TYPE_MASK)
# define IFM_SUBTYPE(media) ((media) & IFM_SUBTYPE_MASK)
#endif
#define CSUM_TCP 0x0001 // ifnet::if_hwassist
#define CSUM_UDP 0x0002 // ifnet::if_hwassist

View File

@ -34,17 +34,19 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef _IF_EM_OSDEP_H_
#define _IF_EM_OSDEP_H_
#include <OS.h>
#include <KernelExport.h>
#include <sys/types.h>
#include <malloc.h>
#include <ByteOrder.h>
#include <string.h>
#include "driver.h"
#include "device.h"
#include "timer.h"
#include "debug.h"
#include <OS.h>
#include <KernelExport.h>
#include <ByteOrder.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#define usec_delay(x) snooze(x)
#define msec_delay(x) snooze(1000*(x))