1 | /* |
---|
2 | * Copyright (C) 2004, 2005 Mike Wray <mike.wray@hp.com> |
---|
3 | * |
---|
4 | * This program is free software; you can redistribute it and/or modify |
---|
5 | * it under the terms of the GNU General Public License as published by the |
---|
6 | * Free Software Foundation; either version 2 of the License, or (at your |
---|
7 | * option) any later version. |
---|
8 | * |
---|
9 | * This program is distributed in the hope that it will be useful, but |
---|
10 | * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
---|
11 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
---|
12 | * for more details. |
---|
13 | * |
---|
14 | * You should have received a copy of the GNU General Public License along |
---|
15 | * with this program; if not, write to the Free software Foundation, Inc., |
---|
16 | * 59 Temple Place, suite 330, Boston, MA 02111-1307 USA |
---|
17 | * |
---|
18 | */ |
---|
19 | #ifndef _VNET_VIF_H_ |
---|
20 | #define _VNET_VIF_H_ |
---|
21 | |
---|
22 | #ifdef __KERNEL__ |
---|
23 | #include <asm/atomic.h> |
---|
24 | #else |
---|
25 | #include "spinlock.h" |
---|
26 | #endif |
---|
27 | |
---|
28 | #include <if_varp.h> |
---|
29 | struct IOStream; |
---|
30 | |
---|
31 | /** Key for entries in the vif table. */ |
---|
32 | typedef struct VifKey { |
---|
33 | struct VnetId vnet; |
---|
34 | struct Vmac vmac; |
---|
35 | } VifKey; |
---|
36 | |
---|
37 | typedef struct Vif { |
---|
38 | struct VnetId vnet; |
---|
39 | struct Vmac vmac; |
---|
40 | atomic_t refcount; |
---|
41 | unsigned long timestamp; |
---|
42 | int flags; |
---|
43 | } Vif; |
---|
44 | |
---|
45 | enum { |
---|
46 | VIF_FLAG_PERSISTENT = 1, |
---|
47 | }; |
---|
48 | |
---|
49 | extern void vif_print(struct IOStream *io); |
---|
50 | |
---|
51 | extern void vif_decref(struct Vif *vif); |
---|
52 | extern void vif_incref(struct Vif *vif); |
---|
53 | |
---|
54 | extern int vif_create(struct VnetId *vnet, struct Vmac *vmac, int flags, struct Vif **vif); |
---|
55 | extern int vif_lookup(struct VnetId *vnet, struct Vmac *vmac, struct Vif **vif); |
---|
56 | extern int vif_update(struct VnetId *vnet, struct Vmac *vmac); |
---|
57 | extern int vif_remove(struct VnetId *vnet, struct Vmac *vmac); |
---|
58 | extern void vif_purge(void); |
---|
59 | extern int vif_remove_vnet(struct VnetId *vnet); |
---|
60 | |
---|
61 | extern int vif_init(void); |
---|
62 | extern void vif_exit(void); |
---|
63 | |
---|
64 | #endif |
---|