From patchwork Fri Apr 14 23:06:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Zhou X-Patchwork-Id: 750977 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 3w4YJy4q6Nz9s84 for ; Sat, 15 Apr 2017 09:09:54 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 87544CCF; Fri, 14 Apr 2017 23:06:38 +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 75099CB4 for ; Fri, 14 Apr 2017 23:06:34 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f194.google.com (mail-pf0-f194.google.com [209.85.192.194]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 0C2CEFB for ; Fri, 14 Apr 2017 23:06:34 +0000 (UTC) Received: by mail-pf0-f194.google.com with SMTP id i5so16741698pfc.3 for ; Fri, 14 Apr 2017 16:06:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:content-transfer-encoding; bh=0gTFWZgfWOnetUmccBGFrka2luvPTQQ/S0MsMWo2sOc=; b=rJ7ubOMg6fcMGm1YI18KjkSk/0jmPfCYy7P9WFVh+G8zkjo3P8GX7oQkXpGMKdcbFH UIFccsFH1FmlNaFOGLwwBkaTLor6duNbZvSqwb5zIJthYuTZEYIgJavACJbO0uOrLTXS klStaZWFrhhFVf+YvJr9UnNKb+d43BJnZ5TMzxCGjBIOOlunInHhswD3p4E26RY6r7PD iYz7gJeqGfpTRToFNsjvR5G4/Bjmn44bZ/VKrF+uQIjVLaygFRPPdR5tDZ35zjWtAFD3 GubyA3XI3v2n4MNlEmDVjbGKkEL1grQDDPsPTB1YgLxe7DTHIR+mEIqji2R2oyrBPb4r T78w== X-Gm-Message-State: AN3rC/7mCrXUjKfOkqjj6TY43dLK+3Wj+Ehyuv0ZyrNA0YVCLOyLc2NL pbJdSRYOYW/IQALl X-Received: by 10.99.238.5 with SMTP id e5mr9498596pgi.49.1492211193629; Fri, 14 Apr 2017 16:06:33 -0700 (PDT) Received: from centos.eng.vmware.com ([208.91.1.34]) by smtp.gmail.com with ESMTPSA id t70sm5019294pgd.33.2017.04.14.16.06.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Apr 2017 16:06:33 -0700 (PDT) From: Andy Zhou To: dev@openvswitch.org Date: Fri, 14 Apr 2017 16:06:11 -0700 Message-Id: <1492211174-28936-7-git-send-email-azhou@ovn.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1492211174-28936-1-git-send-email-azhou@ovn.org> References: <1492211174-28936-1-git-send-email-azhou@ovn.org> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE 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] [datapath backport v2 07/10] datapath: openvswitch: Deferred fifo API change. 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 Upstream commit: openvswitch: Deferred fifo API change. add_deferred_actions() API currently requires actions to be passed in as a fully encoded netlink message. So far both 'sample' and 'recirc' actions happens to carry actions as fully encoded netlink messages. However, this requirement is more restrictive than necessary, future patch will need to pass in action lists that are not fully encoded by themselves. Signed-off-by: Andy Zhou Acked-by: Joe Stringer Acked-by: Pravin B Shelar Signed-off-by: David S. Miller Upstream: 47c697aa2d07 ("openvswitch: Deferred fifo API change.") Signed-off-by: Andy Zhou Acked-by: Joe Stringer --- v1->v2: no change --- datapath/actions.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/datapath/actions.c b/datapath/actions.c index b2a0ae537e37..964d398655f8 100644 --- a/datapath/actions.c +++ b/datapath/actions.c @@ -50,6 +50,7 @@ static int do_execute_actions(struct datapath *dp, struct sk_buff *skb, struct deferred_action { struct sk_buff *skb; const struct nlattr *actions; + int actions_len; /* Store pkt_key clone when creating deferred action. */ struct sw_flow_key pkt_key; @@ -117,8 +118,9 @@ static struct deferred_action *action_fifo_put(struct action_fifo *fifo) /* Return queue entry if fifo is not full */ static struct deferred_action *add_deferred_actions(struct sk_buff *skb, - const struct sw_flow_key *key, - const struct nlattr *attr) + const struct sw_flow_key *key, + const struct nlattr *actions, + const int actions_len) { struct action_fifo *fifo; struct deferred_action *da; @@ -127,7 +129,8 @@ static struct deferred_action *add_deferred_actions(struct sk_buff *skb, da = action_fifo_put(fifo); if (da) { da->skb = skb; - da->actions = attr; + da->actions = actions; + da->actions_len = actions_len; da->pkt_key = *key; } @@ -950,7 +953,8 @@ static int sample(struct datapath *dp, struct sk_buff *skb, /* Skip the sample action when out of memory. */ return 0; - if (!add_deferred_actions(skb, key, a)) { + if (!add_deferred_actions(skb, key, nla_data(acts_list), + nla_len(acts_list))) { if (net_ratelimit()) pr_warn("%s: deferred actions limit reached, dropping sample action\n", ovs_dp_name(dp)); @@ -1107,7 +1111,7 @@ static int execute_recirc(struct datapath *dp, struct sk_buff *skb, return 0; } - da = add_deferred_actions(skb, key, NULL); + da = add_deferred_actions(skb, key, NULL, 0); if (da) { da->pkt_key.recirc_id = nla_get_u32(a); } else { @@ -1262,10 +1266,10 @@ static void process_deferred_actions(struct datapath *dp) struct sk_buff *skb = da->skb; struct sw_flow_key *key = &da->pkt_key; const struct nlattr *actions = da->actions; + int actions_len = da->actions_len; if (actions) - do_execute_actions(dp, skb, key, actions, - nla_len(actions)); + do_execute_actions(dp, skb, key, actions, actions_len); else ovs_dp_process_packet(skb, key); } while (!action_fifo_is_empty(fifo));