* Changed ETHER_GET_LINK_STATE ethernet driver interface, added ETHER_SET_LINK_STATE_SEM.

* The device interface list now uses class DoublyLinkedList instead of struct list.
* Implemented SIOC[SG]IFMEDIA for setting (not supported by any device yet), and
  retrieving the device media information.
* Fixed a locking bug in list_domain_interfaces().
* Added new stack function device_link_changed() that should be called in case the
  link state (media) changed.
* The ethernet device module now spawns a thread and will periodically check the media
  state of all ethernet devices that support this (if any).
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20546 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-04-04 09:41:04 +00:00
parent 3458a335ab
commit 9206bb3779
14 changed files with 330 additions and 100 deletions
+8 -6
View File
@@ -21,21 +21,23 @@ enum {
ETHER_REMMULTI, /* remove multicast address */
ETHER_SETPROMISC, /* set promiscuous mode (int *) */
ETHER_GETFRAMESIZE, /* get frame size (required) (int *) */
ETHER_GETLINKSTATE
ETHER_SET_LINK_STATE_SEM,
/* pass over a semaphore to release on link state changes (sem_id *) */
ETHER_GET_LINK_STATE
/* get line speed, quality, duplex mode, etc. (ether_link_state_t *) */
};
/* ETHER_GETADDR - MAC address */
typedef struct {
uint8 ebyte[6];
typedef struct ether_address {
uint8 ebyte[6];
} ether_address_t;
/* ETHER_GETLINKSTATE */
typedef struct ether_link_state {
uint32 link_media; /* as specified in net/if_media.h */
uint32 link_quality; /* in one tenth of a percent */
uint64 link_speed; /* in Kbit/s */
uint32 media; /* as specified in net/if_media.h */
uint32 quality; /* in one tenth of a percent */
uint64 speed; /* in Kbit/s */
} ether_link_state_t;
#endif /* _ETHER_DRIVER_H */
+7 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef NET_DEVICE_H
@@ -25,6 +25,8 @@ struct net_device {
uint32 type; // IFT_ETHER, ...
size_t mtu;
uint32 media;
uint64 link_speed;
uint32 link_quality;
size_t header_length;
struct net_hardware_address address;
@@ -44,8 +46,10 @@ struct net_device_module_info {
status_t (*control)(struct net_device *device, int32 op,
void *argument, size_t length);
status_t (*send_data)(struct net_device *device, struct net_buffer *buffer);
status_t (*receive_data)(struct net_device *device, struct net_buffer **_buffer);
status_t (*send_data)(struct net_device *device,
struct net_buffer *buffer);
status_t (*receive_data)(struct net_device *device,
struct net_buffer **_buffer);
status_t (*set_mtu)(struct net_device *device, size_t mtu);
status_t (*set_promiscuous)(struct net_device *device, bool promiscuous);
+2 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2006, Haiku, Inc. All Rights Reserved.
* Copyright 2006-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef NET_STACK_H
@@ -72,6 +72,7 @@ struct net_stack_module_info {
status_t (*unregister_device_monitor)(struct net_device *device,
net_receive_func receiveFunc, void *cookie);
status_t (*device_link_changed)(struct net_device *device);
status_t (*device_removed)(struct net_device *device);
// Utility Functions