diff mbox

[ovs-dev,01/11] ovs/dp-cls: fetching the mark id from hw

Message ID 1c47d67b53a48d3e8508b9c25b0db6af30b04df8.1499257385.git.shacharbe@mellanox.com
State Deferred
Headers show

Commit Message

Shachar Beiser July 5, 2017, 12:27 p.m. UTC
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 <shacharbe@mellanox.com>
---
 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

Comments

Ben Pfaff Oct. 30, 2017, 9:21 p.m. UTC | #1
On Wed, Jul 05, 2017 at 12:27:08PM +0000, Shachar Beiser wrote:
> 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 <shacharbe@mellanox.com>

I'm currently going through old patches.  It looks like this series was
never reviewed.  I apologize for that.  Should it get reviewed now, or
do you want to re-post it, or do I misunderstand the status?

Thanks,

Ben.
Darrell Ball Oct. 30, 2017, 9:57 p.m. UTC | #2
I believe this series is superceded by the HWOL series from Yuanhan Liu yliu@fridaylinux.org


On 10/30/17, 2:22 PM, "ovs-dev-bounces@openvswitch.org on behalf of Ben Pfaff" <ovs-dev-bounces@openvswitch.org on behalf of blp@ovn.org> wrote:

    On Wed, Jul 05, 2017 at 12:27:08PM +0000, Shachar Beiser wrote:
    > 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 <shacharbe@mellanox.com>
    
    I'm currently going through old patches.  It looks like this series was
    never reviewed.  I apologize for that.  Should it get reviewed now, or
    do you want to re-post it, or do I misunderstand the status?
    
    Thanks,
    
    Ben.
    _______________________________________________
    dev mailing list
    dev@openvswitch.org
    https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=I4tZkysObRxv01uzMfLp7leJOlfBb7j1Jflz_NnP5og&s=kvk_xVzd9LISdss_SD7dokLllbBsjeXthg5S_YI28Io&e=
Ben Pfaff Oct. 30, 2017, 10:57 p.m. UTC | #3
Great, thanks for the info.

On Mon, Oct 30, 2017 at 09:57:49PM +0000, Darrell Ball wrote:
>  I believe this series is superceded by the HWOL series from Yuanhan Liu yliu@fridaylinux.org
> 
> 
> On 10/30/17, 2:22 PM, "ovs-dev-bounces@openvswitch.org on behalf of Ben Pfaff" <ovs-dev-bounces@openvswitch.org on behalf of blp@ovn.org> wrote:
> 
>     On Wed, Jul 05, 2017 at 12:27:08PM +0000, Shachar Beiser wrote:
>     > 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 <shacharbe@mellanox.com>
>     
>     I'm currently going through old patches.  It looks like this series was
>     never reviewed.  I apologize for that.  Should it get reviewed now, or
>     do you want to re-post it, or do I misunderstand the status?
>     
>     Thanks,
>     
>     Ben.
>     _______________________________________________
>     dev mailing list
>     dev@openvswitch.org
>     https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwICAg&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=I4tZkysObRxv01uzMfLp7leJOlfBb7j1Jflz_NnP5og&s=kvk_xVzd9LISdss_SD7dokLllbBsjeXthg5S_YI28Io&e=
>     
>
diff mbox

Patch

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 <config.h>
-
 #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,                                      \