]> git.proxmox.com Git - mirror_ovs.git/blame - include/openvswitch/netdev.h
conntrack: Force commit.
[mirror_ovs.git] / include / openvswitch / netdev.h
CommitLineData
b129cc98
BW
1/*
2 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013 Nicira, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef OPENVSWITCH_NETDEV_H
18#define OPENVSWITCH_NETDEV_H 1
19
20#include <stdbool.h>
21#include <stddef.h>
22#include <stdint.h>
23
24struct netdev;
25
26/* Network device statistics.
27 *
28 * Values of unsupported statistics are set to all-1-bits (UINT64_MAX). */
29struct netdev_stats {
30 uint64_t rx_packets; /* Total packets received. */
31 uint64_t tx_packets; /* Total packets transmitted. */
32 uint64_t rx_bytes; /* Total bytes received. */
33 uint64_t tx_bytes; /* Total bytes transmitted. */
34 uint64_t rx_errors; /* Bad packets received. */
35 uint64_t tx_errors; /* Packet transmit problems. */
36 uint64_t rx_dropped; /* No buffer space. */
37 uint64_t tx_dropped; /* No buffer space. */
38 uint64_t multicast; /* Multicast packets received. */
39 uint64_t collisions;
40
41 /* Detailed receive errors. */
42 uint64_t rx_length_errors;
43 uint64_t rx_over_errors; /* Receiver ring buff overflow. */
44 uint64_t rx_crc_errors; /* Recved pkt with crc error. */
45 uint64_t rx_frame_errors; /* Recv'd frame alignment error. */
46 uint64_t rx_fifo_errors; /* Recv'r fifo overrun . */
47 uint64_t rx_missed_errors; /* Receiver missed packet. */
48
49 /* Detailed transmit errors. */
50 uint64_t tx_aborted_errors;
51 uint64_t tx_carrier_errors;
52 uint64_t tx_fifo_errors;
53 uint64_t tx_heartbeat_errors;
54 uint64_t tx_window_errors;
d6e3feb5 55
56 /* Extended statistics based on RFC2819. */
57 uint64_t rx_1_to_64_packets;
58 uint64_t rx_65_to_127_packets;
59 uint64_t rx_128_to_255_packets;
60 uint64_t rx_256_to_511_packets;
61 uint64_t rx_512_to_1023_packets;
62 uint64_t rx_1024_to_1522_packets;
63 uint64_t rx_1523_to_max_packets;
64
65 uint64_t tx_1_to_64_packets;
66 uint64_t tx_65_to_127_packets;
67 uint64_t tx_128_to_255_packets;
68 uint64_t tx_256_to_511_packets;
69 uint64_t tx_512_to_1023_packets;
70 uint64_t tx_1024_to_1522_packets;
71 uint64_t tx_1523_to_max_packets;
72
73 uint64_t tx_multicast_packets;
74
75 uint64_t rx_broadcast_packets;
76 uint64_t tx_broadcast_packets;
77
78 uint64_t rx_undersized_errors;
79 uint64_t rx_oversize_errors;
80 uint64_t rx_fragmented_errors;
81 uint64_t rx_jabber_errors;
b129cc98
BW
82};
83
84/* Features. */
85enum netdev_features {
86 NETDEV_F_10MB_HD = 1 << 0, /* 10 Mb half-duplex rate support. */
87 NETDEV_F_10MB_FD = 1 << 1, /* 10 Mb full-duplex rate support. */
88 NETDEV_F_100MB_HD = 1 << 2, /* 100 Mb half-duplex rate support. */
89 NETDEV_F_100MB_FD = 1 << 3, /* 100 Mb full-duplex rate support. */
90 NETDEV_F_1GB_HD = 1 << 4, /* 1 Gb half-duplex rate support. */
91 NETDEV_F_1GB_FD = 1 << 5, /* 1 Gb full-duplex rate support. */
92 NETDEV_F_10GB_FD = 1 << 6, /* 10 Gb full-duplex rate support. */
93 NETDEV_F_40GB_FD = 1 << 7, /* 40 Gb full-duplex rate support. */
94 NETDEV_F_100GB_FD = 1 << 8, /* 100 Gb full-duplex rate support. */
95 NETDEV_F_1TB_FD = 1 << 9, /* 1 Tb full-duplex rate support. */
96 NETDEV_F_OTHER = 1 << 10, /* Other rate, not in the list. */
97 NETDEV_F_COPPER = 1 << 11, /* Copper medium. */
98 NETDEV_F_FIBER = 1 << 12, /* Fiber medium. */
99 NETDEV_F_AUTONEG = 1 << 13, /* Auto-negotiation. */
100 NETDEV_F_PAUSE = 1 << 14, /* Pause. */
101 NETDEV_F_PAUSE_ASYM = 1 << 15, /* Asymmetric pause. */
102};
103
104int netdev_get_features(const struct netdev *,
105 enum netdev_features *current,
106 enum netdev_features *advertised,
107 enum netdev_features *supported,
108 enum netdev_features *peer);
109uint64_t netdev_features_to_bps(enum netdev_features features,
110 uint64_t default_bps);
111bool netdev_features_is_full_duplex(enum netdev_features features);
112int netdev_set_advertisements(struct netdev *, enum netdev_features advertise);
113
114#endif /* netdev.h */