projects
/
openvswitch
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ofproto-dpif: Avoid computing flow hash multiple times.
[openvswitch]
/
lib
/
netdev-linux.c
diff --git
a/lib/netdev-linux.c
b/lib/netdev-linux.c
index bc486b0c309649d5c7db089ce72ec885e0b9a369..d2a5c7acc782b4ea921cabcc16e61d8dbaa22698 100644
(file)
--- a/
lib/netdev-linux.c
+++ b/
lib/netdev-linux.c
@@
-26,7
+26,6
@@
#include <linux/gen_stats.h>
#include <linux/if_ether.h>
#include <linux/if_tun.h>
#include <linux/gen_stats.h>
#include <linux/if_ether.h>
#include <linux/if_tun.h>
-#include <linux/ip.h>
#include <linux/types.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/types.h>
#include <linux/ethtool.h>
#include <linux/mii.h>
@@
-383,10
+382,10
@@
struct netdev_dev_linux {
int get_features_error; /* Cached error code from ETHTOOL_GSET. */
int get_ifindex_error; /* Cached error code from SIOCGIFINDEX. */
int get_features_error; /* Cached error code from ETHTOOL_GSET. */
int get_ifindex_error; /* Cached error code from SIOCGIFINDEX. */
-
uint32_t current;
/* Cached from ETHTOOL_GSET. */
-
uint32_t advertised;
/* Cached from ETHTOOL_GSET. */
-
uint32_t supported;
/* Cached from ETHTOOL_GSET. */
-
uint32_t peer;
/* Cached from ETHTOOL_GSET. */
+
enum netdev_features current;
/* Cached from ETHTOOL_GSET. */
+
enum netdev_features advertised;
/* Cached from ETHTOOL_GSET. */
+
enum netdev_features supported;
/* Cached from ETHTOOL_GSET. */
+
enum netdev_features peer;
/* Cached from ETHTOOL_GSET. */
struct ethtool_drvinfo drvinfo; /* Cached from ETHTOOL_GDRVINFO. */
struct tc *tc;
struct ethtool_drvinfo drvinfo; /* Cached from ETHTOOL_GDRVINFO. */
struct tc *tc;
@@
-1626,8
+1625,10
@@
out:
* errno value. */
static int
netdev_linux_get_features(const struct netdev *netdev_,
* errno value. */
static int
netdev_linux_get_features(const struct netdev *netdev_,
- uint32_t *current, uint32_t *advertised,
- uint32_t *supported, uint32_t *peer)
+ enum netdev_features *current,
+ enum netdev_features *advertised,
+ enum netdev_features *supported,
+ enum netdev_features *peer)
{
struct netdev_dev_linux *netdev_dev =
netdev_dev_linux_cast(netdev_get_dev(netdev_));
{
struct netdev_dev_linux *netdev_dev =
netdev_dev_linux_cast(netdev_get_dev(netdev_));
@@
-2000,7
+2001,7
@@
netdev_linux_dump_queues(const struct netdev *netdev,
{
struct netdev_dev_linux *netdev_dev =
netdev_dev_linux_cast(netdev_get_dev(netdev));
{
struct netdev_dev_linux *netdev_dev =
netdev_dev_linux_cast(netdev_get_dev(netdev));
- struct tc_queue *queue;
+ struct tc_queue *queue
, *next_queue
;
struct shash details;
int last_error;
int error;
struct shash details;
int last_error;
int error;
@@
-2014,7
+2015,8
@@
netdev_linux_dump_queues(const struct netdev *netdev,
last_error = 0;
shash_init(&details);
last_error = 0;
shash_init(&details);
- HMAP_FOR_EACH (queue, hmap_node, &netdev_dev->tc->queues) {
+ HMAP_FOR_EACH_SAFE (queue, next_queue, hmap_node,
+ &netdev_dev->tc->queues) {
shash_clear(&details);
error = netdev_dev->tc->ops->class_get(netdev, queue, &details);
shash_clear(&details);
error = netdev_dev->tc->ops->class_get(netdev, queue, &details);
@@
-2269,7
+2271,7
@@
netdev_linux_get_next_hop(const struct in_addr *host, struct in_addr *next_hop,
}
static int
}
static int
-netdev_linux_get_
status
(const struct netdev *netdev, struct shash *sh)
+netdev_linux_get_
drv_info
(const struct netdev *netdev, struct shash *sh)
{
int error;
struct netdev_dev_linux *netdev_dev =
{
int error;
struct netdev_dev_linux *netdev_dev =
@@
-2285,7
+2287,7
@@
netdev_linux_get_status(const struct netdev *netdev, struct shash *sh)
}
static int
}
static int
-netdev_internal_get_
status
(const struct netdev *netdev OVS_UNUSED, struct shash *sh)
+netdev_internal_get_
drv_info
(const struct netdev *netdev OVS_UNUSED, struct shash *sh)
{
shash_add(sh, "driver_name", xstrdup("openvswitch"));
return 0;
{
shash_add(sh, "driver_name", xstrdup("openvswitch"));
return 0;
@@
-2445,7
+2447,7
@@
const struct netdev_class netdev_linux_class =
netdev_linux_get_stats,
NULL, /* set_stats */
netdev_linux_get_features,
netdev_linux_get_stats,
NULL, /* set_stats */
netdev_linux_get_features,
- netdev_linux_get_
status
);
+ netdev_linux_get_
drv_info
);
const struct netdev_class netdev_tap_class =
NETDEV_LINUX_CLASS(
const struct netdev_class netdev_tap_class =
NETDEV_LINUX_CLASS(
@@
-2454,7
+2456,7
@@
const struct netdev_class netdev_tap_class =
netdev_tap_get_stats,
NULL, /* set_stats */
netdev_linux_get_features,
netdev_tap_get_stats,
NULL, /* set_stats */
netdev_linux_get_features,
- netdev_linux_get_
status
);
+ netdev_linux_get_
drv_info
);
const struct netdev_class netdev_internal_class =
NETDEV_LINUX_CLASS(
const struct netdev_class netdev_internal_class =
NETDEV_LINUX_CLASS(
@@
-2463,7
+2465,7
@@
const struct netdev_class netdev_internal_class =
netdev_internal_get_stats,
netdev_vport_set_stats,
NULL, /* get_features */
netdev_internal_get_stats,
netdev_vport_set_stats,
NULL, /* get_features */
- netdev_internal_get_
status
);
+ netdev_internal_get_
drv_info
);
\f
/* HTB traffic control class. */
\f
/* HTB traffic control class. */
@@
-2656,7
+2658,7
@@
htb_parse_qdisc_details__(struct netdev *netdev,
max_rate_s = shash_find_data(details, "max-rate");
hc->max_rate = max_rate_s ? strtoull(max_rate_s, NULL, 10) / 8 : 0;
if (!hc->max_rate) {
max_rate_s = shash_find_data(details, "max-rate");
hc->max_rate = max_rate_s ? strtoull(max_rate_s, NULL, 10) / 8 : 0;
if (!hc->max_rate) {
-
uint32_t
current;
+
enum netdev_features
current;
netdev_get_features(netdev, ¤t, NULL, NULL, NULL);
hc->max_rate = netdev_features_to_bps(current) / 8;
netdev_get_features(netdev, ¤t, NULL, NULL, NULL);
hc->max_rate = netdev_features_to_bps(current) / 8;
@@
-3135,7
+3137,7
@@
hfsc_parse_qdisc_details__(struct netdev *netdev, const struct shash *details,
max_rate = max_rate_s ? strtoull(max_rate_s, NULL, 10) / 8 : 0;
if (!max_rate) {
max_rate = max_rate_s ? strtoull(max_rate_s, NULL, 10) / 8 : 0;
if (!max_rate) {
-
uint32_t
current;
+
enum netdev_features
current;
netdev_get_features(netdev, ¤t, NULL, NULL, NULL);
max_rate = netdev_features_to_bps(current) / 8;
netdev_get_features(netdev, ¤t, NULL, NULL, NULL);
max_rate = netdev_features_to_bps(current) / 8;