haiku/headers/private/net/ether_driver.h
Augustin Cavalier 1485e71d8c ethernet: Make it possible for ethernet drivers to send/receive net_buffers.
This paves the way for a variety of more interesting interactions
between drivers and the stack which are currently not possible
(e.g. checksum offload, #18744). The main advantage for the moment
is that we will save a memcpy of the buffer on each send/receive.

Adapt the virtio_net driver so that at least one driver is using
the new interface. Network still seems to work OK with it.

Change-Id: Ic5832e4865e3e1bed7462583ca1ffd16418d7cab
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7912
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2024-07-30 17:03:36 +00:00

47 lines
1.3 KiB
C

/*
* Copyright 2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _ETHER_DRIVER_H
#define _ETHER_DRIVER_H
/*! Standard ethernet driver interface */
#include <Drivers.h>
/* ioctl() opcodes a driver should support */
enum {
ETHER_GETADDR = B_DEVICE_OP_CODES_END,
/* get ethernet address (required) */
ETHER_INIT, /* (obsolete) */
ETHER_NONBLOCK, /* change non blocking mode (int *) */
ETHER_ADDMULTI, /* add multicast address */
ETHER_REMMULTI, /* remove multicast address */
ETHER_SETPROMISC, /* set promiscuous mode (int *) */
ETHER_GETFRAMESIZE, /* get frame size (required) (int *) */
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_SEND_NET_BUFFER, /* send a net_buffer */
ETHER_RECEIVE_NET_BUFFER, /* receive a net_buffer */
};
/* ETHER_GETADDR - MAC address */
typedef struct ether_address {
uint8 ebyte[6];
} ether_address_t;
/* ETHER_GETLINKSTATE */
typedef struct ether_link_state {
uint32 media; /* as specified in net/if_media.h */
uint32 quality; /* in one tenth of a percent */
uint64 speed; /* in bit/s */
} ether_link_state_t;
#endif /* _ETHER_DRIVER_H */