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
Setting tag sliver-openvswitch-2.2.90-1
[sliver-openvswitch.git]
/
ofproto
/
ofproto-dpif.c
diff --git
a/ofproto/ofproto-dpif.c
b/ofproto/ofproto-dpif.c
index
30cbb24
..
e50b4fe
100644
(file)
--- a/
ofproto/ofproto-dpif.c
+++ b/
ofproto/ofproto-dpif.c
@@
-73,11
+73,6
@@
VLOG_DEFINE_THIS_MODULE(ofproto_dpif);
COVERAGE_DEFINE(ofproto_dpif_expired);
COVERAGE_DEFINE(packet_in_overflow);
COVERAGE_DEFINE(ofproto_dpif_expired);
COVERAGE_DEFINE(packet_in_overflow);
-/* Number of implemented OpenFlow tables. */
-enum { N_TABLES = 255 };
-enum { TBL_INTERNAL = N_TABLES - 1 }; /* Used for internal hidden rules. */
-BUILD_ASSERT_DECL(N_TABLES >= 2 && N_TABLES <= 255);
-
/* No bfd/cfm status change. */
#define NO_STATUS_CHANGE -1
/* No bfd/cfm status change. */
#define NO_STATUS_CHANGE -1
@@
-94,6
+89,9
@@
struct rule_dpif {
struct dpif_flow_stats stats OVS_GUARDED;
};
struct dpif_flow_stats stats OVS_GUARDED;
};
+/* RULE_CAST() depends on this. */
+BUILD_ASSERT_DECL(offsetof(struct rule_dpif, up) == 0);
+
static void rule_get_stats(struct rule *, uint64_t *packets, uint64_t *bytes,
long long int *used);
static struct rule_dpif *rule_dpif_cast(const struct rule *);
static void rule_get_stats(struct rule *, uint64_t *packets, uint64_t *bytes,
long long int *used);
static struct rule_dpif *rule_dpif_cast(const struct rule *);
@@
-317,6
+315,8
@@
struct ofproto_dpif {
/* Work queues. */
struct guarded_list pins; /* Contains "struct ofputil_packet_in"s. */
/* Work queues. */
struct guarded_list pins; /* Contains "struct ofputil_packet_in"s. */
+ struct seq *pins_seq; /* For notifying 'pins' reception. */
+ uint64_t pins_seqno;
};
/* All existing ofproto_dpif instances, indexed by ->up.name. */
};
/* All existing ofproto_dpif instances, indexed by ->up.name. */
@@
-388,6
+388,9
@@
ofproto_dpif_send_packet_in(struct ofproto_dpif *ofproto,
free(CONST_CAST(void *, pin->up.packet));
free(pin);
}
free(CONST_CAST(void *, pin->up.packet));
free(pin);
}
+
+ /* Wakes up main thread for packet-in I/O. */
+ seq_change(ofproto->pins_seq);
}
/* The default "table-miss" behaviour for OpenFlow1.3+ is to drop the
}
/* The default "table-miss" behaviour for OpenFlow1.3+ is to drop the
@@
-945,9
+948,9
@@
open_dpif_backer(const char *type, struct dpif_backer **backerp)
return error;
}
return error;
}
-/* Tests whether 'backer''s datapath supports recirculation
Only newer datapath
- *
supports OVS_KEY_ATTR in OVS_ACTION_ATTR_USERSPACE actions. We need to
- *
disable some
features on older datapaths that don't support this feature.
+/* Tests whether 'backer''s datapath supports recirculation
. Only newer
+ *
datapaths support OVS_KEY_ATTR_RECIRC_ID in keys. We need to disable some
+ * features on older datapaths that don't support this feature.
*
* Returns false if 'backer' definitely does not support recirculation, true if
* it seems to support recirculation or if at least the error we get is
*
* Returns false if 'backer' definitely does not support recirculation, true if
* it seems to support recirculation or if at least the error we get is
@@
-1160,6
+1163,9
@@
construct(struct ofproto *ofproto_)
sset_init(&ofproto->port_poll_set);
ofproto->port_poll_errno = 0;
ofproto->change_seq = 0;
sset_init(&ofproto->port_poll_set);
ofproto->port_poll_errno = 0;
ofproto->change_seq = 0;
+ ofproto->pins_seq = seq_create();
+ ofproto->pins_seqno = seq_read(ofproto->pins_seq);
+
SHASH_FOR_EACH_SAFE (node, next, &init_ofp_ports) {
struct iface_hint *iface_hint = node->data;
SHASH_FOR_EACH_SAFE (node, next, &init_ofp_ports) {
struct iface_hint *iface_hint = node->data;
@@
-1333,6
+1339,8
@@
destruct(struct ofproto *ofproto_)
ovs_mutex_destroy(&ofproto->stats_mutex);
ovs_mutex_destroy(&ofproto->vsp_mutex);
ovs_mutex_destroy(&ofproto->stats_mutex);
ovs_mutex_destroy(&ofproto->vsp_mutex);
+ seq_destroy(ofproto->pins_seq);
+
close_dpif_backer(ofproto->backer);
}
close_dpif_backer(ofproto->backer);
}
@@
-1341,7
+1349,6
@@
run(struct ofproto *ofproto_)
{
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
uint64_t new_seq, new_dump_seq;
{
struct ofproto_dpif *ofproto = ofproto_dpif_cast(ofproto_);
uint64_t new_seq, new_dump_seq;
- const bool enable_recirc = ofproto_dpif_get_enable_recirc(ofproto);
if (mbridge_need_revalidate(ofproto->mbridge)) {
ofproto->backer->need_revalidate = REV_RECONFIGURE;
if (mbridge_need_revalidate(ofproto->mbridge)) {
ofproto->backer->need_revalidate = REV_RECONFIGURE;
@@
-1350,6
+1357,12
@@
run(struct ofproto *ofproto_)
ovs_rwlock_unlock(&ofproto->ml->rwlock);
}
ovs_rwlock_unlock(&ofproto->ml->rwlock);
}
+ /* Always updates the ofproto->pins_seqno to avoid frequent wakeup during
+ * flow restore. Even though nothing is processed during flow restore,
+ * all queued 'pins' will be handled immediately when flow restore
+ * completes. */
+ ofproto->pins_seqno = seq_read(ofproto->pins_seq);
+
/* Do not perform any periodic activity required by 'ofproto' while
* waiting for flow restore to complete. */
if (!ofproto_get_flow_restore_wait()) {
/* Do not perform any periodic activity required by 'ofproto' while
* waiting for flow restore to complete. */
if (!ofproto_get_flow_restore_wait()) {
@@
-1419,17
+1432,12
@@
run(struct ofproto *ofproto_)
/* All outstanding data in existing flows has been accounted, so it's a
* good time to do bond rebalancing. */
/* All outstanding data in existing flows has been accounted, so it's a
* good time to do bond rebalancing. */
- if (
enable_recirc &&
ofproto->has_bonded_bundles) {
+ if (ofproto->has_bonded_bundles) {
struct ofbundle *bundle;
HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
struct ofbundle *bundle;
HMAP_FOR_EACH (bundle, hmap_node, &ofproto->bundles) {
- struct bond *bond = bundle->bond;
-
- if (bond && bond_may_recirc(bond, NULL, NULL)) {
- bond_recirculation_account(bond);
- if (bond_rebalance(bundle->bond)) {
- bond_update_post_recirc_rules(bond, true);
- }
+ if (bundle->bond) {
+ bond_rebalance(bundle->bond);
}
}
}
}
}
}
@@
-1474,6
+1482,7
@@
wait(struct ofproto *ofproto_)
}
seq_wait(udpif_dump_seq(ofproto->backer->udpif), ofproto->dump_seq);
}
seq_wait(udpif_dump_seq(ofproto->backer->udpif), ofproto->dump_seq);
+ seq_wait(ofproto->pins_seq, ofproto->pins_seqno);
}
static void
}
static void
@@
-3157,24
+3166,6
@@
rule_dpif_credit_stats(struct rule_dpif *rule,
ovs_mutex_unlock(&rule->stats_mutex);
}
ovs_mutex_unlock(&rule->stats_mutex);
}
-bool
-rule_dpif_is_fail_open(const struct rule_dpif *rule)
-{
- return is_fail_open_rule(&rule->up);
-}
-
-bool
-rule_dpif_is_table_miss(const struct rule_dpif *rule)
-{
- return rule_is_table_miss(&rule->up);
-}
-
-bool
-rule_dpif_is_internal(const struct rule_dpif *rule)
-{
- return rule_is_internal(&rule->up);
-}
-
ovs_be64
rule_dpif_get_flow_cookie(const struct rule_dpif *rule)
OVS_REQUIRES(rule->up.mutex)
ovs_be64
rule_dpif_get_flow_cookie(const struct rule_dpif *rule)
OVS_REQUIRES(rule->up.mutex)
@@
-3192,7
+3183,7
@@
rule_dpif_reduce_timeouts(struct rule_dpif *rule, uint16_t idle_timeout,
/* Returns 'rule''s actions. The caller owns a reference on the returned
* actions and must eventually release it (with rule_actions_unref()) to avoid
* a memory leak. */
/* Returns 'rule''s actions. The caller owns a reference on the returned
* actions and must eventually release it (with rule_actions_unref()) to avoid
* a memory leak. */
-struct rule_actions *
+
const
struct rule_actions *
rule_dpif_get_actions(const struct rule_dpif *rule)
{
return rule_get_actions(&rule->up);
rule_dpif_get_actions(const struct rule_dpif *rule)
{
return rule_get_actions(&rule->up);
@@
-3416,22
+3407,6
@@
choose_miss_rule(enum ofputil_port_config config, struct rule_dpif *miss_rule,
}
}
}
}
-void
-rule_dpif_ref(struct rule_dpif *rule)
-{
- if (rule) {
- ofproto_rule_ref(&rule->up);
- }
-}
-
-void
-rule_dpif_unref(struct rule_dpif *rule)
-{
- if (rule) {
- ofproto_rule_unref(&rule->up);
- }
-}
-
static void
complete_operation(struct rule_dpif *rule)
OVS_REQUIRES(ofproto_mutex)
static void
complete_operation(struct rule_dpif *rule)
OVS_REQUIRES(ofproto_mutex)
@@
-3854,7
+3829,7
@@
struct trace_ctx {
static void
trace_format_rule(struct ds *result, int level, const struct rule_dpif *rule)
{
static void
trace_format_rule(struct ds *result, int level, const struct rule_dpif *rule)
{
- struct rule_actions *actions;
+
const
struct rule_actions *actions;
ovs_be64 cookie;
ds_put_char_multiple(result, '\t', level);
ovs_be64 cookie;
ds_put_char_multiple(result, '\t', level);
@@
-4539,12
+4514,12
@@
ofproto_dpif_unixctl_init(void)
ofproto_unixctl_dpif_dump_flows, NULL);
}
ofproto_unixctl_dpif_dump_flows, NULL);
}
-
-
/* Returns true if 'rule' is an internal rule,
false otherwise. */
+/* Returns true if 'table' is the table used for internal rules,
+
*
false otherwise. */
bool
bool
-
rule_is_internal(const struct rule *rule
)
+
table_is_internal(uint8_t table_id
)
{
{
- return
rule->
table_id == TBL_INTERNAL;
+ return table_id == TBL_INTERNAL;
}
\f
/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)
}
\f
/* Linux VLAN device support (e.g. "eth0.10" for VLAN 10.)