From patchwork Mon Dec 31 19:45:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ophir Munk X-Patchwork-Id: 1019700 X-Patchwork-Delegate: ian.stokes@intel.com 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; dmarc=fail (p=none dis=none) header.from=mellanox.com 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 43T7B84KdBz9sDP for ; Tue, 1 Jan 2019 06:47:12 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 93426AF7; Mon, 31 Dec 2018 19:46:27 +0000 (UTC) X-Original-To: ovs-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 B41D7A7F for ; Mon, 31 Dec 2018 19:46:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id CC005710 for ; Mon, 31 Dec 2018 19:46:25 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from ophirmu@mellanox.com) with ESMTPS (AES256-SHA encrypted); 31 Dec 2018 21:46:20 +0200 Received: from localhost.localdomain (pegasus05.mtr.labs.mlnx [10.210.16.100]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id wBVJkK5j022023; Mon, 31 Dec 2018 21:46:20 +0200 Received: from pegasus05.mtr.labs.mlnx (localhost [127.0.0.1]) by localhost.localdomain (8.14.7/8.14.7) with ESMTP id wBVJkKPw001683; Mon, 31 Dec 2018 19:46:20 GMT Received: (from root@localhost) by pegasus05.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id wBVJkJOZ001682; Mon, 31 Dec 2018 19:46:19 GMT From: Ophir Munk To: ovs-dev@openvswitch.org Date: Mon, 31 Dec 2018 19:45:55 +0000 Message-Id: <1546285557-1617-4-git-send-email-ophirmu@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1546285557-1617-1-git-send-email-ophirmu@mellanox.com> References: <1546285557-1617-1-git-send-email-ophirmu@mellanox.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Shahaf Shuler , Simon Horman , Ilya Maximets , Thomas Monjalon Subject: [ovs-dev] [hwol RFC v1 3/5] netdev-dpdk: Add count hw offload 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 Whenever a flow is hw offloaded it is required to query the hw for the flow counters statistics, specifically the number of packets and the number of bytes used by the flow. In order to successfully call DPDK rte_flow_query() API, a 'count' action must be implicitly added to the flow actions when calling DPDK rte_flow_create() API. Signed-off-by: Ophir Munk --- lib/netdev-dpdk.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 0c0a513..e1f2331 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -4831,6 +4831,17 @@ end_proto_check: break; } } + + /* Add 'count' action in order to read offloaded counters */ + struct rte_flow_query_count count = { + .reset = 1, + .hits_set = 1, + .bytes_set = 1, + .hits = 0, + .bytes = 0, + }; + struct rte_flow_action count_act = { RTE_FLOW_ACTION_TYPE_COUNT, &count}; + add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_COUNT, &count_act); add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_END, NULL); ovs_mutex_lock(&dev->mutex); flow_attr.transfer = 1;