#include "odp-util.h"
#include "ofp-print.h"
#include "ofpbuf.h"
+#include "ovs-rcu.h"
#include "packets.h"
#include "poll-loop.h"
#include "random.h"
/* Statistics.
*
- * ovsthread_counter is internally synchronized. */
- struct ovsthread_counter *n_hit; /* Number of flow table matches. */
- struct ovsthread_counter *n_missed; /* Number of flow table misses. */
- struct ovsthread_counter *n_lost; /* Number of misses not passed up. */
+ * ovsthread_stats is internally synchronized. */
+ struct ovsthread_stats stats; /* Contains 'struct dp_netdev_stats *'. */
/* Ports.
*
odp_port_t)
OVS_REQ_RDLOCK(dp->port_rwlock);
+enum dp_stat_type {
+ DP_STAT_HIT, /* Packets that matched in the flow table. */
+ DP_STAT_MISS, /* Packets that did not match. */
+ DP_STAT_LOST, /* Packets not passed up to the client. */
+ DP_N_STATS
+};
+
+/* Contained by struct dp_netdev's 'stats' member. */
+struct dp_netdev_stats {
+ struct ovs_mutex mutex; /* Protects 'n'. */
+
+ /* Indexed by DP_STAT_*, protected by 'mutex'. */
+ unsigned long long int n[DP_N_STATS] OVS_GUARDED;
+};
+
+
/* A port in a netdev-based datapath. */
struct dp_netdev_port {
struct hmap_node node; /* Node in dp_netdev's 'ports'. */
const struct hmap_node node; /* In owning dp_netdev's 'flow_table'. */
const struct flow flow; /* The flow that created this entry. */
- /* Number of references.
- * The classifier owns one reference.
- * Any thread trying to keep a rule from being freed should hold its own
- * reference. */
- struct ovs_refcount ref_cnt;
-
/* Protects members marked OVS_GUARDED.
*
* Acquire after datapath's flow_mutex. */
/* Statistics.
*
* Reading or writing these members requires 'mutex'. */
- long long int used OVS_GUARDED; /* Last used time, in monotonic msecs. */
- long long int packet_count OVS_GUARDED; /* Number of packets matched. */
- long long int byte_count OVS_GUARDED; /* Number of bytes matched. */
- uint16_t tcp_flags OVS_GUARDED; /* Bitwise-OR of seen tcp_flags values. */
+ struct ovsthread_stats stats; /* Contains "struct dp_netdev_flow_stats". */
/* Actions.
*
* Reading 'actions' requires 'mutex'.
* Writing 'actions' requires 'mutex' and (to allow for transactions) the
* datapath's flow_mutex. */
- struct dp_netdev_actions *actions OVS_GUARDED;
+ OVSRCU_TYPE(struct dp_netdev_actions *) actions;
};
-static struct dp_netdev_flow *dp_netdev_flow_ref(
- const struct dp_netdev_flow *);
-static void dp_netdev_flow_unref(struct dp_netdev_flow *);
+static void dp_netdev_flow_free(struct dp_netdev_flow *);
+
+/* Contained by struct dp_netdev_flow's 'stats' member. */
+struct dp_netdev_flow_stats {
+ struct ovs_mutex mutex; /* Guards all the other members. */
+
+ long long int used OVS_GUARDED; /* Last used time, in monotonic msecs. */
+ long long int packet_count OVS_GUARDED; /* Number of packets matched. */
+ long long int byte_count OVS_GUARDED; /* Number of bytes matched. */
+ uint16_t tcp_flags OVS_GUARDED; /* Bitwise-OR of seen tcp_flags values. */
+};
/* A set of datapath actions within a "struct dp_netdev_flow".
*
* 'flow' is the dp_netdev_flow for which 'flow->actions == actions') or that
* owns a reference to 'actions->ref_cnt' (or both). */
struct dp_netdev_actions {
- struct ovs_refcount ref_cnt;
-
/* These members are immutable: they do not change during the struct's
* lifetime. */
struct nlattr *actions; /* Sequence of OVS_ACTION_ATTR_* attributes. */
struct dp_netdev_actions *dp_netdev_actions_create(const struct nlattr *,
size_t);
-struct dp_netdev_actions *dp_netdev_actions_ref(
- const struct dp_netdev_actions *);
-void dp_netdev_actions_unref(struct dp_netdev_actions *);
+struct dp_netdev_actions *dp_netdev_flow_get_actions(
+ const struct dp_netdev_flow *);
+static void dp_netdev_actions_free(struct dp_netdev_actions *);
/* A thread that receives packets from some ports, looks them up in the flow
* table, and executes the actions it finds. */
*CONST_CAST(const struct dpif_class **, &dp->class) = class;
*CONST_CAST(const char **, &dp->name) = xstrdup(name);
ovs_refcount_init(&dp->ref_cnt);
- atomic_flag_init(&dp->destroyed);
+ atomic_flag_clear(&dp->destroyed);
ovs_mutex_init(&dp->flow_mutex);
classifier_init(&dp->cls, NULL);
ovs_mutex_unlock(&dp->queue_mutex);
dp->queue_seq = seq_create();
- dp->n_hit = ovsthread_counter_create();
- dp->n_missed = ovsthread_counter_create();
- dp->n_lost = ovsthread_counter_create();
+ ovsthread_stats_init(&dp->stats);
ovs_rwlock_init(&dp->port_rwlock);
hmap_init(&dp->ports);
OVS_REQUIRES(dp_netdev_mutex)
{
struct dp_netdev_port *port, *next;
+ struct dp_netdev_stats *bucket;
+ int i;
shash_find_and_delete(&dp_netdevs, dp->name);
do_del_port(dp, port->port_no);
}
ovs_rwlock_unlock(&dp->port_rwlock);
- ovsthread_counter_destroy(dp->n_hit);
- ovsthread_counter_destroy(dp->n_missed);
- ovsthread_counter_destroy(dp->n_lost);
+
+ OVSTHREAD_STATS_FOR_EACH_BUCKET (bucket, i, &dp->stats) {
+ ovs_mutex_destroy(&bucket->mutex);
+ free_cacheline(bucket);
+ }
+ ovsthread_stats_destroy(&dp->stats);
dp_netdev_purge_queues(dp);
seq_destroy(dp->queue_seq);
ovs_mutex_destroy(&dp->flow_mutex);
seq_destroy(dp->port_seq);
hmap_destroy(&dp->ports);
- atomic_flag_destroy(&dp->destroyed);
- ovs_refcount_destroy(&dp->ref_cnt);
latch_destroy(&dp->exit_latch);
free(CONST_CAST(char *, dp->name));
free(dp);
dpif_netdev_get_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
+ struct dp_netdev_stats *bucket;
+ size_t i;
fat_rwlock_rdlock(&dp->cls.rwlock);
stats->n_flows = hmap_count(&dp->flow_table);
fat_rwlock_unlock(&dp->cls.rwlock);
- stats->n_hit = ovsthread_counter_read(dp->n_hit);
- stats->n_missed = ovsthread_counter_read(dp->n_missed);
- stats->n_lost = ovsthread_counter_read(dp->n_lost);
+ stats->n_hit = stats->n_missed = stats->n_lost = 0;
+ OVSTHREAD_STATS_FOR_EACH_BUCKET (bucket, i, &dp->stats) {
+ ovs_mutex_lock(&bucket->mutex);
+ stats->n_hit += bucket->n[DP_STAT_HIT];
+ stats->n_missed += bucket->n[DP_STAT_MISS];
+ stats->n_lost += bucket->n[DP_STAT_LOST];
+ ovs_mutex_unlock(&bucket->mutex);
+ }
stats->n_masks = UINT32_MAX;
stats->n_mask_hit = UINT64_MAX;
return error;
}
+static void
+dp_netdev_flow_free(struct dp_netdev_flow *flow)
+{
+ struct dp_netdev_flow_stats *bucket;
+ size_t i;
+
+ OVSTHREAD_STATS_FOR_EACH_BUCKET (bucket, i, &flow->stats) {
+ ovs_mutex_destroy(&bucket->mutex);
+ free_cacheline(bucket);
+ }
+ ovsthread_stats_destroy(&flow->stats);
+
+ cls_rule_destroy(CONST_CAST(struct cls_rule *, &flow->cr));
+ dp_netdev_actions_free(dp_netdev_flow_get_actions(flow));
+ ovs_mutex_destroy(&flow->mutex);
+ free(flow);
+}
+
static void
dp_netdev_remove_flow(struct dp_netdev *dp, struct dp_netdev_flow *flow)
OVS_REQ_WRLOCK(dp->cls.rwlock)
classifier_remove(&dp->cls, cr);
hmap_remove(&dp->flow_table, node);
- dp_netdev_flow_unref(flow);
-}
-
-static struct dp_netdev_flow *
-dp_netdev_flow_ref(const struct dp_netdev_flow *flow_)
-{
- struct dp_netdev_flow *flow = CONST_CAST(struct dp_netdev_flow *, flow_);
- if (flow) {
- ovs_refcount_ref(&flow->ref_cnt);
- }
- return flow;
-}
-
-static void
-dp_netdev_flow_unref(struct dp_netdev_flow *flow)
-{
- if (flow && ovs_refcount_unref(&flow->ref_cnt) == 1) {
- cls_rule_destroy(CONST_CAST(struct cls_rule *, &flow->cr));
- ovs_mutex_lock(&flow->mutex);
- dp_netdev_actions_unref(flow->actions);
- ovs_mutex_unlock(&flow->mutex);
- ovs_mutex_destroy(&flow->mutex);
- free(flow);
- }
+ ovsrcu_postpone(dp_netdev_flow_free, flow);
}
static void
fat_rwlock_rdlock(&dp->cls.rwlock);
netdev_flow = dp_netdev_flow_cast(classifier_lookup(&dp->cls, flow, NULL));
- dp_netdev_flow_ref(netdev_flow);
fat_rwlock_unlock(&dp->cls.rwlock);
return netdev_flow;
HMAP_FOR_EACH_WITH_HASH (netdev_flow, node, flow_hash(flow, 0),
&dp->flow_table) {
if (flow_equal(&netdev_flow->flow, flow)) {
- return dp_netdev_flow_ref(netdev_flow);
+ return netdev_flow;
}
}
static void
get_dpif_flow_stats(struct dp_netdev_flow *netdev_flow,
struct dpif_flow_stats *stats)
- OVS_REQ_RDLOCK(netdev_flow->mutex)
{
- stats->n_packets = netdev_flow->packet_count;
- stats->n_bytes = netdev_flow->byte_count;
- stats->used = netdev_flow->used;
- stats->tcp_flags = netdev_flow->tcp_flags;
+ struct dp_netdev_flow_stats *bucket;
+ size_t i;
+
+ memset(stats, 0, sizeof *stats);
+ OVSTHREAD_STATS_FOR_EACH_BUCKET (bucket, i, &netdev_flow->stats) {
+ ovs_mutex_lock(&bucket->mutex);
+ stats->n_packets += bucket->packet_count;
+ stats->n_bytes += bucket->byte_count;
+ stats->used = MAX(stats->used, bucket->used);
+ stats->tcp_flags |= bucket->tcp_flags;
+ ovs_mutex_unlock(&bucket->mutex);
+ }
}
static int
fat_rwlock_unlock(&dp->cls.rwlock);
if (netdev_flow) {
- struct dp_netdev_actions *actions = NULL;
-
- ovs_mutex_lock(&netdev_flow->mutex);
if (stats) {
get_dpif_flow_stats(netdev_flow, stats);
}
- if (actionsp) {
- actions = dp_netdev_actions_ref(netdev_flow->actions);
- }
- ovs_mutex_unlock(&netdev_flow->mutex);
-
- dp_netdev_flow_unref(netdev_flow);
if (actionsp) {
+ struct dp_netdev_actions *actions;
+
+ actions = dp_netdev_flow_get_actions(netdev_flow);
*actionsp = ofpbuf_clone_data(actions->actions, actions->size);
- dp_netdev_actions_unref(actions);
}
- } else {
+ } else {
error = ENOENT;
}
netdev_flow = xzalloc(sizeof *netdev_flow);
*CONST_CAST(struct flow *, &netdev_flow->flow) = *flow;
- ovs_refcount_init(&netdev_flow->ref_cnt);
ovs_mutex_init(&netdev_flow->mutex);
- ovs_mutex_lock(&netdev_flow->mutex);
- netdev_flow->actions = dp_netdev_actions_create(actions, actions_len);
+ ovsthread_stats_init(&netdev_flow->stats);
+
+ ovsrcu_set(&netdev_flow->actions,
+ dp_netdev_actions_create(actions, actions_len));
match_init(&match, flow, wc);
cls_rule_init(CONST_CAST(struct cls_rule *, &netdev_flow->cr),
flow_hash(flow, 0));
fat_rwlock_unlock(&dp->cls.rwlock);
- ovs_mutex_unlock(&netdev_flow->mutex);
-
return 0;
}
static void
clear_stats(struct dp_netdev_flow *netdev_flow)
- OVS_REQUIRES(netdev_flow->mutex)
{
- netdev_flow->used = 0;
- netdev_flow->packet_count = 0;
- netdev_flow->byte_count = 0;
- netdev_flow->tcp_flags = 0;
+ struct dp_netdev_flow_stats *bucket;
+ size_t i;
+
+ OVSTHREAD_STATS_FOR_EACH_BUCKET (bucket, i, &netdev_flow->stats) {
+ ovs_mutex_lock(&bucket->mutex);
+ bucket->used = 0;
+ bucket->packet_count = 0;
+ bucket->byte_count = 0;
+ bucket->tcp_flags = 0;
+ ovs_mutex_unlock(&bucket->mutex);
+ }
}
static int
new_actions = dp_netdev_actions_create(put->actions,
put->actions_len);
- ovs_mutex_lock(&netdev_flow->mutex);
- old_actions = netdev_flow->actions;
- netdev_flow->actions = new_actions;
+ old_actions = dp_netdev_flow_get_actions(netdev_flow);
+ ovsrcu_set(&netdev_flow->actions, new_actions);
+
if (put->stats) {
get_dpif_flow_stats(netdev_flow, put->stats);
}
if (put->flags & DPIF_FP_ZERO_STATS) {
clear_stats(netdev_flow);
}
- ovs_mutex_unlock(&netdev_flow->mutex);
- dp_netdev_actions_unref(old_actions);
+ ovsrcu_postpone(dp_netdev_actions_free, old_actions);
} else if (put->flags & DPIF_FP_CREATE) {
error = EEXIST;
} else {
/* Overlapping flow. */
error = EINVAL;
}
- dp_netdev_flow_unref(netdev_flow);
}
ovs_mutex_unlock(&dp->flow_mutex);
netdev_flow = dp_netdev_find_flow(dp, &key);
if (netdev_flow) {
if (del->stats) {
- ovs_mutex_lock(&netdev_flow->mutex);
get_dpif_flow_stats(netdev_flow, del->stats);
- ovs_mutex_unlock(&netdev_flow->mutex);
}
dp_netdev_remove_flow(dp, netdev_flow);
} else {
}
struct dp_netdev_flow_state {
- uint32_t bucket;
- uint32_t offset;
struct dp_netdev_actions *actions;
struct odputil_keybuf keybuf;
struct odputil_keybuf maskbuf;
struct dpif_flow_stats stats;
};
-static int
-dpif_netdev_flow_dump_start(const struct dpif *dpif OVS_UNUSED, void **statep)
+struct dp_netdev_flow_iter {
+ uint32_t bucket;
+ uint32_t offset;
+ int status;
+ struct ovs_mutex mutex;
+};
+
+static void
+dpif_netdev_flow_dump_state_init(void **statep)
{
struct dp_netdev_flow_state *state;
*statep = state = xmalloc(sizeof *state);
- state->bucket = 0;
- state->offset = 0;
state->actions = NULL;
+}
+
+static void
+dpif_netdev_flow_dump_state_uninit(void *state_)
+{
+ struct dp_netdev_flow_state *state = state_;
+
+ free(state);
+}
+
+static int
+dpif_netdev_flow_dump_start(const struct dpif *dpif OVS_UNUSED, void **iterp)
+{
+ struct dp_netdev_flow_iter *iter;
+
+ *iterp = iter = xmalloc(sizeof *iter);
+ iter->bucket = 0;
+ iter->offset = 0;
+ iter->status = 0;
+ ovs_mutex_init(&iter->mutex);
return 0;
}
+/* XXX the caller must use 'actions' without quiescing */
static int
-dpif_netdev_flow_dump_next(const struct dpif *dpif, void *state_,
+dpif_netdev_flow_dump_next(const struct dpif *dpif, void *iter_, void *state_,
const struct nlattr **key, size_t *key_len,
const struct nlattr **mask, size_t *mask_len,
const struct nlattr **actions, size_t *actions_len,
const struct dpif_flow_stats **stats)
{
+ struct dp_netdev_flow_iter *iter = iter_;
struct dp_netdev_flow_state *state = state_;
struct dp_netdev *dp = get_dp_netdev(dpif);
struct dp_netdev_flow *netdev_flow;
- struct hmap_node *node;
+ int error;
- fat_rwlock_rdlock(&dp->cls.rwlock);
- node = hmap_at_position(&dp->flow_table, &state->bucket, &state->offset);
- if (node) {
- netdev_flow = CONTAINER_OF(node, struct dp_netdev_flow, node);
- dp_netdev_flow_ref(netdev_flow);
+ ovs_mutex_lock(&iter->mutex);
+ error = iter->status;
+ if (!error) {
+ struct hmap_node *node;
+
+ fat_rwlock_rdlock(&dp->cls.rwlock);
+ node = hmap_at_position(&dp->flow_table, &iter->bucket, &iter->offset);
+ if (node) {
+ netdev_flow = CONTAINER_OF(node, struct dp_netdev_flow, node);
+ }
+ fat_rwlock_unlock(&dp->cls.rwlock);
+ if (!node) {
+ iter->status = error = EOF;
+ }
}
- fat_rwlock_unlock(&dp->cls.rwlock);
- if (!node) {
- return EOF;
+ ovs_mutex_unlock(&iter->mutex);
+ if (error) {
+ return error;
}
if (key) {
ofpbuf_use_stack(&buf, &state->maskbuf, sizeof state->maskbuf);
minimask_expand(&netdev_flow->cr.match.mask, &wc);
odp_flow_key_from_mask(&buf, &wc.masks, &netdev_flow->flow,
- odp_to_u32(wc.masks.in_port.odp_port));
+ odp_to_u32(wc.masks.in_port.odp_port),
+ SIZE_MAX);
*mask = buf.data;
*mask_len = buf.size;
}
if (actions || stats) {
- dp_netdev_actions_unref(state->actions);
state->actions = NULL;
- ovs_mutex_lock(&netdev_flow->mutex);
if (actions) {
- state->actions = dp_netdev_actions_ref(netdev_flow->actions);
+ state->actions = dp_netdev_flow_get_actions(netdev_flow);
*actions = state->actions->actions;
*actions_len = state->actions->size;
}
+
if (stats) {
get_dpif_flow_stats(netdev_flow, &state->stats);
*stats = &state->stats;
}
- ovs_mutex_unlock(&netdev_flow->mutex);
}
- dp_netdev_flow_unref(netdev_flow);
-
return 0;
}
static int
-dpif_netdev_flow_dump_done(const struct dpif *dpif OVS_UNUSED, void *state_)
+dpif_netdev_flow_dump_done(const struct dpif *dpif OVS_UNUSED, void *iter_)
{
- struct dp_netdev_flow_state *state = state_;
+ struct dp_netdev_flow_iter *iter = iter_;
- dp_netdev_actions_unref(state->actions);
- free(state);
+ ovs_mutex_destroy(&iter->mutex);
+ free(iter);
return 0;
}
}
/* Extract flow key. */
- flow_extract(execute->packet, md->skb_priority, md->pkt_mark, &md->tunnel,
- (union flow_in_port *)&md->in_port, &key);
+ flow_extract(execute->packet, md, &key);
ovs_rwlock_rdlock(&dp->port_rwlock);
dp_netdev_execute_actions(dp, &key, execute->packet, md, execute->actions,
return 0;
}
+static int
+dpif_netdev_handlers_set(struct dpif *dpif OVS_UNUSED,
+ uint32_t n_handlers OVS_UNUSED)
+{
+ return 0;
+}
+
static int
dpif_netdev_queue_to_priority(const struct dpif *dpif OVS_UNUSED,
uint32_t queue_id, uint32_t *priority)
}
static int
-dpif_netdev_recv(struct dpif *dpif, struct dpif_upcall *upcall,
- struct ofpbuf *buf)
+dpif_netdev_recv(struct dpif *dpif, uint32_t n_handlers OVS_UNUSED,
+ struct dpif_upcall *upcall, struct ofpbuf *buf)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
struct dp_netdev_queue *q;
}
static void
-dpif_netdev_recv_wait(struct dpif *dpif)
+dpif_netdev_recv_wait(struct dpif *dpif, uint32_t handler_id OVS_UNUSED)
{
struct dp_netdev *dp = get_dp_netdev(dpif);
uint64_t seq;
struct dp_netdev_actions *netdev_actions;
netdev_actions = xmalloc(sizeof *netdev_actions);
- ovs_refcount_init(&netdev_actions->ref_cnt);
netdev_actions->actions = xmemdup(actions, size);
netdev_actions->size = size;
return netdev_actions;
}
-/* Increments 'actions''s refcount. */
struct dp_netdev_actions *
-dp_netdev_actions_ref(const struct dp_netdev_actions *actions_)
+dp_netdev_flow_get_actions(const struct dp_netdev_flow *flow)
{
- struct dp_netdev_actions *actions;
-
- actions = CONST_CAST(struct dp_netdev_actions *, actions_);
- if (actions) {
- ovs_refcount_ref(&actions->ref_cnt);
- }
- return actions;
+ return ovsrcu_get(struct dp_netdev_actions *, &flow->actions);
}
-/* Decrements 'actions''s refcount and frees 'actions' if the refcount reaches
- * 0. */
-void
-dp_netdev_actions_unref(struct dp_netdev_actions *actions)
+static void
+dp_netdev_actions_free(struct dp_netdev_actions *actions)
{
- if (actions && ovs_refcount_unref(&actions->ref_cnt) == 1) {
- free(actions->actions);
- free(actions);
- }
+ free(actions->actions);
+ free(actions);
}
\f
static void *
if (!error) {
struct pkt_metadata md
= PKT_METADATA_INITIALIZER(port->port_no);
- dp_netdev_port_input(dp, &packet, &md);
+ dp_netdev_port_input(dp, &packet, &md);
received_anything = true;
} else if (error != EAGAIN && error != EOPNOTSUPP) {
static struct vlog_rate_limit rl
}
}
\f
+static void *
+dp_netdev_flow_stats_new_cb(void)
+{
+ struct dp_netdev_flow_stats *bucket = xzalloc_cacheline(sizeof *bucket);
+ ovs_mutex_init(&bucket->mutex);
+ return bucket;
+}
+
static void
dp_netdev_flow_used(struct dp_netdev_flow *netdev_flow,
- const struct ofpbuf *packet)
- OVS_REQUIRES(netdev_flow->mutex)
+ const struct ofpbuf *packet,
+ const struct flow *key)
{
- netdev_flow->used = time_msec();
- netdev_flow->packet_count++;
- netdev_flow->byte_count += packet->size;
- netdev_flow->tcp_flags |= packet_get_tcp_flags(packet, &netdev_flow->flow);
+ uint16_t tcp_flags = ntohs(key->tcp_flags);
+ long long int now = time_msec();
+ struct dp_netdev_flow_stats *bucket;
+
+ bucket = ovsthread_stats_bucket_get(&netdev_flow->stats,
+ dp_netdev_flow_stats_new_cb);
+
+ ovs_mutex_lock(&bucket->mutex);
+ bucket->used = MAX(now, bucket->used);
+ bucket->packet_count++;
+ bucket->byte_count += packet->size;
+ bucket->tcp_flags |= tcp_flags;
+ ovs_mutex_unlock(&bucket->mutex);
+}
+
+static void *
+dp_netdev_stats_new_cb(void)
+{
+ struct dp_netdev_stats *bucket = xzalloc_cacheline(sizeof *bucket);
+ ovs_mutex_init(&bucket->mutex);
+ return bucket;
+}
+
+static void
+dp_netdev_count_packet(struct dp_netdev *dp, enum dp_stat_type type)
+{
+ struct dp_netdev_stats *bucket;
+
+ bucket = ovsthread_stats_bucket_get(&dp->stats, dp_netdev_stats_new_cb);
+ ovs_mutex_lock(&bucket->mutex);
+ bucket->n[type]++;
+ ovs_mutex_unlock(&bucket->mutex);
}
static void
if (packet->size < ETH_HEADER_LEN) {
return;
}
- flow_extract(packet, md->skb_priority, md->pkt_mark, &md->tunnel,
- (union flow_in_port *)&md->in_port, &key);
+ flow_extract(packet, md, &key);
netdev_flow = dp_netdev_lookup_flow(dp, &key);
if (netdev_flow) {
struct dp_netdev_actions *actions;
- ovs_mutex_lock(&netdev_flow->mutex);
- dp_netdev_flow_used(netdev_flow, packet);
- actions = dp_netdev_actions_ref(netdev_flow->actions);
- ovs_mutex_unlock(&netdev_flow->mutex);
+ dp_netdev_flow_used(netdev_flow, packet, &key);
+ actions = dp_netdev_flow_get_actions(netdev_flow);
dp_netdev_execute_actions(dp, &key, packet, md,
actions->actions, actions->size);
- dp_netdev_actions_unref(actions);
- ovsthread_counter_inc(dp->n_hit, 1);
+ dp_netdev_count_packet(dp, DP_STAT_HIT);
} else {
- ovsthread_counter_inc(dp->n_missed, 1);
+ dp_netdev_count_packet(dp, DP_STAT_MISS);
dp_netdev_output_userspace(dp, packet, DPIF_UC_MISS, &key, NULL);
}
}
error = 0;
} else {
- ovsthread_counter_inc(dp->n_lost, 1);
+ dp_netdev_count_packet(dp, DP_STAT_LOST);
error = ENOBUFS;
}
ovs_mutex_unlock(&dp->queue_mutex);
dpif_netdev_flow_put,
dpif_netdev_flow_del,
dpif_netdev_flow_flush,
+ dpif_netdev_flow_dump_state_init,
dpif_netdev_flow_dump_start,
dpif_netdev_flow_dump_next,
+ NULL,
dpif_netdev_flow_dump_done,
+ dpif_netdev_flow_dump_state_uninit,
dpif_netdev_execute,
NULL, /* operate */
dpif_netdev_recv_set,
+ dpif_netdev_handlers_set,
dpif_netdev_queue_to_priority,
dpif_netdev_recv,
dpif_netdev_recv_wait,