Prepare Open vSwitch 1.1.2 release.
[sliver-openvswitch.git] / datapath / vport-generic.c
1 /*
2  * Copyright (c) 2010 Nicira Networks.
3  * Distributed under the terms of the GNU GPL version 2.
4  *
5  * Significant portions of this file may be copied from parts of the Linux
6  * kernel, by Linus Torvalds and others.
7  */
8
9 #include <linux/etherdevice.h>
10
11 #include "vport-generic.h"
12
13 void vport_gen_rand_ether_addr(u8 *addr)
14 {
15         random_ether_addr(addr);
16
17         /* Set the OUI to the Nicira one. */
18         addr[0] = 0x00;
19         addr[1] = 0x23;
20         addr[2] = 0x20;
21
22         /* Set the top bit to indicate random address. */
23         addr[3] |= 0x80;
24 }
25
26 unsigned vport_gen_get_dev_flags(const struct vport *vport)
27 {
28         return IFF_UP | IFF_RUNNING | IFF_LOWER_UP;
29 }
30
31 int vport_gen_is_running(const struct vport *vport)
32 {
33         return 1;
34 }
35
36 unsigned char vport_gen_get_operstate(const struct vport *vport)
37 {
38         return IF_OPER_UP;
39 }