git://git.onelab.eu
/
sliver-openvswitch.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
odp-util: add verbose mode for displaying dp flow.
[sliver-openvswitch.git]
/
lib
/
netdev-linux.c
diff --git
a/lib/netdev-linux.c
b/lib/netdev-linux.c
index
e1ad4c8
..
cc86ec6
100644
(file)
--- a/
lib/netdev-linux.c
+++ b/
lib/netdev-linux.c
@@
-148,6
+148,7
@@
struct tc {
struct tc_queue {
struct hmap_node hmap_node; /* In struct tc's "queues" hmap. */
unsigned int queue_id; /* OpenFlow queue ID. */
struct tc_queue {
struct hmap_node hmap_node; /* In struct tc's "queues" hmap. */
unsigned int queue_id; /* OpenFlow queue ID. */
+ long long int created; /* Time queue was created, in msecs. */
};
/* A particular kind of traffic control. Each implementation generally maps to
};
/* A particular kind of traffic control. Each implementation generally maps to
@@
-556,9
+557,10
@@
netdev_linux_cache_cb(const struct rtnetlink_link_change *change,
shash_init(&device_shash);
netdev_get_devices(&netdev_linux_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
shash_init(&device_shash);
netdev_get_devices(&netdev_linux_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
+ struct netdev *netdev = node->data;
unsigned int flags;
unsigned int flags;
- dev = n
ode->data
;
+ dev = n
etdev_linux_cast(netdev)
;
get_flags(&dev->up, &flags);
netdev_linux_changed(dev, flags, 0);
get_flags(&dev->up, &flags);
netdev_linux_changed(dev, flags, 0);
@@
-649,6
+651,7
@@
netdev_linux_create_tap(const struct netdev_class *class OVS_UNUSED,
int error;
netdev = xzalloc(sizeof *netdev);
int error;
netdev = xzalloc(sizeof *netdev);
+ netdev->change_seq = 1;
state = &netdev->state.tap;
error = cache_notifier_ref();
state = &netdev->state.tap;
error = cache_notifier_ref();
@@
-671,19
+674,21
@@
netdev_linux_create_tap(const struct netdev_class *class OVS_UNUSED,
VLOG_WARN("%s: creating tap device failed: %s", name,
ovs_strerror(errno));
error = errno;
VLOG_WARN("%s: creating tap device failed: %s", name,
ovs_strerror(errno));
error = errno;
- goto error_
unref_notifier
;
+ goto error_
close
;
}
/* Make non-blocking. */
error = set_nonblocking(state->fd);
if (error) {
}
/* Make non-blocking. */
error = set_nonblocking(state->fd);
if (error) {
- goto error_
unref_notifier
;
+ goto error_
close
;
}
netdev_init(&netdev->up, name, &netdev_tap_class);
*netdevp = &netdev->up;
return 0;
}
netdev_init(&netdev->up, name, &netdev_tap_class);
*netdevp = &netdev->up;
return 0;
+error_close:
+ close(state->fd);
error_unref_notifier:
cache_notifier_unref();
error:
error_unref_notifier:
cache_notifier_unref();
error:
@@
-1190,7
+1195,8
@@
netdev_linux_miimon_run(void)
shash_init(&device_shash);
netdev_get_devices(&netdev_linux_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
shash_init(&device_shash);
netdev_get_devices(&netdev_linux_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
- struct netdev_linux *dev = node->data;
+ struct netdev *netdev = node->data;
+ struct netdev_linux *dev = netdev_linux_cast(netdev);
bool miimon;
if (dev->miimon_interval <= 0 || !timer_expired(&dev->miimon_timer)) {
bool miimon;
if (dev->miimon_interval <= 0 || !timer_expired(&dev->miimon_timer)) {
@@
-1218,7
+1224,8
@@
netdev_linux_miimon_wait(void)
shash_init(&device_shash);
netdev_get_devices(&netdev_linux_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
shash_init(&device_shash);
netdev_get_devices(&netdev_linux_class, &device_shash);
SHASH_FOR_EACH (node, &device_shash) {
- struct netdev_linux *dev = node->data;
+ struct netdev *netdev = node->data;
+ struct netdev_linux *dev = netdev_linux_cast(netdev);
if (dev->miimon_interval > 0) {
timer_wait(&dev->miimon_timer);
if (dev->miimon_interval > 0) {
timer_wait(&dev->miimon_timer);
@@
-1417,8
+1424,7
@@
netdev_linux_get_stats(const struct netdev *netdev_,
/* Retrieves current device stats for 'netdev-tap' netdev or
* netdev-internal. */
static int
/* Retrieves current device stats for 'netdev-tap' netdev or
* netdev-internal. */
static int
-netdev_tap_get_stats(const struct netdev *netdev_,
- struct netdev_stats *stats)
+netdev_tap_get_stats(const struct netdev *netdev_, struct netdev_stats *stats)
{
struct netdev_linux *netdev = netdev_linux_cast(netdev_);
struct netdev_stats dev_stats;
{
struct netdev_linux *netdev = netdev_linux_cast(netdev_);
struct netdev_stats dev_stats;
@@
-1998,9
+2004,11
@@
netdev_linux_get_queue_stats(const struct netdev *netdev_,
return EOPNOTSUPP;
} else {
const struct tc_queue *queue = tc_find_queue(netdev_, queue_id);
return EOPNOTSUPP;
} else {
const struct tc_queue *queue = tc_find_queue(netdev_, queue_id);
- return (queue
- ? netdev->tc->ops->class_get_stats(netdev_, queue, stats)
- : ENOENT);
+ if (!queue) {
+ return ENOENT;
+ }
+ stats->created = queue->created;
+ return netdev->tc->ops->class_get_stats(netdev_, queue, stats);
}
}
}
}
@@
-2807,6
+2815,7
@@
htb_update_queue__(struct netdev *netdev, unsigned int queue_id,
hcp = xmalloc(sizeof *hcp);
queue = &hcp->tc_queue;
queue->queue_id = queue_id;
hcp = xmalloc(sizeof *hcp);
queue = &hcp->tc_queue;
queue->queue_id = queue_id;
+ queue->created = time_msec();
hmap_insert(&htb->tc.queues, &queue->hmap_node, hash);
}
hmap_insert(&htb->tc.queues, &queue->hmap_node, hash);
}
@@
-3040,6
+3049,7
@@
hfsc_update_queue__(struct netdev *netdev, unsigned int queue_id,
hcp = xmalloc(sizeof *hcp);
queue = &hcp->tc_queue;
queue->queue_id = queue_id;
hcp = xmalloc(sizeof *hcp);
queue = &hcp->tc_queue;
queue->queue_id = queue_id;
+ queue->created = time_msec();
hmap_insert(&hfsc->tc.queues, &queue->hmap_node, hash);
}
hmap_insert(&hfsc->tc.queues, &queue->hmap_node, hash);
}
@@
-4550,7
+4560,8
@@
netdev_linux_get_ipv4(const struct netdev *netdev, struct in_addr *ip,
ifr.ifr_addr.sa_family = AF_INET;
error = netdev_linux_do_ioctl(netdev_get_name(netdev), &ifr, cmd, cmd_name);
if (!error) {
ifr.ifr_addr.sa_family = AF_INET;
error = netdev_linux_do_ioctl(netdev_get_name(netdev), &ifr, cmd, cmd_name);
if (!error) {
- const struct sockaddr_in *sin = (struct sockaddr_in *) &ifr.ifr_addr;
+ const struct sockaddr_in *sin = ALIGNED_CAST(struct sockaddr_in *,
+ &ifr.ifr_addr);
*ip = sin->sin_addr;
}
return error;
*ip = sin->sin_addr;
}
return error;