From c376f9a3e968570d2df2574336d86185fc18b8a2 Mon Sep 17 00:00:00 2001 From: Isaku Yamahata Date: Wed, 29 Aug 2012 02:19:02 +0900 Subject: [PATCH] ofproto-dpif: refactor rule_dpif_lookup() for table miss whose id > 0 The refactored function, rule_dpif_miss_rule(), will be used for handling table miss whose table_id > 0 by goto-table instruction. Signed-off-by: Isaku Yamahata Signed-off-by: Ben Pfaff --- ofproto/ofproto-dpif.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index b83a50f74..7d6a002d3 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -110,6 +110,8 @@ static struct rule_dpif *rule_dpif_lookup(struct ofproto_dpif *, static struct rule_dpif *rule_dpif_lookup__(struct ofproto_dpif *, const struct flow *, uint8_t table); +static struct rule_dpif *rule_dpif_miss_rule(struct ofproto_dpif *ofproto, + const struct flow *flow); static void rule_credit_stats(struct rule_dpif *, const struct dpif_flow_stats *); @@ -4545,7 +4547,6 @@ subfacet_update_stats(struct subfacet *subfacet, static struct rule_dpif * rule_dpif_lookup(struct ofproto_dpif *ofproto, const struct flow *flow) { - struct ofport_dpif *port; struct rule_dpif *rule; rule = rule_dpif_lookup__(ofproto, flow, 0); @@ -4553,16 +4554,7 @@ rule_dpif_lookup(struct ofproto_dpif *ofproto, const struct flow *flow) return rule; } - port = get_ofp_port(ofproto, flow->in_port); - if (!port) { - VLOG_WARN_RL(&rl, "packet-in on unknown port %"PRIu16, flow->in_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 rule_dpif_miss_rule(ofproto, flow); } static struct rule_dpif * @@ -4591,6 +4583,23 @@ rule_dpif_lookup__(struct ofproto_dpif *ofproto, const struct flow *flow, return rule_dpif_cast(rule_from_cls_rule(cls_rule)); } +static struct rule_dpif * +rule_dpif_miss_rule(struct ofproto_dpif *ofproto, const struct flow *flow) +{ + struct ofport_dpif *port; + + port = get_ofp_port(ofproto, flow->in_port); + if (!port) { + VLOG_WARN_RL(&rl, "packet-in on unknown port %"PRIu16, flow->in_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; +} + static void complete_operation(struct rule_dpif *rule) { -- 2.43.0