From patchwork Sat Apr 15 00:25:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jarno Rajahalme X-Patchwork-Id: 750998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3w4b213K4Yz9s7L for ; Sat, 15 Apr 2017 10:27:05 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id DCC0EBD7; Sat, 15 Apr 2017 00:26:07 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 8999DBCA for ; Sat, 15 Apr 2017 00:26:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 46644131 for ; Sat, 15 Apr 2017 00:26:05 +0000 (UTC) Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by relay9-d.mail.gandi.net (Postfix) with ESMTPS id 0DEE840430; Sat, 15 Apr 2017 02:26:04 +0200 (CEST) Received: from mfilter15-d.gandi.net (mfilter15-d.gandi.net [217.70.178.143]) by relay6-d.mail.gandi.net (Postfix) with ESMTP id F0CCDFB877; Sat, 15 Apr 2017 02:26:03 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter15-d.gandi.net Received: from relay6-d.mail.gandi.net ([IPv6:::ffff:217.70.183.198]) by mfilter15-d.gandi.net (mfilter15-d.gandi.net [::ffff:10.0.15.180]) (amavisd-new, port 10024) with ESMTP id iI7FGZInQjJ3; Sat, 15 Apr 2017 02:26:02 +0200 (CEST) X-Originating-IP: 208.91.1.34 Received: from sc9-mailhost2.vmware.com (unknown [208.91.1.34]) (Authenticated sender: jarno@ovn.org) by relay6-d.mail.gandi.net (Postfix) with ESMTPSA id 6F178FB882; Sat, 15 Apr 2017 02:26:01 +0200 (CEST) From: Jarno Rajahalme To: dev@openvswitch.org Date: Fri, 14 Apr 2017 17:25:49 -0700 Message-Id: <1492215949-75081-3-git-send-email-jarno@ovn.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1492215949-75081-1-git-send-email-jarno@ovn.org> References: <1492215949-75081-1-git-send-email-jarno@ovn.org> X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Subject: [ovs-dev] [PATCH 3/3] ofproto-dpif: Check support for resubmit with conntrack action. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org Use the existing probed support flag for the original direction tuple to determine if resubmit(ct) can be executed or not. Signed-off-by: Jarno Rajahalme Acked-by: Ben Pfaff --- ofproto/ofproto-dpif.c | 86 ++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 25f8adf..23afc76 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -4155,13 +4155,12 @@ check_mask(struct ofproto_dpif *ofproto, const struct miniflow *flow) } static void -report_unsupported_ct(const char *detail) +report_unsupported_act(const char *action, const char *detail) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(1, 5); - VLOG_WARN_RL(&rl, "Rejecting ct action because datapath does not support " - "ct action%s%s (your kernel module may be out of date)", - detail ? " " : "", - detail ? detail : ""); + VLOG_WARN_RL(&rl, "Rejecting %s action because datapath does not support" + "%s%s (your kernel module may be out of date)", + action, detail ? " " : "", detail ? detail : ""); } static enum ofperr @@ -4169,51 +4168,56 @@ check_actions(const struct ofproto_dpif *ofproto, const struct rule_actions *const actions) { const struct ofpact *ofpact; + const struct odp_support *support = &ofproto->backer->support.odp; OFPACT_FOR_EACH (ofpact, actions->ofpacts, actions->ofpacts_len) { - const struct odp_support *support; - const struct ofpact_conntrack *ct; - const struct ofpact *a; + if (ofpact->type == OFPACT_CT) { + const struct ofpact_conntrack *ct; + const struct ofpact *a; - if (ofpact->type != OFPACT_CT) { - continue; - } + ct = CONTAINER_OF(ofpact, struct ofpact_conntrack, ofpact); - ct = CONTAINER_OF(ofpact, struct ofpact_conntrack, ofpact); - support = &ofproto->backer->support.odp; + if (!support->ct_state) { + report_unsupported_act("ct", "ct action"); + return OFPERR_OFPBAC_BAD_TYPE; + } + if ((ct->zone_imm || ct->zone_src.field) && !support->ct_zone) { + report_unsupported_act("ct", "ct zones"); + return OFPERR_OFPBAC_BAD_ARGUMENT; + } + /* So far the force commit feature is implemented together with the + * original direction tuple feature by all datapaths, so we use the + * support flag for the 'ct_orig_tuple' to indicate support for the + * force commit feature as well. */ + if ((ct->flags & NX_CT_F_FORCE) && !support->ct_orig_tuple) { + report_unsupported_act("ct", "force commit"); + return OFPERR_OFPBAC_BAD_ARGUMENT; + } - if (!support->ct_state) { - report_unsupported_ct(NULL); - return OFPERR_OFPBAC_BAD_TYPE; - } - if ((ct->zone_imm || ct->zone_src.field) && !support->ct_zone) { - report_unsupported_ct("zone"); - return OFPERR_OFPBAC_BAD_ARGUMENT; - } - /* So far the force commit feature is implemented together with the - * original direction tuple feature by all datapaths, so we use the - * support flag for the 'ct_orig_tuple' to indicate support for the - * force commit feature as well. */ - if ((ct->flags & NX_CT_F_FORCE) && !support->ct_orig_tuple) { - report_unsupported_ct("force commit"); - return OFPERR_OFPBAC_BAD_ARGUMENT; - } + OFPACT_FOR_EACH(a, ct->actions, ofpact_ct_get_action_len(ct)) { + const struct mf_field *dst = ofpact_get_mf_dst(a); - OFPACT_FOR_EACH(a, ct->actions, ofpact_ct_get_action_len(ct)) { - const struct mf_field *dst = ofpact_get_mf_dst(a); + if (a->type == OFPACT_NAT && !support->ct_state_nat) { + /* The backer doesn't seem to support the NAT bits in + * 'ct_state': assume that it doesn't support the NAT + * action. */ + report_unsupported_act("ct", "nat"); + return OFPERR_OFPBAC_BAD_TYPE; + } + if (dst && ((dst->id == MFF_CT_MARK && !support->ct_mark) || + (dst->id == MFF_CT_LABEL && !support->ct_label))) { + report_unsupported_act("ct", "setting mark and/or label"); + return OFPERR_OFPBAC_BAD_SET_ARGUMENT; + } + } + } else if (ofpact->type == OFPACT_RESUBMIT) { + struct ofpact_resubmit *resubmit = ofpact_get_RESUBMIT(ofpact); - if (a->type == OFPACT_NAT && !support->ct_state_nat) { - /* The backer doesn't seem to support the NAT bits in - * 'ct_state': assume that it doesn't support the NAT - * action. */ - report_unsupported_ct("nat"); + if (resubmit->with_ct_orig && !support->ct_orig_tuple) { + report_unsupported_act("resubmit", + "ct original direction tuple"); return OFPERR_OFPBAC_BAD_TYPE; } - if (dst && ((dst->id == MFF_CT_MARK && !support->ct_mark) - || (dst->id == MFF_CT_LABEL && !support->ct_label))) { - report_unsupported_ct("setting mark and/or label"); - return OFPERR_OFPBAC_BAD_SET_ARGUMENT; - } } }