From patchwork Mon Dec 31 19:45:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ophir Munk X-Patchwork-Id: 1019701 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 43T7Bm2ltdz9sDP for ; Tue, 1 Jan 2019 06:47:44 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 4EBCEB12; Mon, 31 Dec 2018 19:46:30 +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 1ABC0A7F for ; Mon, 31 Dec 2018 19:46:27 +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 DF395843 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:19 +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 wBVJkJ4U022020; Mon, 31 Dec 2018 21:46:19 +0200 Received: from pegasus05.mtr.labs.mlnx (localhost [127.0.0.1]) by localhost.localdomain (8.14.7/8.14.7) with ESMTP id wBVJkJmR001678; Mon, 31 Dec 2018 19:46:19 GMT Received: (from root@localhost) by pegasus05.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id wBVJkJuY001676; Mon, 31 Dec 2018 19:46:19 GMT From: Ophir Munk To: ovs-dev@openvswitch.org Date: Mon, 31 Dec 2018 19:45:54 +0000 Message-Id: <1546285557-1617-3-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 2/5] netdev-dpdk: Add vlan push/pop hw offload 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 This commit adds vlan push/pop hw offload. For more details on hw offload please see commit message in [1]. The hw offload vlan push operation is split internally by DPDK into three actions: pushing VLAN next ethernet type, vlan id and vlan PCP bit. This commit requires linking with LDFLAGS="-lnl". [1] Commit 1a3a23f7ed: ("netdev-dpdk: add port output hw offlowd") Signed-off-by: Ophir Munk --- lib/netdev-dpdk.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 04413eb..0c0a513 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -39,6 +39,7 @@ #include #include #include +#include #include "cmap.h" #include "dirs.h" @@ -4764,6 +4765,9 @@ end_proto_check: goto out; } struct rte_flow_action_port_id port_id; + struct rte_flow_action_of_push_vlan push_vlan; + struct rte_flow_action_of_set_vlan_vid vlan_vid; + struct rte_flow_action_of_set_vlan_pcp vlan_pcp; NL_ATTR_FOR_EACH_UNSAFE (a, left, nl_actions, actions_len) { int type = nl_attr_type(a); switch ((enum ovs_action_attr) type) { @@ -4782,8 +4786,26 @@ end_proto_check: add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_PORT_ID, &port_id); break; } - case OVS_ACTION_ATTR_PUSH_VLAN: - case OVS_ACTION_ATTR_POP_VLAN: + case OVS_ACTION_ATTR_PUSH_VLAN: { + const struct ovs_action_push_vlan *vlan; + vlan = nla_data(a); + push_vlan.ethertype = vlan->vlan_tpid; + add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_OF_PUSH_VLAN, + &push_vlan); + vlan_vid.vlan_vid = vlan->vlan_tci & htons(VLAN_VID_MASK); + add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_VID, + &vlan_vid); + vlan_pcp.vlan_pcp = + (ntohs(vlan->vlan_tci) & VLAN_PCP_MASK) > VLAN_PCP_SHIFT; + add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_OF_SET_VLAN_PCP, + &vlan_pcp); + break; + } + case OVS_ACTION_ATTR_POP_VLAN: { + add_flow_action(&actions, RTE_FLOW_ACTION_TYPE_OF_POP_VLAN, NULL); + break; + } + case OVS_ACTION_ATTR_UNSPEC: case OVS_ACTION_ATTR_USERSPACE: case OVS_ACTION_ATTR_SET: