Re: [ovs-dev] [PATCH ovs V6 00/24] Introducing HW offload support for openvswitch

2017-04-01 Thread Roi Dayan



On 31/03/2017 01:11, Marcelo Ricardo Leitner wrote:

On Thu, Mar 30, 2017 at 03:43:36PM -0300, Marcelo Ricardo Leitner wrote:

On Wed, Mar 29, 2017 at 03:43:10PM +0300, Roi Dayan wrote:

This patch series introduces rule offload functionality to dpif-netlink
via netdev ports new flow offloading API. The user can specify whether to
enable rule offloading or not via OVS configuration. Netdev providers
are able to implement netdev flow offload API in order to offload rules.

This patch series also implements one offload scheme for netdev-linux,
using TC flower classifier, which was chosen because its sort of natural
to state OVS DP rules for this classifier. However, the code can be
extended to support other classifiers such as U32, eBPF, etc which support
offload as well.

The use-case we are currently addressing is the newly sriov switchdev mode
in the Linux kernel which was introduced in version 4.8 [1][2].
This series was tested against sriov vfs vports representors of the
Mellanox 100G ConnectX-4 series exposed by the mlx5 kernel driver.


V5->V6:
- Rebase over master branch, fix compilation issue
- Add Nicira copyright to tc interface


Hi,

I built rpm packages based on OVS upstream commit 36664f336664. Then I


Please s/36664f336664/36664f377d048/g in this email.
This was the commit used as base for the test:
commit 36664f377d04857256c1d8582057e1cf3e0e3923
Author: Ben Pfaff 
Date:   Mon Mar 20 10:56:22 2017 -0700

ovsdb-server: Drop unnecessary find_db() function.

Thanks


built a new set of packages with this patchset, v6, applied.

When offloading is enabled, the rules are merged in an unexpected way.
See the results below from the two scenarios.

openvswitch-2.7.90-1.fc24.36664f336664.x86_64.rpm
   upstream ovs commit

[root@wsfd-netdev36 ~]# ovs-ofctl dump-flows ovs_pvp_br0
NXST_FLOW reply (xid=0x4):
 cookie=0x0, duration=12.501s, table=0, n_packets=1022759, n_bytes=61365540, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.1,nw_dst=1.0.0.1 actions=output:2
 cookie=0x0, duration=12.501s, table=0, n_packets=1020990, n_bytes=61259400, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.2,nw_dst=1.0.0.2 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1023860, n_bytes=61431600, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.3,nw_dst=1.0.0.3 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1022554, n_bytes=61353240, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.4,nw_dst=1.0.0.4 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1021516, n_bytes=61290960, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.5,nw_dst=1.0.0.5 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1020599, n_bytes=61235940, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.6,nw_dst=1.0.0.6 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1022285, n_bytes=61337100, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.7,nw_dst=1.0.0.7 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1021725, n_bytes=61303500, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.8,nw_dst=1.0.0.8 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1022281, n_bytes=61336860, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.9,nw_dst=1.0.0.9 actions=output:2
 cookie=0x0, duration=12.500s, table=0, n_packets=1022449, n_bytes=61346940, 
idle_age=0, ip,in_port=1,nw_src=16.0.0.10,nw_dst=1.0.0.10 actions=output:2
 cookie=0x0, duration=12.208s, table=0, n_packets=2580, n_bytes=154800, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.1,nw_dst=1.0.0.1 actions=output:1
 cookie=0x0, duration=12.208s, table=0, n_packets=2675, n_bytes=160500, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.2,nw_dst=1.0.0.2 actions=output:1
 cookie=0x0, duration=12.208s, table=0, n_packets=2520, n_bytes=151200, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.3,nw_dst=1.0.0.3 actions=output:1
 cookie=0x0, duration=12.208s, table=0, n_packets=2587, n_bytes=155220, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.4,nw_dst=1.0.0.4 actions=output:1
 cookie=0x0, duration=12.208s, table=0, n_packets=2640, n_bytes=158400, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.5,nw_dst=1.0.0.5 actions=output:1
 cookie=0x0, duration=12.208s, table=0, n_packets=2593, n_bytes=155580, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.6,nw_dst=1.0.0.6 actions=output:1
 cookie=0x0, duration=12.208s, table=0, n_packets=2634, n_bytes=158040, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.7,nw_dst=1.0.0.7 actions=output:1
 cookie=0x0, duration=12.208s, table=0, n_packets=2549, n_bytes=152940, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.8,nw_dst=1.0.0.8 actions=output:1
 cookie=0x0, duration=12.207s, table=0, n_packets=2627, n_bytes=157620, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.9,nw_dst=1.0.0.9 actions=output:1
 cookie=0x0, duration=12.207s, table=0, n_packets=2530, n_bytes=151800, 
idle_age=0, ip,in_port=2,nw_src=16.0.0.10,nw_dst=1.0.0.10 actions=output:1

[root@wsfd-netdev36 ~]# ovs-dpctl dump-flows

[ovs-dev] [PATCH] datapath: Avoid struct copy on conntrack labels.

2017-04-01 Thread Jarno Rajahalme
Older kernels have variable sized labels, and the struct itself
contains only the length, so we must memcpy the bits explicitly.

The modified system test fails on older kernels without this change.

VMware-BZ: #1841876
Fixes: 09aa98ad496d ("datapath: Inherit master's labels.")
Signed-off-by: Jarno Rajahalme 
---
 datapath/conntrack.c|  2 +-
 tests/system-traffic.at | 18 +-
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/datapath/conntrack.c b/datapath/conntrack.c
index 4df7352..cb8b3ff 100644
--- a/datapath/conntrack.c
+++ b/datapath/conntrack.c
@@ -367,7 +367,7 @@ static int ovs_ct_init_labels(struct nf_conn *ct, struct 
sw_flow_key *key,
 
/* Inherit the master's labels, if any. */
if (master_cl)
-   *cl = *master_cl;
+   memcpy(cl->bits, master_cl->bits, OVS_CT_LABELS_LEN);
 
if (have_mask) {
u32 *dst = (u32 *)cl->bits;
diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 1816b1a..c042773 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -3044,7 +3044,7 @@ dnl Non-REPLY/RELATED packets get the ACL lookup with the 
packet headers
 dnl in the actual packet direction in reg0 (IN=1, OUT=2).  REPLY packets
 dnl get the ACL lookup using the conntrack tuple and the inverted direction.
 dnl RELATED packets get ACL lookup using the conntrack tuple in the direction
-dnl of the master connection, as storted in ct_mark.
+dnl of the master connection, as stored in ct_label[0].
 dnl
 dnl Incoming non-related packet in the original direction (ACL IN)
 table=1 reg3=1, ip, ct_state=-rel-rpl+trk-inv 
action=set_field:1->reg0,resubmit(,3),goto_table:5
@@ -3056,7 +3056,7 @@ dnl Outgoing non-related reply packet (CT ACL IN)
 table=1 reg3=2, ip, ct_state=-rel+rpl+trk-inv 
action=set_field:1->reg0,resubmit(,3,ct),goto_table:4
 dnl
 dnl Related packet (CT ACL in the direction of the master connection.)
-table=1 ip, ct_state=+rel+trk-inv, 
action=move:NXM_NX_CT_MARK[[]]->NXM_NX_REG0[[]],resubmit(,3,ct),goto_table:4
+table=1 ip, ct_state=+rel+trk-inv, 
action=move:NXM_NX_CT_LABEL[[0]]->NXM_NX_REG0[[0]],resubmit(,3,ct),goto_table:4
 dnl Drop everything else.
 table=1 priority=0, action=drop
 dnl
@@ -3088,15 +3088,15 @@ table=5 reg2=0 priority=1000 action=drop
 dnl
 dnl Commit new incoming FTP control connections with SNAT range.  Must match on
 dnl 'tcp' when setting 'alg=ftp'.  Store the directionality of non-related
-dnl connections to ct_mark.  Store the rule ID to labels.
-table=5 priority=100 reg2=1 reg3=1 ct_state=+new-rel, tcp, tp_dst=21, 
action=ct(zone=NXM_NX_REG4[[0..15]],alg=ftp,commit,nat(src=$2),exec(move:NXM_NX_REG3[[0..31]]->NXM_NX_CT_MARK[[0..31]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
+dnl connections to ct_label[0]  Store the rule ID to ct_label[96..127].
+table=5 priority=100 reg2=1 reg3=1 ct_state=+new-rel, tcp, tp_dst=21, 
action=ct(zone=NXM_NX_REG4[[0..15]],alg=ftp,commit,nat(src=$2),exec(move:NXM_NX_REG3[[0]]->NXM_NX_CT_LABEL[[0]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
 dnl Commit other new incoming non-related IP connections with SNAT range.
-table=5 priority=10 reg2=1 reg3=1 ct_state=+new-rel, ip, 
action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat(src=$2),exec(move:NXM_NX_REG3[[0..31]]->NXM_NX_CT_MARK[[0..31]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
+table=5 priority=10 reg2=1 reg3=1 ct_state=+new-rel, ip, 
action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat(src=$2),exec(move:NXM_NX_REG3[[0]]->NXM_NX_CT_LABEL[[0]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
 dnl Commit non-related outgoing new IP connections with DNAT range.
 dnl (This should not get any packets in this test.)
-table=5 priority=10 reg2=1 reg3=2 ct_state=+new-rel, ip, 
action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat(dst=$2),exec(move:NXM_NX_REG3[[0..31]]->NXM_NX_CT_MARK[[0..31]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
+table=5 priority=10 reg2=1 reg3=2 ct_state=+new-rel, ip, 
action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat(dst=$2),exec(move:NXM_NX_REG3[[0]]->NXM_NX_CT_LABEL[[0]],move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
 dnl Commit new related connections in either direction, which need 'nat'
-dnl and which inherit the mark (the direction of the original direction
+dnl and which inherit the label (the direction of the original direction
 dnl master tuple) from the master connection.
 table=5 priority=10 reg2=1 ct_state=+new+rel, ip, 
action=ct(zone=NXM_NX_REG4[[0..15]],commit,nat,exec(move:NXM_NX_REG1[[0..31]]->NXM_NX_CT_LABEL[[96..127]])),goto_table:6
 dnl
@@ -3122,8 +3122,8 @@ table=10 priority=100 arp xreg0=0 action=normal
 table=10 

[ovs-dev] [PATCH 7/7] Documentation: Update DPDK doc with Keepalive feature.

2017-04-01 Thread Bhanuprakash Bodireddy
Signed-off-by: Bhanuprakash Bodireddy 
---
 Documentation/howto/dpdk.rst | 95 
 1 file changed, 95 insertions(+)

diff --git a/Documentation/howto/dpdk.rst b/Documentation/howto/dpdk.rst
index dc63f7d..26f702c 100644
--- a/Documentation/howto/dpdk.rst
+++ b/Documentation/howto/dpdk.rst
@@ -400,6 +400,101 @@ If ``N`` is set to 1, an insertion will be performed for 
every flow. If set to
 
 For more information on the EMC refer to :doc:`/intro/install/dpdk` .
 
+.. _keepalive:
+
+KeepAlive
+-
+
+OvS KeepAlive(KA) feature is disabled by default. To enable KA feature::
+
+'ovs-vsctl --no-wait set Open_vSwitch . other_config:keepalive=true'
+
+Default timer interval for monitoring packet processing cores is 100ms.
+To set a different timer value::
+
+'ovs-vsctl --no-wait set Open_vSwitch . \
+other_config:keepalive-interval="50"'
+
+The events comprise of core states and the last seen timestamps.The events
+are written in to shared memory region ``/dev/shm/dpdk_keepalive_shm_name``.
+To write in to a different shared memory region::
+
+'ovs-vsctl --no-wait set Open_vSwitch . \
+other_config:keepalive-shm-name="/"'
+
+The events in the shared memory block can be read by external monitoring
+framework (or) applications. `collectd `__ has builtin
+support for DPDK and implements dpdkevents plugin that can be enabled to
+relay the datapath core status to OpenStack service `Ceilometer
+`__.
+
+To install and configure ``collectd``::
+
+# Clone collectd from Git repository
+$ git clone https://github.com/collectd/collectd.git
+
+# configure and install collectd
+$ ./build.sh
+$ ./configure --enable-syslog --enable-logfile --with-libdpdk=/usr
+$ make
+$ make install
+
+collectd is defacto installed in /opt/collectd directory. Edit configuration
+file in ``/opt/collectd/etc/collectd.conf`` to enable logfile, dpdkevents
+and csv plugin.
+
+Enable ``logfile`` and ``syslog`` plugins and make sure the logs get
+redirected appropriately::
+
+   LoadPlugin logfile
+   
+   LogLevel debug
+   File "/var/log/collectd/collectd.log"
+   Timestamp true
+   PrintSeverity false
+   
+
+   
+   LogLevel info
+   
+
+Enable ``dpdkevents`` plugin and update the plugindetails as below::
+
+   LoadPlugin dpdkevents
+
+   
+ 
+   Coremask "0x2"
+   MemoryChannels "4"
+   ProcessType "secondary"
+   FilePrefix "rte"
+ 
+ 
+   SendEventsOnUpdate true
+   LCoreMask "0xf"
+   KeepAliveShmName "/dpdk_keepalive_shm_name"
+   SendNotification false
+  
+   
+
+``LCoreMask`` should be set to the PMD cores that were earlier registered
+for keepalive monitoring. ``KeepAliveShmName`` refers to shared memory block
+region.
+
+Enable ``csv`` plugin as below::
+
+   LoadPlugin csv
+
+   
+   DataDir "/var/log/collectd/csv"
+   StoreRates false
+   
+
+With csv plugin enabled, meter(gauge) file is created and timestamp and core
+status gets updated which are sent to ceilometer service. For example
+``../csv/localhost/dpdkevents-keepalive/gauge-lcore3-2017-04-01`` is the file
+for pmd thread running on core 3.
+
 .. _dpdk-ovs-in-guest:
 
 OVS with DPDK Inside VMs
-- 
2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 6/7] vswitch.xml: Add keepalive support.

2017-04-01 Thread Bhanuprakash Bodireddy
Add support for keepalive functionality to DPDK datapath. By default,
the keepalive is OFF and can be enabled/disabled either at start time.

For eg:
  To enable keepalive feature.
  'ovs-vsctl --no-wait set Open_vSwitch . other_config:keepalive=true'

  To set timer interval of 50ms for monitoring packet processing cores;
  'ovs-vsctl --no-wait set Open_vSwitch . \
  other_config:keepalive-interval="50"

  To set shared memory block name where the events shall be updated
  'ovs-vsctl --no-wait set Open_vSwitch .
   other_config:keepalive-shm-name="/dpdk_keepalive_shm_name"'

Signed-off-by: Bhanuprakash Bodireddy 
---
 vswitchd/vswitch.xml | 38 ++
 1 file changed, 38 insertions(+)

diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 14297bf..1c3ba84 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -274,6 +274,44 @@
 
   
 
+  
+
+  Set this value to true to enable keepalive feature.
+
+
+  The default value is false. Changing this value requires
+  restarting the daemon.
+
+
+  If this value is false at startup, keepalive thread
+  shall not be spawned.
+
+  
+
+  
+
+  Specifies the keepalive interval value.
+
+
+  If not specified, this will be set to 100 milliseconds (default
+  value). Changing this value requires restarting the daemon.
+
+  
+
+  
+
+  Specifies the keepalive shared memory block name.
+
+
+  If not specified, shared memory block named "keepalive_shm_name"
+  (default name) is created. Changing this value requires restarting
+  the daemon.
+
+  
+
   
 
-- 
2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 5/7] utils: Introduce xusleep for subsecond granularity.

2017-04-01 Thread Bhanuprakash Bodireddy
This will be used by KA framework that needs millisecond granularity.

Signed-off-by: Bhanuprakash Bodireddy 
---
 lib/util.c | 12 
 lib/util.h |  1 +
 2 files changed, 13 insertions(+)

diff --git a/lib/util.c b/lib/util.c
index 1c06ce0..889ebd8 100644
--- a/lib/util.c
+++ b/lib/util.c
@@ -2125,6 +2125,18 @@ xsleep(unsigned int seconds)
 ovsrcu_quiesce_end();
 }
 
+void
+xusleep(unsigned int microseconds)
+{
+ovsrcu_quiesce_start();
+#ifdef _WIN32
+Sleep(microseconds/1000);
+#else
+usleep(microseconds);
+#endif
+ovsrcu_quiesce_end();
+}
+
 /* Determine whether standard output is a tty or not. This is useful to decide
  * whether to use color output or not when --color option for utilities is set
  * to `auto`.
diff --git a/lib/util.h b/lib/util.h
index aa38122..637d0c3 100644
--- a/lib/util.h
+++ b/lib/util.h
@@ -451,6 +451,7 @@ ovs_u128_and(const ovs_u128 a, const ovs_u128 b)
 }
 
 void xsleep(unsigned int seconds);
+void xusleep(unsigned int microseconds);
 
 bool is_stdout_a_tty(void);
 
-- 
2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 4/7] process: Retrieve process status.

2017-04-01 Thread Bhanuprakash Bodireddy
Implement function to retrieve the process status. This will be used by
Keepalive monitoring thread for detecting false alarms.

Signed-off-by: Bhanuprakash Bodireddy 
---
 lib/process.c | 60 +++
 lib/process.h | 10 ++
 2 files changed, 70 insertions(+)

diff --git a/lib/process.c b/lib/process.c
index e9d0ba9..e0601dd 100644
--- a/lib/process.c
+++ b/lib/process.c
@@ -50,6 +50,20 @@ struct process {
 int status;
 };
 
+struct pstate2Num {
+char *tidState;
+int num;
+};
+
+const struct pstate2Num pstate_map[] = {
+{ "S", STOPPED_STATE },
+{ "R", ACTIVE_STATE },
+{ "t", TRACED_STATE },
+{ "Z", DEFUNC_STATE },
+{ "D", UNINTERRUPTIBLE_SLEEP_STATE },
+{ "NULL", UNUSED_STATE },
+};
+
 /* Pipe used to signal child termination. */
 static int fds[2];
 
@@ -390,6 +404,52 @@ process_run(void)
 #endif
 }
 
+int
+get_process_status(int tid, int *pstate)
+{
+#ifndef _WIN32
+static char process_name[20];
+FILE *stream;
+char line[75];
+char Name[15], value[5], status[20];
+int i, ln;
+
+snprintf(process_name, sizeof(process_name),
+ "/proc/%d/status", tid);
+stream = fopen(process_name, "r");
+if (stream == NULL) {
+VLOG_WARN_ONCE("%s: open failed: %s", process_name,
+ovs_strerror(errno));
+return errno;
+}
+
+ln=0;
+while (fgets(line, sizeof line, stream)) {
+if (!ovs_scan(line,
+  "%6s %2s %14s\n",
+   Name, value, status)) {
+VLOG_WARN_ONCE("%s: could not parse line %d: %s",
+process_name, ln, line);
+continue;
+}
+if (!strcmp(Name, "State:")) {
+for (i=0; pstate_map[i].tidState != NULL; i++) {
+if (strcmp(pstate_map[i].tidState, value) == 0) {
+VLOG_INFO("The state is %s, status is %d\n",
+pstate_map[i].tidState, pstate_map[i].num);
+*pstate = pstate_map[i].num;
+break;
+}
+}
+break;
+}
+ln++;
+   }
+   return 0;
+#else
+   return ENOSYS;
+#endif
+}
 
 /* Causes the next call to poll_block() to wake up when process 'p' has
  * exited. */
diff --git a/lib/process.h b/lib/process.h
index 3feac7e..8a5513e 100644
--- a/lib/process.h
+++ b/lib/process.h
@@ -20,6 +20,15 @@
 #include 
 #include 
 
+enum process_states {
+UNUSED_STATE,
+STOPPED_STATE,
+ACTIVE_STATE,
+TRACED_STATE,
+DEFUNC_STATE,
+UNINTERRUPTIBLE_SLEEP_STATE
+};
+
 struct process;
 
 /* Starting and monitoring subprocesses.
@@ -38,6 +47,7 @@ bool process_exited(struct process *);
 int process_status(const struct process *);
 void process_run(void);
 void process_wait(struct process *);
+int get_process_status(int, int *);
 
 /* These functions are thread-safe. */
 char *process_status_msg(int);
-- 
2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 2/7] dpif-netdev: Register packet processing cores for keepalive.

2017-04-01 Thread Bhanuprakash Bodireddy
This commit registers the packet processing cores for keepalive
monitoring. Also the pmd threads respond to heartbeats by marking
themselves alive. When the pmd thread is teared down due to datapath
reconfiguration the core state is marked as 'sleep'.

Signed-off-by: Bhanuprakash Bodireddy 
---
 lib/dpif-netdev.c | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/lib/dpif-netdev.c b/lib/dpif-netdev.c
index a14a2eb..7cb3631 100644
--- a/lib/dpif-netdev.c
+++ b/lib/dpif-netdev.c
@@ -3249,6 +3249,14 @@ rxq_scheduling(struct dp_netdev *dp, bool pinned) 
OVS_REQUIRES(dp->port_mutex)
 }
 
 static void
+ka_register_core(unsigned core_id OVS_UNUSED)
+{
+#ifdef DPDK_NETDEV
+dpdk_ka_register_core(core_id);
+#endif
+}
+
+static void
 reconfigure_pmd_threads(struct dp_netdev *dp)
 OVS_REQUIRES(dp->port_mutex)
 {
@@ -3296,6 +3304,9 @@ reconfigure_pmd_threads(struct dp_netdev *dp)
 dp_netdev_configure_pmd(pmd, dp, core->core_id, core->numa_id);
 
 pmd->thread = ovs_thread_create("pmd", pmd_thread_main, pmd);
+
+/* Register core for KeepAlive detection. */
+ka_register_core(core->core_id);
 }
 
 /* Log the number of pmd threads per numa node. */
@@ -3664,6 +3675,9 @@ pmd_thread_main(void *f_)
 ovs_numa_thread_setaffinity_core(pmd->core_id);
 dpdk_set_lcore_id(pmd->core_id);
 poll_cnt = pmd_load_queues_and_ports(pmd, _list);
+
+/* Store the pmd thread_id in shared memory. */
+dpdk_ka_get_tid(pmd->core_id);
 reload:
 emc_cache_init(>flow_cache);
 
@@ -3688,6 +3702,9 @@ reload:
poll_list[i].port_no);
 }
 
+/* Mark packet processing core alive if KeepAlive is enabled. */
+ka_mark_core_alive();
+
 if (lc++ > 1024) {
 bool reload;
 
@@ -3718,6 +3735,8 @@ reload:
 goto reload;
 }
 
+ka_mark_core_sleep();
+
 free(poll_list);
 pmd_free_cached_ports(pmd);
 return NULL;
-- 
2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH 0/7] Add OVS DPDK keep-alive functionality

2017-04-01 Thread Bhanuprakash Bodireddy
This patch is aimed at achieving Fastpath Service Assurance in
OVS-DPDK deployments. This commit adds support for monitoring the packet
processing cores(pmd thread cores) by dispatching heartbeats at regular
intervals. Incase of heartbeat miss the failure shall be detected &
reported to higher level fault management systems/frameworks.

The implementation uses POSIX shared memory object for storing the
events that will be read by monitoring framework. keep-alive feature
can be enabled through below OVSDB settings.

keepalive=true
   - Keepalive feature is disabled by default

keepalive-interval="50"
   - Timer interval in milliseconds for monitoring the packet
 processing cores.

keepalive-shm-name="/dpdk_keepalive_shm_name"
   - Shared memory block name where the events shall be updated.

When KA is enabled, 'ovs-keepalive' thread shall be spawned that wakes
up at regular intervals to update the timestamp and status of pmd cores
in shared memory region.

An external monitoring framework like collectd(with dpdk plugin support)
can read the status updates from shared memory. On a missing heartbeat,
the collectd shall relay the status to ceilometer service running in the
controller. Below is the high level overview of deployment model.

Compute Node   Controller

 Collectd  <-> Ceilometer

 OVS DPDK

   +-+
   | VM  |
   +--+--+
  \---+---/
  |
   +--+---+   ++--+ +--+---+
   | OVS  |-> |dpdkevents plugin  | --> |   collectd   |
   +--+---+   ++--+ +--+---+

 +--+-+ +---++
 | Ceilometer | <-- | collectd ceilometer plugin |  <
 +--+-+ +---++

Bhanuprakash Bodireddy (7):
  dpdk: Add helper functions for DPDK keepalive.
  dpif-netdev: Register packet processing cores for keepalive.
  netdev-dpdk: Add support for keepalive functionality.
  process: Retrieve process status.
  utils: Introduce xusleep for subsecond granularity.
  vswitch.xml: Add keepalive support.
  Documentation: Update DPDK doc with Keepalive feature.

 Documentation/howto/dpdk.rst |  95 ++
 lib/dpdk-stub.c  |  30 ++
 lib/dpdk.c   |  92 +
 lib/dpdk.h   |  11 ++-
 lib/dpif-netdev.c|  19 
 lib/netdev-dpdk.c| 231 ++-
 lib/netdev-dpdk.h|   7 +-
 lib/process.c|  60 +++
 lib/process.h|  10 ++
 lib/util.c   |  12 +++
 lib/util.h   |   1 +
 vswitchd/vswitch.xml |  38 +++
 12 files changed, 603 insertions(+), 3 deletions(-)

-- 
2.4.11

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev