struct dpif_ipfix *ipfix; /* Ipfix handle, or null. */
struct stp *stp; /* STP or null if disabled. */
+ /* Special rules installed by ofproto-dpif. */
+ struct rule_dpif *miss_rule;
+ struct rule_dpif *no_packet_in_rule;
+
enum ofp_config_flags frag; /* Fragmentation handling. */
bool has_netflow; /* Bridge runs netflow? */
bool has_in_band; /* Bridge has in band control? */
void
xlate_ofproto_set(struct ofproto_dpif *ofproto, const char *name,
- struct dpif *dpif, const struct mac_learning *ml,
- struct stp *stp, const struct mbridge *mbridge,
+ struct dpif *dpif, struct rule_dpif *miss_rule,
+ struct rule_dpif *no_packet_in_rule,
+ const struct mac_learning *ml, struct stp *stp,
+ const struct mbridge *mbridge,
const struct dpif_sflow *sflow,
const struct dpif_ipfix *ipfix, enum ofp_config_flags frag,
bool forward_bpdu, bool has_in_band, bool has_netflow)
xbridge->has_in_band = has_in_band;
xbridge->has_netflow = has_netflow;
xbridge->frag = frag;
+ xbridge->miss_rule = miss_rule;
+ xbridge->no_packet_in_rule = no_packet_in_rule;
}
void
ctx->xin->resubmit_hook(ctx->xin, rule, ctx->recurse);
}
if (rule == NULL && may_packet_in) {
+ struct xport *xport;
+
/* XXX
* check if table configuration flags
* OFPTC_TABLE_MISS_CONTROLLER, default.
* OFPTC_TABLE_MISS_CONTINUE,
* OFPTC_TABLE_MISS_DROP
- * When OF1.0, OFPTC_TABLE_MISS_CONTINUE is used. What to do?
- */
- rule = rule_dpif_miss_rule(ctx->xbridge->ofproto, &ctx->xin->flow);
+ * When OF1.0, OFPTC_TABLE_MISS_CONTINUE is used. What to do? */
+ xport = get_ofp_port(ctx->xbridge, ctx->xin->flow.in_port.ofp_port);
+ rule = choose_miss_rule(xport ? xport->config : 0,
+ ctx->xbridge->miss_rule,
+ ctx->xbridge->no_packet_in_rule);
}
if (rule && ctx->xin->resubmit_stats) {
rule_credit_stats(rule, ctx->xin->resubmit_stats);
};
void xlate_ofproto_set(struct ofproto_dpif *, const char *name,
- struct dpif *, const struct mac_learning *,
- struct stp *, const struct mbridge *,
- const struct dpif_sflow *, const struct dpif_ipfix *,
- enum ofp_config_flags, bool forward_bpdu,
- bool has_in_band, bool has_netflow);
+ struct dpif *, struct rule_dpif *miss_rule,
+ struct rule_dpif *no_packet_in_rule,
+ const struct mac_learning *, struct stp *,
+ const struct mbridge *, const struct dpif_sflow *,
+ const struct dpif_ipfix *, enum ofp_config_flags,
+ bool forward_bpdu, bool has_in_band, bool has_netflow);
+
void xlate_remove_ofproto(struct ofproto_dpif *);
void xlate_bundle_set(struct ofproto_dpif *, struct ofbundle *,
}
xlate_ofproto_set(ofproto, ofproto->up.name,
- ofproto->backer->dpif, ofproto->ml,
+ ofproto->backer->dpif, ofproto->miss_rule,
+ ofproto->no_packet_in_rule, ofproto->ml,
ofproto->stp, ofproto->mbridge,
ofproto->sflow, ofproto->ipfix,
ofproto->up.frag_handling,
rule_dpif_lookup(struct ofproto_dpif *ofproto, const struct flow *flow,
struct flow_wildcards *wc)
{
+ struct ofport_dpif *port;
struct rule_dpif *rule;
rule = rule_dpif_lookup_in_table(ofproto, flow, wc, 0);
if (rule) {
return rule;
}
+ port = get_ofp_port(ofproto, flow->in_port.ofp_port);
+ if (!port) {
+ VLOG_WARN_RL(&rl, "packet-in on unknown OpenFlow port %"PRIu16,
+ flow->in_port.ofp_port);
+ }
- return rule_dpif_miss_rule(ofproto, flow);
+ return choose_miss_rule(port ? port->up.pp.config : 0, ofproto->miss_rule,
+ ofproto->no_packet_in_rule);
}
struct rule_dpif *
return rule_dpif_cast(rule_from_cls_rule(cls_rule));
}
+/* Given a port configuration (specified as zero if there's no port), chooses
+ * which of 'miss_rule' and 'no_packet_in_rule' should be used in case of a
+ * flow table miss. */
struct rule_dpif *
-rule_dpif_miss_rule(struct ofproto_dpif *ofproto, const struct flow *flow)
+choose_miss_rule(enum ofputil_port_config config, struct rule_dpif *miss_rule,
+ struct rule_dpif *no_packet_in_rule)
{
- struct ofport_dpif *port;
-
- port = get_ofp_port(ofproto, flow->in_port.ofp_port);
- if (!port) {
- VLOG_WARN_RL(&rl, "packet-in on unknown OpenFlow port %"PRIu16,
- flow->in_port.ofp_port);
- return ofproto->miss_rule;
- }
-
- if (port->up.pp.config & OFPUTIL_PC_NO_PACKET_IN) {
- return ofproto->no_packet_in_rule;
- }
- return ofproto->miss_rule;
+ return config & OFPUTIL_PC_NO_PACKET_IN ? no_packet_in_rule : miss_rule;
}
static void
#include "ovs-thread.h"
#include "timer.h"
#include "util.h"
+#include "ovs-thread.h"
union user_action_cookie;
struct ofproto_dpif;
struct flow_wildcards *,
uint8_t table_id);
-struct rule_dpif *rule_dpif_miss_rule(struct ofproto_dpif *ofproto,
- const struct flow *);
-
void rule_credit_stats(struct rule_dpif *, const struct dpif_flow_stats *);
+struct rule_dpif *choose_miss_rule(enum ofputil_port_config,
+ struct rule_dpif *miss_rule,
+ struct rule_dpif *no_packet_in_rule);
+
bool ofproto_has_vlan_splinters(const struct ofproto_dpif *);
ofp_port_t vsp_realdev_to_vlandev(const struct ofproto_dpif *,
ofp_port_t realdev_ofp_port,