From patchwork Wed Jul 5 12:27:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shachar Beiser X-Patchwork-Id: 784575 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 3x2gDV2Z2Wz9s7g for ; Wed, 5 Jul 2017 22:29:46 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id A137EAC9; Wed, 5 Jul 2017 12:28:21 +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 1EF9CA86 for ; Wed, 5 Jul 2017 12:28:19 +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 3D8C716B for ; Wed, 5 Jul 2017 12:28:17 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from shacharbe@mellanox.com) with ESMTPS (AES256-SHA encrypted); 5 Jul 2017 15:27:49 +0300 Received: from r-aa-dragon21.mtr.labs.mlnx (r-aa-dragon21.mtr.labs.mlnx [10.209.68.158]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id v65CRm4V009600; Wed, 5 Jul 2017 15:27:48 +0300 Received: from r-aa-dragon21.mtr.labs.mlnx (localhost [127.0.0.1]) by r-aa-dragon21.mtr.labs.mlnx (8.14.7/8.14.7) with ESMTP id v65CRmEm025914; Wed, 5 Jul 2017 12:27:48 GMT Received: (from shacharbe@localhost) by r-aa-dragon21.mtr.labs.mlnx (8.14.7/8.14.7/Submit) id v65CRm1c025913; Wed, 5 Jul 2017 12:27:48 GMT From: Shachar Beiser To: ovs-dev@openvswitch.org Date: Wed, 5 Jul 2017 12:27:08 +0000 Message-Id: <1c47d67b53a48d3e8508b9c25b0db6af30b04df8.1499257385.git.shacharbe@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: References: In-Reply-To: References: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, 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: Shachar Beiser Subject: [ovs-dev] [PATCH 01/11] ovs/dp-cls: fetching the mark id from hw 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 The HW set the mark id that represents matching rule. The hw-pipeline reads the mark id from fdir.hi Signed-off-by: Shachar Beiser --- lib/automake.mk | 3 ++- lib/hw-pipeline.h | 31 +++++++++++++++++++++++++++++++ lib/netdev-bsd.c | 1 + lib/netdev-dpdk.c | 25 +++++++++++++++++++++++++ lib/netdev-dpdk.h | 14 +++++++++++--- lib/netdev-dummy.c | 1 + lib/netdev-linux.c | 1 + lib/netdev-provider.h | 7 ++++++- lib/netdev-vport.c | 1 + 9 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 lib/hw-pipeline.h diff --git a/lib/automake.mk b/lib/automake.mk index 54a1032..fa27aeb 100644 --- a/lib/automake.mk +++ b/lib/automake.mk @@ -378,7 +378,8 @@ endif if DPDK_NETDEV lib_libopenvswitch_la_SOURCES += \ lib/dpdk.c \ - lib/netdev-dpdk.c + lib/netdev-dpdk.c \ + lib/hw-pipeline.h else lib_libopenvswitch_la_SOURCES += \ lib/dpdk-stub.c diff --git a/lib/hw-pipeline.h b/lib/hw-pipeline.h new file mode 100644 index 0000000..4dcafa2 --- /dev/null +++ b/lib/hw-pipeline.h @@ -0,0 +1,31 @@ +/* + * hw-pipeline.h + * + * Created on: 13 Oct 2016 + * Author: sugeshch + */ + +#ifndef LIB_HW_PIPELINE_H_ +#define LIB_HW_PIPELINE_H_ +#include "unistd.h" +#include "stdio.h" +#include "sys/types.h" +#include "sys/stat.h" +#include "errno.h" +#include "fcntl.h" +#include "flow.h" +#include "dpif-netdev.h" + +#define HW_NO_FREE_FLOW_TAG 0xffffffff + +enum pipeline_id { + DEFAULT_SW_PIPELINE = 0, + HW_OFFLOAD_PIPELINE +}; + +struct pipeline_md { + uint16_t id; + uint32_t flow_tag; +}; + +#endif /* LIB_HW_PIPELINE_H_ */ diff --git a/lib/netdev-bsd.c b/lib/netdev-bsd.c index f863a18..b1acc5f 100644 --- a/lib/netdev-bsd.c +++ b/lib/netdev-bsd.c @@ -1493,6 +1493,7 @@ netdev_bsd_update_flags(struct netdev *netdev_, enum netdev_flags off, CONSTRUCT, \ netdev_bsd_destruct, \ netdev_bsd_dealloc, \ + NULL, /* get pipeline */ \ NULL, /* get_config */ \ NULL, /* set_config */ \ NULL, /* get_tunnel_config */ \ diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index 251bd16..53f49ad 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -55,6 +55,7 @@ #include "unaligned.h" #include "timeval.h" #include "unixctl.h" +#include "hw-pipeline.h" VLOG_DEFINE_THIS_MODULE(netdev_dpdk); static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(5, 20); @@ -1125,6 +1126,29 @@ netdev_dpdk_get_config(const struct netdev *netdev, struct smap *args) return 0; } +void +netdev_dpdk_get_pipeline(__attribute__ ((unused))const struct netdev *netdev, + struct dp_packet *packet, + void *pipeline_res) +{ + struct pipeline_md *ppl_md = pipeline_res; + struct rte_mbuf *mbuf; + + /* + * * DPDK pipeline is defined by the ol_flags n the packet, + * */ + mbuf = (struct rte_mbuf *)packet; + + if (mbuf->ol_flags & PKT_RX_FDIR_ID) { + ppl_md->id = HW_OFFLOAD_PIPELINE; + ppl_md->flow_tag = mbuf->hash.fdir.hi; + } + else{ + ppl_md->id = DEFAULT_SW_PIPELINE; + ppl_md->flow_tag = HW_NO_FREE_FLOW_TAG; + } +} + static struct netdev_dpdk * netdev_dpdk_lookup_by_port_id(dpdk_port_t port_id) OVS_REQUIRES(dpdk_mutex) @@ -3253,6 +3277,7 @@ unlock: CONSTRUCT, \ DESTRUCT, \ netdev_dpdk_dealloc, \ + netdev_dpdk_get_pipeline, \ netdev_dpdk_get_config, \ SET_CONFIG, \ NULL, /* get_tunnel_config */ \ diff --git a/lib/netdev-dpdk.h b/lib/netdev-dpdk.h index b7d02a7..a630da3 100644 --- a/lib/netdev-dpdk.h +++ b/lib/netdev-dpdk.h @@ -17,17 +17,25 @@ #ifndef NETDEV_DPDK_H #define NETDEV_DPDK_H -#include - #include "openvswitch/compiler.h" +#include "openvswitch/types.h" struct dp_packet; +struct netdev; +struct dp_netdev; +struct rte_flow_attr; +struct rte_flow_item; +struct rte_flow_action; +struct rte_flow_error; #ifdef DPDK_NETDEV void netdev_dpdk_register(void); void free_dpdk_buf(struct dp_packet *); - +void +netdev_dpdk_get_pipeline(__attribute__ ((unused))const struct netdev *netdev, + struct dp_packet *packet, + void *pipeline_res); #else static inline void diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c index d189a86..b9cbaad 100644 --- a/lib/netdev-dummy.c +++ b/lib/netdev-dummy.c @@ -1358,6 +1358,7 @@ netdev_dummy_update_flags(struct netdev *netdev_, netdev_dummy_construct, \ netdev_dummy_destruct, \ netdev_dummy_dealloc, \ + NULL, \ netdev_dummy_get_config, \ netdev_dummy_set_config, \ NULL, /* get_tunnel_config */ \ diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 6978c44..c245504 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -2819,6 +2819,7 @@ netdev_linux_update_flags(struct netdev *netdev_, enum netdev_flags off, CONSTRUCT, \ netdev_linux_destruct, \ netdev_linux_dealloc, \ + NULL, \ NULL, /* get_config */ \ NULL, /* set_config */ \ NULL, /* get_tunnel_config */ \ diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index 79143d2..744aea0 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -274,7 +274,12 @@ struct netdev_class { int (*construct)(struct netdev *); void (*destruct)(struct netdev *); void (*dealloc)(struct netdev *); - + /* Get the pipeline information for the netdev. + * This will return the pipe_line id and + * status of pipeline for packet processing. + */ + void (*get_pipeline)(const struct netdev *netdev, struct dp_packet *packet, + void *pipeline_res); /* Fetches the device 'netdev''s configuration, storing it in 'args'. * The caller owns 'args' and pre-initializes it to an empty smap. * diff --git a/lib/netdev-vport.c b/lib/netdev-vport.c index 640cdbe..6e58f14 100644 --- a/lib/netdev-vport.c +++ b/lib/netdev-vport.c @@ -849,6 +849,7 @@ netdev_vport_get_ifindex(const struct netdev *netdev_) netdev_vport_construct, \ netdev_vport_destruct, \ netdev_vport_dealloc, \ + NULL, \ GET_CONFIG, \ SET_CONFIG, \ GET_TUNNEL_CONFIG, \