summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
2fafc09)
This is a first step in implementing 'on demand flow counters'.
We save relevant flow_mod flags (OFPUTIL_FF_SEND_FLOW_REM,
OFPUTIL_FF_NO_PKT_COUNTS, OFPUTIL_FF_NO_BYT_COUNTS) into newly created rule
when a new flow is added, and echo them back in the flow stats request.
Notice that we remove send_flow_removed flag from struct rule/struct ofoperation
and we replace it with an enum tracking all ofputil_flow_mod_flags.
Signed-off-by: Daniel Baluta <dbaluta@ixiacom.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
/* Protocol-independent flow_mod flags. */
enum ofputil_flow_mod_flags {
/* Protocol-independent flow_mod flags. */
enum ofputil_flow_mod_flags {
+ /* Flags that are maintained with a flow as part of its state.
+ *
+ * (OFPUTIL_FF_EMERG would be here too, if OVS supported it.) */
OFPUTIL_FF_SEND_FLOW_REM = 1 << 0, /* All versions. */
OFPUTIL_FF_SEND_FLOW_REM = 1 << 0, /* All versions. */
- OFPUTIL_FF_CHECK_OVERLAP = 1 << 1, /* All versions. */
- OFPUTIL_FF_EMERG = 1 << 2, /* OpenFlow 1.0 only. */
- OFPUTIL_FF_RESET_COUNTS = 1 << 3, /* OpenFlow 1.2+. */
- OFPUTIL_FF_NO_PKT_COUNTS = 1 << 4, /* OpenFlow 1.3+. */
- OFPUTIL_FF_NO_BYT_COUNTS = 1 << 5 /* OpenFlow 1.3+. */
+ OFPUTIL_FF_NO_PKT_COUNTS = 1 << 1, /* OpenFlow 1.3+. */
+ OFPUTIL_FF_NO_BYT_COUNTS = 1 << 2, /* OpenFlow 1.3+. */
+#define OFPUTIL_FF_STATE (OFPUTIL_FF_SEND_FLOW_REM \
+ | OFPUTIL_FF_NO_PKT_COUNTS \
+ | OFPUTIL_FF_NO_BYT_COUNTS)
+
+ /* Flags that affect flow_mod behavior but are not part of flow state. */
+ OFPUTIL_FF_CHECK_OVERLAP = 1 << 3, /* All versions. */
+ OFPUTIL_FF_EMERG = 1 << 4, /* OpenFlow 1.0 only. */
+ OFPUTIL_FF_RESET_COUNTS = 1 << 5, /* OpenFlow 1.2+. */
};
/* Protocol-independent flow_mod.
};
/* Protocol-independent flow_mod.
long long int modified; /* Time of last modification. */
long long int used; /* Last use; time created if never used. */
uint8_t table_id; /* Index in ofproto's 'tables' array. */
long long int modified; /* Time of last modification. */
long long int used; /* Last use; time created if never used. */
uint8_t table_id; /* Index in ofproto's 'tables' array. */
- bool send_flow_removed; /* Send a flow removed message? */
+ enum ofputil_flow_mod_flags flags;
struct ovs_mutex timeout_mutex;
uint16_t hard_timeout OVS_GUARDED; /* In seconds from ->modified. */
struct ovs_mutex timeout_mutex;
uint16_t hard_timeout OVS_GUARDED; /* In seconds from ->modified. */
/* OFOPERATION_DELETE. */
enum ofp_flow_removed_reason reason; /* Reason flow was removed. */
/* OFOPERATION_DELETE. */
enum ofp_flow_removed_reason reason; /* Reason flow was removed. */
- ovs_be64 flow_cookie; /* Rule's old flow cookie. */
- uint16_t idle_timeout; /* Rule's old idle timeout. */
- uint16_t hard_timeout; /* Rule's old hard timeout. */
- bool send_flow_removed; /* Rule's old 'send_flow_removed'. */
- enum ofperr error; /* 0 if no error. */
+ ovs_be64 flow_cookie; /* Rule's old flow cookie. */
+ uint16_t idle_timeout; /* Rule's old idle timeout. */
+ uint16_t hard_timeout; /* Rule's old hard timeout. */
+ enum ofputil_flow_mod_flags flags; /* Rule's old flags. */
+ enum ofperr error; /* 0 if no error. */
};
static struct ofoperation *ofoperation_create(struct ofopgroup *,
};
static struct ofoperation *ofoperation_create(struct ofopgroup *,
fs.hard_timeout = rule->hard_timeout;
ovs_mutex_unlock(&rule->timeout_mutex);
fs.hard_timeout = rule->hard_timeout;
ovs_mutex_unlock(&rule->timeout_mutex);
- fs.flags = 0;
- if (rule->send_flow_removed) {
- fs.flags |= OFPUTIL_FF_SEND_FLOW_REM;
- /* FIXME: Implement OFPUTIL_FF_NO_PKT_COUNTS and
- OFPUTIL_FF_NO_BYT_COUNTS. */
- }
+ fs.flags = rule->flags;
+
ofputil_append_flow_stats_reply(&fs, &replies);
}
ofconn_send_replies(ofconn, &replies);
ofputil_append_flow_stats_reply(&fs, &replies);
}
ofconn_send_replies(ofconn, &replies);
ovs_mutex_unlock(&rule->timeout_mutex);
rule->table_id = table - ofproto->tables;
ovs_mutex_unlock(&rule->timeout_mutex);
rule->table_id = table - ofproto->tables;
- rule->send_flow_removed = (fm->flags & OFPUTIL_FF_SEND_FLOW_REM) != 0;
+ rule->flags = fm->flags & OFPUTIL_FF_STATE;
+
rule->ofpacts = xmemdup(fm->ofpacts, fm->ofpacts_len);
rule->ofpacts_len = fm->ofpacts_len;
rule->meter_id = find_meter(rule->ofpacts, rule->ofpacts_len);
rule->ofpacts = xmemdup(fm->ofpacts, fm->ofpacts_len);
rule->ofpacts_len = fm->ofpacts_len;
rule->meter_id = find_meter(rule->ofpacts, rule->ofpacts_len);
rule->hard_timeout = fm->hard_timeout;
ovs_mutex_unlock(&rule->timeout_mutex);
rule->hard_timeout = fm->hard_timeout;
ovs_mutex_unlock(&rule->timeout_mutex);
- rule->send_flow_removed = (fm->flags
- & OFPUTIL_FF_SEND_FLOW_REM) != 0;
-
+ rule->flags = fm->flags & OFPUTIL_FF_STATE;
if (fm->idle_timeout || fm->hard_timeout) {
if (!rule->eviction_group) {
eviction_group_add_rule(rule);
if (fm->idle_timeout || fm->hard_timeout) {
if (!rule->eviction_group) {
eviction_group_add_rule(rule);
{
struct ofputil_flow_removed fr;
{
struct ofputil_flow_removed fr;
- if (ofproto_rule_is_hidden(rule) || !rule->send_flow_removed) {
+ if (ofproto_rule_is_hidden(rule) ||
+ !(rule->flags & OFPUTIL_FF_SEND_FLOW_REM)) {
op->ofpacts = NULL;
op->ofpacts_len = 0;
}
op->ofpacts = NULL;
op->ofpacts_len = 0;
}
- rule->send_flow_removed = op->send_flow_removed;
+ rule->flags = op->flags;
op->idle_timeout = rule->idle_timeout;
op->hard_timeout = rule->hard_timeout;
ovs_mutex_unlock(&rule->timeout_mutex);
op->idle_timeout = rule->idle_timeout;
op->hard_timeout = rule->hard_timeout;
ovs_mutex_unlock(&rule->timeout_mutex);
- op->send_flow_removed = rule->send_flow_removed;
+ op->flags = rule->flags;