49#define NEIGHBOUR_MIN_TIMEOUT ( TICKS_PER_SEC / 8 )
52#define NEIGHBOUR_MAX_TIMEOUT ( TICKS_PER_SEC * 3 )
64#define NEIGHBOUR_DELAY_MAX_BURST 2
195 unsigned long elapsed;
196 unsigned long threshold;
197 unsigned int count = 0;
220 if ( elapsed < threshold ) {
222 ( threshold - elapsed ) );
245 netdev->ll_addr ) ) != 0 ) {
247 "transmit deferred packet: %s\n",
264 const void *ll_dest ) {
356 net_source ) ) != 0 ) {
357 DBGC (
neighbour,
"NEIGHBOUR %s %s %s could not transmit %s "
380 const void *net_source ) {
425 netdev->ll_addr ) ) != 0 ) {
443 const void *net_dest,
const void *ll_dest ) {
#define NULL
NULL pointer (VOID *)
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
#define NEIGHBOUR_DELAY_MS
static struct net_device * netdev
#define __unused
Declare a variable or data structure as unused.
#define CACHE_EXPENSIVE
Items with a high replacement cost.
static unsigned int count
Number of entries.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define ENOENT
No such file or directory.
#define ETIMEDOUT
Connection timed out.
#define ENOMEM
Not enough space.
#define ENOBUFS
No buffer space available.
#define ENODEV
No such device.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define TICKS_PER_MS
Number of ticks per millisecond.
void * memcpy(void *dest, const void *src, size_t len) __nonnull
#define iob_push(iobuf, len)
#define iob_pull(iobuf, len)
#define list_first_entry(list, type, member)
Get the container of the first entry in a list.
#define list_last_entry(list, type, member)
Get the container of the last entry in a list.
#define LIST_HEAD_INIT(list)
Initialise a static list head.
#define list_for_each_entry_safe(pos, tmp, head, member)
Iterate over entries in a list, safe against deletion of the current entry.
#define list_add_tail(new, head)
Add a new entry to the tail of a list.
#define list_for_each_entry(pos, head, member)
Iterate over entries in a list.
#define list_del(list)
Delete an entry from a list.
#define INIT_LIST_HEAD(list)
Initialise a list head.
#define list_empty(list)
Test whether a list is empty.
#define list_add(new, head)
Add a new entry to the head of a list.
void * zalloc(size_t size)
Allocate cleared memory.
Dynamic memory allocation.
#define __cache_discarder(cost)
Declare a cache discarder.
int neighbour_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, struct neighbour_discovery *discovery, const void *net_source)
Transmit packet, determining link-layer address via neighbour discovery.
static void neighbour_expired(struct retry_timer *timer, int over)
Handle neighbour timer expiry.
static struct neighbour * neighbour_create(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest)
Create neighbour cache entry.
static struct neighbour * neighbour_find(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest)
Find neighbour cache entry.
#define NEIGHBOUR_MAX_TIMEOUT
Neighbour discovery maximum timeout.
struct list_head neighbours
The neighbour cache.
static void neighbour_destroy(struct neighbour *neighbour, int rc)
Destroy neighbour cache entry.
static void neighbour_discovered(struct neighbour *neighbour, const void *ll_dest)
Complete neighbour discovery.
int neighbour_update(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *ll_dest)
Update existing neighbour cache entry.
static struct pending_operation neighbour_delayed
Pending operation for delayed transmissions.
#define NEIGHBOUR_MIN_TIMEOUT
Neighbour discovery minimum timeout.
static void neighbour_flush(struct net_device *netdev, void *priv __unused)
Update neighbour cache on network device state change or removal.
static void neighbour_tx_queue(struct neighbour *neighbour)
Transmit deferred packets.
#define NEIGHBOUR_DELAY_MAX_BURST
Neighbour discovery maximum burst count for delayed transmissions.
int neighbour_define(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *ll_dest)
Define neighbour cache entry.
static void neighbour_free(struct refcnt *refcnt)
Free neighbour cache entry.
static void neighbour_discover(struct neighbour *neighbour, struct neighbour_discovery *discovery, const void *net_source)
Start neighbour discovery.
static unsigned int neighbour_discard(void)
Discard some cached neighbour entries.
int net_tx(struct io_buffer *iobuf, struct net_device *netdev, struct net_protocol *net_protocol, const void *ll_dest, const void *ll_source)
Transmit network-layer packet.
void netdev_tx_err(struct net_device *netdev, struct io_buffer *iobuf, int rc)
Discard transmitted packet.
static struct net_device * netdev_get(struct net_device *netdev)
Get reference to network device.
static int netdev_is_open(struct net_device *netdev)
Check whether or not network device is open.
static void netdev_put(struct net_device *netdev)
Drop reference to network device.
#define __net_driver
Declare a network driver.
void pending_put(struct pending_operation *pending)
Mark an operation as no longer pending.
void pending_get(struct pending_operation *pending)
Mark an operation as pending.
static void(* free)(struct refcnt *refcnt))
#define ref_get(refcnt)
Get additional reference to object.
#define ref_put(refcnt)
Drop reference to object.
#define ref_init(refcnt, free)
Initialise a reference counter.
void start_timer(struct retry_timer *timer)
Start timer.
void start_timer_fixed(struct retry_timer *timer, unsigned long timeout)
Start timer with a specified timeout.
void stop_timer(struct retry_timer *timer)
Stop timer.
static void start_timer_nodelay(struct retry_timer *timer)
Start timer with no delay.
#define container_of(ptr, type, field)
Get containing structure.
char * strerror(int errno)
Retrieve string representation of error number.
int memcmp(const void *first, const void *second, size_t len)
Compare memory regions.
void * data
Start of data.
struct list_head list
List of which this buffer is a member.
A doubly-linked list entry (or list head)
const char * name
Protocol name.
const char *(* ntoa)(const void *ll_addr)
Transcribe link-layer address.
uint8_t ll_addr_len
Link-layer address length.
A neighbour transmission delay pseudo-header.
A neighbour discovery protocol.
int(* tx_request)(struct net_device *netdev, struct net_protocol *net_protocol, const void *net_dest, const void *net_source)
Transmit neighbour discovery request.
struct neighbour_discovery * discovery
Neighbour discovery protocol (if discovery is ongoing)
uint8_t net_source[MAX_NET_ADDR_LEN]
Network-layer source address (for discovery requests)
struct retry_timer timer
Retransmission timer.
struct list_head tx_queue
Pending I/O buffers.
struct refcnt refcnt
Reference count.
struct net_protocol * net_protocol
Network-layer protocol.
struct net_device * netdev
Network device.
uint8_t ll_dest[MAX_LL_ADDR_LEN]
Link-layer destination address.
uint8_t net_dest[MAX_NET_ADDR_LEN]
Network-layer destination address.
struct list_head list
List of neighbour cache entries.
A network upper-layer driver.
A network-layer protocol.
const char * name
Protocol name.
uint8_t net_addr_len
Network-layer address length.
const char *(* ntoa)(const void *net_addr)
Transcribe network-layer address.
unsigned long currticks(void)
Get current system time in ticks.
static struct tlan_private * priv