From patchwork Wed Aug 23 06:24:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuanhan Liu X-Patchwork-Id: 804808 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=fridaylinux-org.20150623.gappssmtp.com header.i=@fridaylinux-org.20150623.gappssmtp.com header.b="KsBy7coG"; dkim-atps=neutral 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 3xccxG4lPJz9sCZ for ; Wed, 23 Aug 2017 16:30:26 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4B8BBAAC; Wed, 23 Aug 2017 06:27:14 +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 CC6FBAA6 for ; Wed, 23 Aug 2017 06:27:11 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pf0-f176.google.com (mail-pf0-f176.google.com [209.85.192.176]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id C1072A6 for ; Wed, 23 Aug 2017 06:27:11 +0000 (UTC) Received: by mail-pf0-f176.google.com with SMTP id x137so3561247pfd.2 for ; Tue, 22 Aug 2017 23:27:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A847gUXqEWvUK2SjAhXxa1wWLEEmWugmkb7C+BMilqY=; b=KsBy7coGe8Fx7+7E2B5LeQz/bcRPBcITFyTM8DGXCW4MAfVyBmXSFfhXHgQ4zfJ8ow OSkD7eYb5B2rXLogHKLjiYZk7C/sTJ3nsnyfzU71PBxKxcL5j43BsYSE4lLdwubs2eSF TaazILlCoTGpOg2EQasqbXV9FjllaeBfvaz72HQoMj7kzueEKKxfhhQHzNUcxQ8lLNOV lFq04weBu+SQY2OB6Lx2cCD/TJ8b1eZj1l5H2gRi3fuAfQRQ+fc01JlcjYhbnGfvZgBf USch2c+Y8re4mMQUcXYrE6PBvoIXhLxu/HwdFSOyGmT4WsnjjOv0YcWOZM7gLfCCtjeb XJyA== 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; bh=A847gUXqEWvUK2SjAhXxa1wWLEEmWugmkb7C+BMilqY=; b=RpDxUbpvEpIB+ti7zJ6EZR+AYbFeqTi73XaSTaOCOseLb5dr133fDSgSG/NEcgWCef lzc2QYqbdL0tPBgxq1LCTLf+Sc0caj1hBiqdWj4t/9UU0cxvJSnZbO6vrMyoEkCMb563 krIp6TJbbYtlM5KptNO0NRphVwGjk/+Q9VhPQhh7MY9sJGVDXstOMuF1Pwc9n3h0p4Q0 Owzlcvz3WHu7o874JTyoieaRqUnRrVkHHICz1QwnMUqiayDtfLDafS5ZOM151+rkUgzk GiLkV9wVKGiWCaptSL5fPOd5fslPxPF0AEEgizpjhpO6KW1mL74YeslVU5JG9OQbb2YK IvNw== X-Gm-Message-State: AHYfb5idxKRR9pPM8lPfUqY3sjV9LoNaW1mbP0BObIRUWr4P5JdEC9cC pdggAU9ZRMKfjhM03Tnqpw== X-Received: by 10.98.109.194 with SMTP id i185mr1649051pfc.212.1503469631020; Tue, 22 Aug 2017 23:27:11 -0700 (PDT) Received: from localhost.localdomain ([180.171.58.192]) by smtp.gmail.com with ESMTPSA id o21sm1339592pfi.25.2017.08.22.23.27.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 23:27:09 -0700 (PDT) From: Yuanhan Liu To: dev@openvswitch.org Date: Wed, 23 Aug 2017 14:24:20 +0800 Message-Id: <1503469462-22391-6-git-send-email-yliu@fridaylinux.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503469462-22391-1-git-send-email-yliu@fridaylinux.org> References: <1503469462-22391-1-git-send-email-yliu@fridaylinux.org> Subject: [ovs-dev] [PATCH 5/7] netdev-dpdk: retry with queue 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 From: Finn Christensen AFAIK, both Mellanox and Intel's NIC do not support a pure MARK action. They both require to use it together with some other actions, like QUEUE. To workaround it, retry with a queue action when first try failed. Moreover, some Intel's NIC (say XL710) needs the QUEUE action set before the MARK action. Signed-off-by: Finn Christensen Signed-off-by: Yuanhan Liu --- lib/netdev-dpdk.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 8089da8..230d506 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -3629,9 +3629,29 @@ netdev_dpdk_add_rte_flow_offload(struct netdev *netdev, } ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); + int tried = 0; + struct rte_flow_action_queue queue; +again: flow = rte_flow_create(dev->port_id, &flow_attr, patterns.items, actions.actions, &error); - if (!flow) { + if (!flow && !tried && actions_len) { + /* + * create flow failed, try again with QUEUE ACTION + * FIXME: to not fix with queue id. + */ + queue.index = 0; + + /* re-build the action */ + actions.cnt = 0; + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_QUEUE, &queue); + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_MARK, &mark); + ADD_FLOW_ACTION(RTE_FLOW_ACTION_TYPE_END, NULL); + + VLOG_INFO("rte flow create failed, try again with adding QUEUE action\n"); + tried = 1; + + goto again; + } else if (!flow) { VLOG_ERR("rte flow creat error: %u : message : %s\n", error.type, error.message); goto err;