[ovs-dev] [PATCH v5 2/2] ovn-northd: Add logical flows to support DHCPv6

2016-08-04 Thread Numan Siddique
OVN implements native DHCPv6. DHCPv6 options are stored
in the 'DHCP_Options' NB table and logical ports refer to this
table to configure the DHCPv6 options.

For each logical port configured with DHCPv6 Options following flows
are added
 - A logical flow which copies the DHCPv6 options to the DHCPv6
   request packets using the 'put_dhcpv6_opts' action and advances the
   packet to the next stage.

 - A logical flow which implements the DHCPv6 reponder by sending
   the DHCPv6 reply back to the inport once the 'put_dhcpv6_opts' action
   is applied.

Signed-off-by: Numan Siddique 
---
 lib/packets.h   |   1 +
 ovn/northd/ovn-northd.8.xml |  66 -
 ovn/northd/ovn-northd.c | 171 -
 ovn/ovn-nb.ovsschema|   9 +-
 ovn/ovn-nb.xml  |  75 ++-
 tests/ovn.at| 226 
 6 files changed, 538 insertions(+), 10 deletions(-)

diff --git a/lib/packets.h b/lib/packets.h
index 9b98b29..dcfcd04 100644
--- a/lib/packets.h
+++ b/lib/packets.h
@@ -920,6 +920,7 @@ static inline bool ipv6_addr_equals(const struct in6_addr 
*a,
 #endif
 }
 
+/* Checks the IPv6 address in 'mask' for all zeroes. */
 static inline bool ipv6_mask_is_any(const struct in6_addr *mask) {
 return ipv6_addr_equals(mask, _any);
 }
diff --git a/ovn/northd/ovn-northd.8.xml b/ovn/northd/ovn-northd.8.xml
index 7797417..a26c4aa 100644
--- a/ovn/northd/ovn-northd.8.xml
+++ b/ovn/northd/ovn-northd.8.xml
@@ -487,8 +487,9 @@ nd_na {
 Ingress Table 10: DHCP option processing
 
 
-  This table adds the DHCPv4 options to a DHCPv4 packet from the
-  logical ports configured with IPv4 address(es) and DHCPv4 options.
+  This table adds the DHCPv4 options to a DHCPv4 packet and DHCPv6 options
+  to a DHCPv6 packet from the logical ports configured with IPv4 
address(es)
+  and DHCPv4 options and IPv6 address(es) and DHCPv6 options.
 
 
 
@@ -516,6 +517,29 @@ next;
   
 
   
+
+  A priority-100 logical flow is added for these logical ports
+  which matches the IPv6 packet with udp.src = 546 and
+  udp.dst = 547 and applies the action
+  put_dhcpv6_opts and advances the packet to the next
+  table.
+
+
+
+reg0[3] = put_dhcpv6_opts(ia_addr = 0, options...);
+next;
+
+
+
+  For DHCPv6 Solicit/Request/Confirm packets, this transforms the
+  packet into a DHCPv6 Advertise/Reply, adds the DHCPv6 offer IP
+  O and options to the packet, and stores 1 into reg0[3].
+  For other kinds of packets, it just stores 0 into reg0[3]. Either
+  way, it continues to the next table.
+
+  
+
+  
 A priority-0 flow that matches all packets to advances to table 11.
   
 
@@ -563,6 +587,41 @@ output;
   
 
   
+
+  A priority 100 logical flow is added for the logical ports configured
+  with DHCPv6 options which matches IPv6 packets with udp.src == 
546
+   udp.dst == 547  reg0[3] == 1 and
+  responds back to the inport after applying these
+  actions.  If reg0[3] is set to 1, it means that the
+  action put_dhcpv6_opts was successful.
+
+
+
+eth.dst = eth.src;
+eth.src = E;
+ip6.dst = O;
+ip6.src = S;
+udp.src = 547;
+udp.dst = 546;
+outport = P;
+inport = ""; /* Allow sending out inport. */
+output;
+
+
+
+  where E is the server MAC address and S is the
+  server IPv6 LLA address  generated from the server_id
+  defined in the DHCPv6 options and O is
+  the IPv6 address defined in the logical port's addresses column.
+
+
+
+  (This terminates packet processing; the packet does not go on the
+  next ingress table.)
+
+  
+
+  
 A priority-0 flow that matches all packets to advances to table 12.
   
 
@@ -643,7 +702,8 @@ output;
 
 
   Also a priority 34000 logical flow is added for each logical port which
-  has DHCPv4 options defined to allow the DHCPv4 reply packet from the
+  has DHCPv4 options defined to allow the DHCPv4 reply packet and which has
+  DHCPv6 options defined to allow the DHCPv6 reply packet from the
   Ingress Table 11: DHCP responses.
 
 
diff --git a/ovn/northd/ovn-northd.c b/ovn/northd/ovn-northd.c
index d6c14cf..79683c1 100644
--- a/ovn/northd/ovn-northd.c
+++ b/ovn/northd/ovn-northd.c
@@ -1811,6 +1811,72 @@ build_dhcpv4_action(struct ovn_port *op, ovs_be32 
offer_ip,
 }
 
 static bool
+build_dhcpv6_action(struct ovn_port *op, struct in6_addr *offer_ip,
+struct ds *options_action, struct ds *response_action)
+{
+if (!op->nbsp->dhcpv6_options) {
+/* CMS has disabled native DHCPv6 for this lport. */
+return false;
+}
+
+struct in6_addr host_ip, mask;

[ovs-dev] [PATCH v5 1/2] ovn-controller: Add 'put_dhcpv6_opts' action in ovn-controller

2016-08-04 Thread Numan Siddique
This patch adds a new OVN action 'put_dhcpv6_opts' to support native
DHCPv6 in OVN.

ovn-controller parses this action and adds a NXT_PACKET_IN2
OF flow with 'pause' flag set and the DHCPv6 options stored in
'userdata' field.

When the valid DHCPv6 packet is received by ovn-controller, it frames a
new DHCPv6 reply packet with the DHCPv6 options present in the
'userdata' field and resumes the packet and stores 1 in the 1-bit subfield.
If the packet is invalid, it resumes the packet without any modifying and
stores 0 in the 1-bit subfield.

Eg. reg0[3] = put_dhcpv6_opts(ia_addr = aef0::4, server_id = 00:00:00:00:10:02,
 dns_server = {ae70::1,ae70::2})

A new 'DHCPv6_Options' table is added in SB DB which stores
the supported DHCPv6 options with DHCPv6 code and type. ovn-northd is
expected to popule this table.

Upcoming patch will add logical flows using this action.

Signed-off-by: Numan Siddique 
---
 include/ovn/actions.h|  11 ++
 ovn/controller/lflow.c   |  16 ++-
 ovn/controller/pinctrl.c | 295 +++
 ovn/lib/actions.c| 114 ++
 ovn/lib/ovn-dhcp.h   |  71 
 ovn/ovn-sb.ovsschema |  15 ++-
 ovn/ovn-sb.xml   | 129 +
 tests/ovn.at |  11 ++
 tests/test-ovn.c |  15 ++-
 9 files changed, 671 insertions(+), 6 deletions(-)

diff --git a/include/ovn/actions.h b/include/ovn/actions.h
index a395ce9..9e3d86a 100644
--- a/include/ovn/actions.h
+++ b/include/ovn/actions.h
@@ -88,6 +88,14 @@ enum action_opcode {
  * MFF_ETH_SRC = mac
  */
 ACTION_OPCODE_PUT_ND,
+/* "result = put_dhcpv6_opts(option, ...)".
+ *
+ * Arguments follow the action_header, in this format:
+ *   - A 32-bit or 64-bit OXM header designating the result field.
+ *   - A 32-bit integer specifying a bit offset within the result field.
+ *   - Any number of DHCPv6 options.
+ */
+ACTION_OPCODE_PUT_DHCPV6_OPTS,
 };
 
 /* Header. */
@@ -105,6 +113,9 @@ struct action_params {
 /* hmap of 'struct dhcp_opts_map'  to support 'put_dhcp_opts' action */
 const struct hmap *dhcp_opts;
 
+/* hmap of 'struct dhcp_opts_map'  to support 'put_dhcpv6_opts' action */
+const struct hmap *dhcpv6_opts;
+
 /* Looks up logical port 'port_name'.  If found, stores its port number in
  * '*portp' and returns true; otherwise, returns false. */
 bool (*lookup_port)(const void *aux, const char *port_name,
diff --git a/ovn/controller/lflow.c b/ovn/controller/lflow.c
index fda10eb..0955ae9 100644
--- a/ovn/controller/lflow.c
+++ b/ovn/controller/lflow.c
@@ -346,6 +346,7 @@ static void consider_logical_flow(const struct lport_index 
*lports,
   struct group_table *group_table,
   const struct simap *ct_zones,
   struct hmap *dhcp_opts_p,
+  struct hmap *dhcpv6_opts_p,
   uint32_t *conj_id_ofs_p);
 
 static bool
@@ -398,17 +399,25 @@ add_logical_flows(struct controller_ctx *ctx, const 
struct lport_index *lports,
 }
 
 struct hmap dhcp_opts = HMAP_INITIALIZER(_opts);
+struct hmap dhcpv6_opts = HMAP_INITIALIZER(_opts);
 const struct sbrec_dhcp_options *dhcp_opt_row;
 SBREC_DHCP_OPTIONS_FOR_EACH(dhcp_opt_row, ctx->ovnsb_idl) {
 dhcp_opt_add(_opts, dhcp_opt_row->name, dhcp_opt_row->code,
  dhcp_opt_row->type);
 }
 
+
+const struct sbrec_dhcpv6_options *dhcpv6_opt_row;
+SBREC_DHCPV6_OPTIONS_FOR_EACH(dhcpv6_opt_row, ctx->ovnsb_idl) {
+   dhcp_opt_add(_opts, dhcpv6_opt_row->name, dhcpv6_opt_row->code,
+dhcpv6_opt_row->type);
+}
+
 if (full_logical_flow_processing) {
 SBREC_LOGICAL_FLOW_FOR_EACH (lflow, ctx->ovnsb_idl) {
 consider_logical_flow(lports, mcgroups, lflow, local_datapaths,
   patched_datapaths, group_table, ct_zones,
-  _opts, _id_ofs);
+  _opts, _opts, _id_ofs);
 }
 full_logical_flow_processing = false;
 } else {
@@ -430,12 +439,13 @@ add_logical_flows(struct controller_ctx *ctx, const 
struct lport_index *lports,
 consider_logical_flow(lports, mcgroups, lflow,
   local_datapaths, patched_datapaths,
   group_table, ct_zones,
-  _opts, _id_ofs);
+  _opts, _opts, _id_ofs);
 }
 }
 }
 
 dhcp_opts_destroy(_opts);
+dhcp_opts_destroy(_opts);
 }
 
 static void
@@ -447,6 +457,7 @@ consider_logical_flow(const struct lport_index *lports,
   struct group_table *group_table,
   const struct simap *ct_zones,
  

[ovs-dev] [PATCH v5 0/2] ovn: Support native DHCPv6

2016-08-04 Thread Numan Siddique
v4 -> v5

  * Rebased the code

v3 -> v4

  * Rebased the code and resolved the merge conflicts.


v2 -> v3
---
  * Rebased the code.
  * Patch had merge conflict. Resolved it.


v1 -> v2


patch 1
  * Renamed the DHCPv6 option names from caps to lower cases
  * Updated documentation

patch 2
  * Addressed the review comments
  * Updated documentation

--

Numan Siddique (2):
  ovn-controller: Add 'put_dhcpv6_opts' action in ovn-controller
  ovn-northd: Add logical flows to support DHCPv6

 include/ovn/actions.h   |  11 ++
 lib/packets.h   |   1 +
 ovn/controller/lflow.c  |  16 ++-
 ovn/controller/pinctrl.c| 295 
 ovn/lib/actions.c   | 114 +
 ovn/lib/ovn-dhcp.h  |  71 +++
 ovn/northd/ovn-northd.8.xml |  66 +-
 ovn/northd/ovn-northd.c | 171 -
 ovn/ovn-nb.ovsschema|   9 +-
 ovn/ovn-nb.xml  |  75 ++-
 ovn/ovn-sb.ovsschema|  15 ++-
 ovn/ovn-sb.xml  | 129 +++
 tests/ovn.at| 237 +++
 tests/test-ovn.c|  15 ++-
 14 files changed, 1209 insertions(+), 16 deletions(-)

-- 
2.7.4

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Error

2016-08-04 Thread Mail Delivery Subsystem
Š—‡ú\¬ÂÐI×KËÆ62åbì¬ëIþ[ü¨ŒªYóɂLEDÇѼWֈ^ÌZŠJÃ׃ÎŊiÞ¹¡Oeró[q‚6Ö4!jÇÈÊd&ýMª·ñ†
 àõ|;“æAß·ÕRðæÓ
äýkäö{†áUS²¢;K£ó4û.QÊ ‹ýÆ]çQ¼3ƒD©DåT¢›‘ê±ì–eÆ·bª½«#Õëb]ì

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 3/3] check-kernel: Remove '-d' from TESTSUITEFLAGS.

2016-08-04 Thread Daniele Di Proietto
The '-d' flag tells autotest to always keep the testcase output, but
prevents '--recheck' from working.  If a user wants to always keep the
output from the tests, the '-d' flag can be passed explicitly.  This is
more in line with other test make target ('check',
'check-system-userspace').

CC: Andy Zhou 
Signed-off-by: Daniele Di Proietto 
---
 tests/automake.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/automake.mk b/tests/automake.mk
index a9ebf91..5d12ae5 100644
--- a/tests/automake.mk
+++ b/tests/automake.mk
@@ -243,7 +243,7 @@ EXTRA_DIST += tests/run-ryu
 
 # Run kmod tests. Assume kernel modules has been installed or linked into the 
kernel
 check-kernel: all tests/atconfig tests/atlocal $(SYSTEM_KMOD_TESTSUITE)
-   $(SHELL) '$(SYSTEM_KMOD_TESTSUITE)' -C tests  
AUTOTEST_PATH='$(AUTOTEST_PATH)' -d $(TESTSUITEFLAGS) -j1
+   $(SHELL) '$(SYSTEM_KMOD_TESTSUITE)' -C tests  
AUTOTEST_PATH='$(AUTOTEST_PATH)' $(TESTSUITEFLAGS) -j1
 
 # Testing the out of tree Kernel module
 check-kmod: all tests/atconfig tests/atlocal $(SYSTEM_KMOD_TESTSUITE)
-- 
2.8.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 2/3] system-traffic: Flush conntrack after debug ping6.

2016-08-04 Thread Daniele Di Proietto
We want to discard any state created by the initial ping6 (used to wait
for an available IP address).  Otherwise some weird state can show up in
the connection tracking tables (such as ICMP connection from link-local
addresses).

Fixes: e5cf8cce2759("system-tests: Add ping through conntrack test.")
Reported-by: Joe Stringer 
Signed-off-by: Daniele Di Proietto 
---
 tests/system-traffic.at | 4 
 1 file changed, 4 insertions(+)

diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 666a14d..5b0a1ce 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -675,6 +675,10 @@ AT_CHECK([ovs-ofctl --bundle add-flows br0 flows.txt])
 
 OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
 
+dnl The above ping creates state in the connection tracker.  We're not
+dnl interested in that state.
+AT_CHECK([ovs-appctl dpctl/flush-conntrack])
+
 dnl Pings from ns1->ns0 should fail.
 NS_CHECK_EXEC([at_ns1], [ping6 -q -c 3 -i 0.3 -w 2 fc00::1 | FORMAT_PING], 
[0], [dnl
 7 packets transmitted, 0 received, 100% packet loss, time 0ms
-- 
2.8.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 1/3] system-userspace-macros: Check the exit code of ethtool.

2016-08-04 Thread Daniele Di Proietto
If the ethtool command is not available on the system we should fail,
since the userspace testsuite cannot work properly without disabling
offloads.

Also, add ethtool to the list of installed packages on Vagrantfile.

Fixes: ddcf96d2dcc1 ("system-tests: Disable offloads in userspace tests.")
Reported-by: Joe Stringer 
Signed-off-by: Daniele Di Proietto 
---
 Vagrantfile  | 2 +-
 tests/system-userspace-macros.at | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Vagrantfile b/Vagrantfile
index fb06b42..843d88c 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -11,7 +11,7 @@ dnf -y install autoconf automake openssl-devel libtool \
python-twisted-core python-zope-interface \
desktop-file-utils groff graphviz rpmdevtools nc \
wget python-six pyftpdlib checkpolicy selinux-policy-devel \
-   libcap-ng-devel kernel-devel-`uname -r`
+   libcap-ng-devel kernel-devel-`uname -r` ethtool
 echo "search extra update built-in" >/etc/depmod.d/search_path.conf
 cd /vagrant
 ./boot.sh
diff --git a/tests/system-userspace-macros.at b/tests/system-userspace-macros.at
index 213425f..7e10b6c 100644
--- a/tests/system-userspace-macros.at
+++ b/tests/system-userspace-macros.at
@@ -55,7 +55,7 @@ m4_define([OVS_TRAFFIC_VSWITCHD_STOP],
 # This is a workaround, and should be removed when offloads are properly
 # supported in netdev-linux.
 m4_define([CONFIGURE_VETH_OFFLOADS],
-[ethtool -K $1 tx off]
+[AT_CHECK([ethtool -K $1 tx off], [0], [ignore])]
 )
 
 # CHECK_CONNTRACK()
-- 
2.8.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] system-traffic: Make ping6 vlan test more reliable.

2016-08-04 Thread Daniele Di Proietto
LGTM, thanks

Acked-by: 

2016-08-04 17:40 GMT-07:00 Joe Stringer :

> Previously we checked on the underlying interfaces rather than the vlan
> interfaces to verify whether IPv6 connectivity is available;
> occasionally this would fail on some systems. Wait on the VLAN IP
> instead.
>
> Signed-off-by: Joe Stringer 
> ---
>  tests/system-traffic.at | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tests/system-traffic.at b/tests/system-traffic.at
> index 666a14d44ff6..e9df90e27ac8 100644
> --- a/tests/system-traffic.at
> +++ b/tests/system-traffic.at
> @@ -113,7 +113,7 @@ ADD_VLAN(p1, at_ns1, 100, "fc00:1::2/96")
>  dnl Linux seems to take a little time to get its IPv6 stack in order.
> Without
>  dnl waiting, we get occasional failures due to the following error:
>  dnl "connect: Cannot assign requested address"
> -OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
> +OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::2])
>
>  NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 |
> FORMAT_PING], [0], [dnl
>  3 packets transmitted, 3 received, 0% packet loss, time 0ms
> --
> 2.9.2
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] bridge: No QoS configured is not an error

2016-08-04 Thread Daniele Di Proietto
Applied to master, thanks

2016-08-02 8:27 GMT-07:00 Stokes, Ian :

> > If no QoS is configured, type value is likely to be an empty string.
> >
> > This is not an error though, so use the regular command reply function,
> > not the error one.
> >
> > For example, before this patch:
> >   # ovs-appctl -t ovs-vswitchd qos/show vhost-user1
> >   QoS not configured on vhost-user1
> >   ovs-appctl: ovs-vswitchd: server returned an error
> >
> > After the patch:
> >   # ovs-appctl -t ovs-vswitchd qos/show vhost-user1
> >   QoS not configured on vhost-user1
> >
> > Signed-off-by: Maxime Coquelin 
> > ---
> >  vswitchd/bridge.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index
> > 07f7b55..ddf1fe5 100644
> > --- a/vswitchd/bridge.c
> > +++ b/vswitchd/bridge.c
> > @@ -3199,7 +3199,7 @@ qos_unixctl_show(struct unixctl_conn *conn, int
> > argc OVS_UNUSED,
> >  unixctl_command_reply(conn, ds_cstr());
> >  } else {
> >  ds_put_format(, "QoS not configured on %s\n", iface-
> > >name);
> > -unixctl_command_reply_error(conn, ds_cstr());
> > +unixctl_command_reply(conn, ds_cstr());
> >  }
> >  } else {
> >  ds_put_format(, "%s: failed to retrieve QOS configuration
> > (%s)\n",
> > --
> > 2.7.4
> >
> Thanks for the patch Maxime, looks good to me.
>
> Acked-by: Ian Stokes 
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] 答复: ovs dpdk : userspace connection tracker cannot support L7?

2016-08-04 Thread Joe Stringer
I'm not aware of anyone working on this currently.

On 4 August 2016 at 18:20, Yangyongqiang (Tony, Shannon)
 wrote:
> Hi Joe,
> Thanks for your reply, this is very helpful.
> Is there any body do this now? so we can do it together.
>
> thanks
>
> -邮件原件-
> 发件人: Joe Stringer [mailto:j...@ovn.org]
> 发送时间: 2016年8月5日 8:57
> 收件人: Yangyongqiang (Tony, Shannon)
> 抄送: dev@openvswitch.org
> 主题: Re: [ovs-dev] ovs dpdk : userspace connection tracker cannot support L7?
>
> On 2 August 2016 at 19:30, Yangyongqiang (Tony, Shannon) 
>  wrote:
>> Hello,
>>
>> We read the connection tracker code, and find this patch can not parse ftp 
>> protocol.
>>
>> Whether the userspace connection tracker only has L4 feather or has L7 
>> feather too ?
>>
>> If the ct cannot L7, then ovs dpdk cannot be used for stateful security 
>> group, so do we have a plan for supporting L7?
>
> In the userspace datapath (dpdk), there is no support for IP fragmentation or 
> ALGs today. Only the linux kernel datapath has support for these.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] 答复: ovs dpdk : userspace connection tracker cannot support L7?

2016-08-04 Thread Yangyongqiang (Tony, Shannon)
Hi Joe,
Thanks for your reply, this is very helpful.
Is there any body do this now? so we can do it together.

thanks

-邮件原件-
发件人: Joe Stringer [mailto:j...@ovn.org] 
发送时间: 2016年8月5日 8:57
收件人: Yangyongqiang (Tony, Shannon)
抄送: dev@openvswitch.org
主题: Re: [ovs-dev] ovs dpdk : userspace connection tracker cannot support L7?

On 2 August 2016 at 19:30, Yangyongqiang (Tony, Shannon) 
 wrote:
> Hello,
>
> We read the connection tracker code, and find this patch can not parse ftp 
> protocol.
>
> Whether the userspace connection tracker only has L4 feather or has L7 
> feather too ?
>
> If the ct cannot L7, then ovs dpdk cannot be used for stateful security 
> group, so do we have a plan for supporting L7?

In the userspace datapath (dpdk), there is no support for IP fragmentation or 
ALGs today. Only the linux kernel datapath has support for these.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v1 1/1] netdev-dpdk: Fix egress policer error detection bug.

2016-08-04 Thread Daniele Di Proietto
Thanks for the patch, comments inline

2016-08-02 9:37 GMT-07:00 Ian Stokes :

> When egress policer is set as a QoS type for a port, an error may occur
> during
> setup if incorrect parameters are used for the rte_meter. If this occurs
> the egress policer construct and set functions should free any allocated
> memory relevant to the policer and set the QoS configuration pointer to
> null. The netdev_dpdk_set_qos function should check the error value
> returned
> for any QoS construct/set calls with an assertion to avoid segfault.
>
> Signed-off-by: Ian Stokes 
> ---
>  lib/netdev-dpdk.c |   29 -
>  1 files changed, 28 insertions(+), 1 deletions(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index c208f32..c382270 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2679,12 +2679,19 @@ netdev_dpdk_set_qos(struct netdev *netdev,
>
>  /* Install new QoS configuration. */
>  error = new_ops->qos_construct(netdev, details);
> -ovs_assert((error == 0) == (dev->qos_conf != NULL));
>  }
>  } else {
>  error = new_ops->qos_construct(netdev, details);
> +}
> +
> +if (!error) {
>  ovs_assert((error == 0) == (dev->qos_conf != NULL));
>  }
> +else {
> +VLOG_ERR("Failed to set QoS type %s on port %s, returned error
> %d",
> +type, netdev->name, error);
> +ovs_assert(dev->qos_conf == NULL);
> +}
>

I think we can replace this with:

ovs_assert((error == 0) == (dev->qos_conf != NULL));
if (!error) {
   VLOG(...)
}

type should be aligned with " on the above line

Can we use rte_strerror to print a textual representation?


>
>  ovs_mutex_unlock(>mutex);
>  return error;
> @@ -2726,6 +2733,15 @@ egress_policer_qos_construct(struct netdev *netdev,
>  policer->app_srtcm_params.ebs = 0;
>  err = rte_meter_srtcm_config(>egress_meter,
>  >app_srtcm_params);
> +
> +if (err < 0) {
> +/* Error occurred during rte_meter creation, destroy the policer
> + * and set the qos configuration for the netdev dpdk to NULL
> + */
> +free(policer);
> +dev->qos_conf = NULL;
> +}
> +
>

Can we return a positive error number instead of a negative one? This is
more inline with the rest of OVS

 rte_spinlock_unlock(>qos_lock);
>
>  return err;
> @@ -2756,11 +2772,13 @@ static int
>  egress_policer_qos_set(struct netdev *netdev, const struct smap *details)
>  {
>  struct egress_policer *policer;
> +struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
>  const char *cir_s;
>  const char *cbs_s;
>  int err = 0;
>
>  policer = egress_policer_get__(netdev);
> +rte_spinlock_lock(>qos_lock);
>  cir_s = smap_get(details, "cir");
>  cbs_s = smap_get(details, "cbs");
>  policer->app_srtcm_params.cir = cir_s ? strtoull(cir_s, NULL, 10) : 0;
> @@ -2769,6 +2787,15 @@ egress_policer_qos_set(struct netdev *netdev, const
> struct smap *details)
>  err = rte_meter_srtcm_config(>egress_meter,
>  >app_srtcm_params);
>
> +if (err < 0) {
> +/* Error occurred during rte_meter creation, destroy the policer
> + * and set the qos configuration for the netdev dpdk to NULL
> + */
> +free(policer);
> +dev->qos_conf = NULL;
> +}
> +rte_spinlock_unlock(>qos_lock);
> +
>

Can we return a positive error number instead of a negative one? This is
more inline with the rest of OVS

I guess we forgot to lock the spinlock here on the original patch and this
commit fixes it. Can you document this in the commit message?

In the long term I'd like this to use RCU, as we wouldn't need so many
critical sections, but it's fine to avoid it for now



>  return err;
>  }
>
>

Thanks,

Daniele
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] ovs dpdk : userspace connection tracker cannot support L7?

2016-08-04 Thread Joe Stringer
On 2 August 2016 at 19:30, Yangyongqiang (Tony, Shannon)
 wrote:
> Hello,
>
> We read the connection tracker code, and find this patch can not parse ftp 
> protocol.
>
> Whether the userspace connection tracker only has L4 feather or has L7 
> feather too ?
>
> If the ct cannot L7, then ovs dpdk cannot be used for stateful security 
> group, so do we have a plan for supporting L7?

In the userspace datapath (dpdk), there is no support for IP
fragmentation or ALGs today. Only the linux kernel datapath has
support for these.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v2 0/5] check-kernel: add 802.1ad tests

2016-08-04 Thread Joe Stringer
Thanks for updating the series.

With the incremental patch below this is looking pretty reliable for
check-kmod/check-kernel on the platforms I can test on, although
there's still some issue with "make check-system-userspace". It seems
like the userspace datapath cannot receive double-tagged packets from
AF_PACKET properly; it's unclear where the issue is yet.

diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index ff67be997370..694eeb5f4665 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -85,6 +85,8 @@ ADD_SVLAN(p1, at_ns1, 4094, "10.255.2.2/24")
ADD_CVLAN(p0.4094, at_ns0, 100, "10.2.2.1/24")
ADD_CVLAN(p1.4094, at_ns1, 100, "10.2.2.2/24")

+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping -c 1 10.2.2.2])
+
NS_CHECK_EXEC([at_ns0], [ping -q -c 3 -i 0.3 -w 2 10.2.2.2 |
FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms
])
@@ -176,7 +178,7 @@ ADD_CVLAN(p1.4094, at_ns1, 100, "fc00:1::2/96")
dnl Linux seems to take a little time to get its IPv6 stack in order. Without
dnl waiting, we get occasional failures due to the following error:
dnl "connect: Cannot assign requested address"
-OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::2])

NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 |
FORMAT_PING], [0], [dnl
3 packets transmitted, 3 received, 0% packet loss, time 0ms



On 2 August 2016 at 08:20, Eric Garver  wrote:
> This series adds 6 test cases to the "check-kernel" make target for
> 802.1ad. It is meant as a counterpart to the 802.1ad work currently
> going on and being discussed on the dev list.
>
> User space support for 802.1ad is being worked on by Xiao Liang (based
> on Thomas F Herbert's work).
>
> Kernel support is being worked on by myself (also based on Tom's work).
> I will post (and CC ovs-dev) the kernel series once net-next opens again
> for new content. If there is interest I can post that series to ovs-dev
> for discussion in the mean time.
>
> These patches have been tested with Xiao's most recent series and my yet
> to be posted kernel series.
>
> Update v2:
>  - Properly skip tests on older versions of OVS and kernel
>  - Set CVLAN mtu to 1496 to allow tests to pass on older kernels
>
> Eric Garver (5):
>   check-kernel: Add macros to check for and test 802.1ad.
>   check-kernel: 802.1ad: Add datapath ping tests for CVLANs.
>   check-kernel: 802.1ad: Add conntrack ping tests for CVLANs.
>   check-kernel: 802.1ad: Add push/pop test case.
>   check-kernel: 802.1ad: Add dot1q-tunnel test case.
>
>  tests/system-common-macros.at |  30 -
>  tests/system-traffic.at   | 268 
> ++
>  2 files changed, 297 insertions(+), 1 deletion(-)
>
> --
> 2.5.5
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] system-traffic: Make ping6 vlan test more reliable.

2016-08-04 Thread Joe Stringer
Previously we checked on the underlying interfaces rather than the vlan
interfaces to verify whether IPv6 connectivity is available;
occasionally this would fail on some systems. Wait on the VLAN IP
instead.

Signed-off-by: Joe Stringer 
---
 tests/system-traffic.at | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/system-traffic.at b/tests/system-traffic.at
index 666a14d44ff6..e9df90e27ac8 100644
--- a/tests/system-traffic.at
+++ b/tests/system-traffic.at
@@ -113,7 +113,7 @@ ADD_VLAN(p1, at_ns1, 100, "fc00:1::2/96")
 dnl Linux seems to take a little time to get its IPv6 stack in order. Without
 dnl waiting, we get occasional failures due to the following error:
 dnl "connect: Cannot assign requested address"
-OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00::2])
+OVS_WAIT_UNTIL([ip netns exec at_ns0 ping6 -c 1 fc00:1::2])
 
 NS_CHECK_EXEC([at_ns0], [ping6 -q -c 3 -i 0.3 -w 2 fc00:1::2 | FORMAT_PING], 
[0], [dnl
 3 packets transmitted, 3 received, 0% packet loss, time 0ms
-- 
2.9.2

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] netdev-dpdk: When no QoS set, set type to empty string

2016-08-04 Thread Daniele Di Proietto
Thanks for the fix!

I added you name to AUTHORS and applied this to master

2016-08-02 9:52 GMT-07:00 Maxime Coquelin :

>
>
> On 08/02/2016 05:19 PM, Stokes, Ian wrote:
>
>> This patch sets *typep to an empty string instead of letting it
>>> uninitialized when no QoS configuration is set.
>>>
>>> It fixes the following vswitchd crash when no QoS has been set on vhost-
>>> user interface:
>>>
>>>  $> ovs-appctl -t ovs-vswitchd qos/show vhost-user1
>>>
>>>  #0  0x7efcbadf18d7 in raise () from /lib64/libc.so.6
>>>  #1  0x7efcbadf353a in abort () from /lib64/libc.so.6
>>>  #2  0x0068d5be in ovs_abort_valist at lib/util.c:335
>>>  #3  0x00693d90 in vlog_abort_valist at lib/vlog.c:1204
>>>  #4  0x00693e17 in vlog_abort at lib/vlog.c:1218
>>>  #5  0x0068d3ae in ovs_assert_failure at lib/util.c:72
>>>  #6  0x0060425c in ds_put_format_valist at lib/dynamic-
>>> string.c:168
>>>  #7  0x006042e7 in ds_put_format at lib/dynamic-string.c:142
>>>  #8  0x005a9e75 in qos_unixctl_show at vswitchd/bridge.c:3185
>>>  #9  0x0068cda1 in process_command at lib/unixctl.c:347
>>>  #11 unixctl_server_run at lib/unixctl.c:400
>>>  #12 0x0040a3ff in main at vswitchd/ovs-vswitchd.c:113
>>>
>>> Signed-off-by: Maxime Coquelin 
>>> ---
>>>  lib/netdev-dpdk.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index
>>> a0d541a..159fe73 100644
>>> --- a/lib/netdev-dpdk.c
>>> +++ b/lib/netdev-dpdk.c
>>> @@ -2680,6 +2680,9 @@ netdev_dpdk_get_qos(const struct netdev *netdev,
>>>  *typep = dev->qos_conf->ops->qos_name;
>>>  error = (dev->qos_conf->ops->qos_get
>>>   ? dev->qos_conf->ops->qos_get(netdev, details): 0);
>>> +} else {
>>> +/* No QoS configuration set, return an empty string */
>>> +*typep = "";
>>>  }
>>>  ovs_mutex_unlock(>mutex);
>>>
>>> --
>>> 2.7.4
>>>
>>
>> Thanks for the Patch Maxime.
>>
>> I tried to recreate the segfault with the steps you've outlined on my own
>> system without the patch but could not.
>>
>
> Maybe you were just lucky? Or actually, not lucky!
> Indeed, as *typep contains uninitialized value, maybe that in your case,
> its value was a valid address that pointed to 0?
>
>
>> I'm Running Fedora 22 with kernel 4.1.8-200 and gcc 5.3.1. Out of
>> interest what was your test environment?
>>
>
> Fedora 21, kernel 3.19.3-200 and gcc 4.9.2.
>
> Either way I agree that type should be set to "" when no QoS is not
>> configured.
>>
>> Acked-by: Ian Stokes 
>>
>
> Thanks!
> Maxime
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] 答复: Re: 答复: Re: 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread xu . binbin1
My opinion is that, the 'kill -9' signal can't be captured. 
The patch described in 
http://openvswitch.org/pipermail/dev/2016-February/065470.html can't fix 
the issue perfectly. 

Do we allow sb use 'kill -9' to kill OVS?? 


Ilya Maximets  写于 2016/08/04 20:01:50:

> 发件人:  Ilya Maximets 
> 收件人:  xu.binb...@zte.com.cn, 
> 抄送: Ben Pfaff , dev@openvswitch.org, Heetae Ahn 
> , Dyasly Sergey 
> 日期:  2016/08/04 20:02
> 主题: Re: 答复: Re: 答复: Re: [ovs-dev, CudaMailTagged] netdev-
> dpdk: unlink socket file when constructing vhostuser.
> 
> On 04.08.2016 14:52, xu.binb...@zte.com.cn wrote:
> > Thank you.
> > 
> > I saw the patch in the link: http://openvswitch.org/pipermail/dev/
> 2016-February/065556.html
> > 
> > But in the latest code of OVS, I can't find this path??
> 
> Did you read the whole discussion?
> 
> > By the way, should I keep the mode of 'lib/netdev-dpdk.c' file?
> 
> Definitely. But I don't think you should send second version if
> you don't have very strong arguments for such solution.
> 
> > Ilya Maximets  写于 2016/08/04 19:33:58:
> > 
> >> 发件人:  Ilya Maximets 
> >> 收件人:  xu.binb...@zte.com.cn,
> >> 抄送: Ben Pfaff , dev@openvswitch.org, Heetae Ahn
> >> , Dyasly Sergey 
> >> 日期:  2016/08/04 19:34
> >> 主题: Re: 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink
> >> socket file when constructing vhostuser.
> >>
> >> On 04.08.2016 14:05, xu.binb...@zte.com.cn wrote:
> >> > I get the source code clone from branch origin/master in the 
github.
> >>
> >> Sorry. All is OK, but you changed the mode of 'lib/netdev-dpdk.c' 
file.
> >>
> >> > In fact, I killed ovs-vswitchd process and then start it again.
> >> > In this case, sockets left on the filesystem.
> >>
> >> That is normal. Why you using hard untrappable signals? There will be
> >> no issues in normal case (even SIGTERM or SIGINT).
> >>
> >> There are few discussions about this in mail-list. That's an old 
topic.
> >> Some links:
> >> http://openvswitch.org/pipermail/dev/2016-February/065556.html
> >> http://openvswitch.org/pipermail/dev/2016-February/065470.html
> >>
> >>
> >> > Sorry for my description in the commit msg, it may be a puzzle to 
you.
> >> >
> >> >
> >> >
> >> >
> >> > 发件人: Ilya Maximets 
> >> > 收件人: xu.binb...@zte.com.cn, dev@openvswitch.org,
> >> > 抄送:Ben Pfaff , Dyasly Sergey
> >> , Heetae Ahn 
> >> > 日期: 2016/08/04 18:42
> >> > 主题:Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink
> >> socket file when constructing vhostuser.
> >> >
> >> 
> 
---
>  -
> >>  --
> >> >
> >> >
> >> >
> >> > Oh, again...
> >> >
> >> > 1. This patch not for upstream version of OVS. (I guess your OVS 
patched
> >> >   at least with vHost client support).
> >> >
> >> > 2. If you will restart OVS properly (even by SIGTERM or SIGINT) 
socket
> >> >   will be removed inside 'rte_vhost_driver_unregister()' or inside
> >> >   fatal_signal handler. Are you sure that it's the issue of 
upstream
> >> >   OVS and not your local patches?
> >> >
> >> > 3. Segmentation fault or another hard failure is the only reason to
> >> >   sockets left on the filesystem.
> >> >
> >> > Best regards, Ilya Maximets.
> >> >
> >> > On 04.08.2016 23:31, xu.binb...@zte.com.cn wrote:
> >> >> Work with DPDK 16.07, a UNIX socket will be created when we
> >> >> add vhostuser port. After that, the restarting of ovs-vswitchd
> >> >> leads to the failure of socket binding, so the vhostuser port
> >> >> can't be created successfully.
> >> >>
> >> >> This commit unlink socket file before creating UNIX socket to
> >> >> avoid failure of socket binding.
> >> >>
> >> >> Signed-off-by: Binbin Xu 
> >> >> ---
> >> >>  lib/netdev-dpdk.c | 5 -
> >> >>  1 file 

Re: [ovs-dev] [PATCH] netdev-dpdk: Make libnuma dependencies optional

2016-08-04 Thread Daniele Di Proietto
LGTM, thanks

Pushed to master

2016-08-04 3:44 GMT-07:00 Ciara Loftus :

> Prior to this patch, OVS with DPDK required the libnuma packages to
> build. This patch removes this dependency, making it only a requirement
> when the CONFIG_RTE_LIBRTE_VHOST_NUMA option is detected as enabled in
> the DPDK build.
>
> Signed-off-by: Ciara Loftus 
> ---
>  .travis.yml |  1 -
>  INSTALL.DPDK-ADVANCED.md|  2 +-
>  INSTALL.DPDK.md |  2 +-
>  acinclude.m4| 14 --
>  rhel/openvswitch-fedora.spec.in |  2 --
>  5 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/.travis.yml b/.travis.yml
> index a46994d..4ae6a5b 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -11,7 +11,6 @@ addons:
>  packages:
>- bc
>- gcc-multilib
> -  - libnuma-dev
>- libssl-dev
>- llvm-dev
>- libjemalloc1
> diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
> index c8d69ae..0ab43d4 100755
> --- a/INSTALL.DPDK-ADVANCED.md
> +++ b/INSTALL.DPDK-ADVANCED.md
> @@ -181,7 +181,7 @@ right PCIe slot.
>CONFIG_RTE_LIBRTE_VHOST_NUMA=y, vHost User ports automatically
>detect the NUMA socket of the QEMU vCPUs and will be serviced by a PMD
>from the same node provided a core on this node is enabled in the
> -  pmd-cpu-mask.
> +  pmd-cpu-mask. libnuma packages are required for this feature.
>
>  ### 3.7 Compiler Optimizations
>
> diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md
> index 0dae2ab..253d022 100644
> --- a/INSTALL.DPDK.md
> +++ b/INSTALL.DPDK.md
> @@ -21,7 +21,7 @@ The DPDK support of Open vSwitch is considered
> 'experimental'.
>
>  ### Prerequisites
>
> -* Required: DPDK 16.07, libnuma
> +* Required: DPDK 16.07
>  * Hardware: [DPDK Supported NICs] when physical ports in use
>
>  ##  2. Building and Installation
> diff --git a/acinclude.m4 b/acinclude.m4
> index f02166d..bbbad23 100644
> --- a/acinclude.m4
> +++ b/acinclude.m4
> @@ -209,7 +209,17 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>[AC_DEFINE([VHOST_CUSE], [1], [DPDK vhost-cuse support enabled,
> vhost-user disabled.])
> DPDK_EXTRA_LIB="-lfuse"])
>
> -AC_SEARCH_LIBS([get_mempolicy],[numa],[],[AC_MSG_ERROR([unable to
> find libnuma, install the dependency package])])
> +AC_COMPILE_IFELSE([
> +  AC_LANG_PROGRAM(
> +[
> +  #include 
> +#if RTE_LIBRTE_VHOST_NUMA
> +#error
> +#endif
> +], [])
> +  ], [],
> +  [AC_SEARCH_LIBS([get_mempolicy],[numa],[],[AC_MSG_ERROR([unable to
> find libnuma, install the dependency package])])
> +   DPDK_EXTRA_LIB="-lnuma"])
>
>  # On some systems we have to add -ldl to link with dpdk
>  #
> @@ -221,7 +231,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [
>  DPDKLIB_FOUND=false
>  save_LIBS=$LIBS
>  for extras in "" "-ldl"; do
> -LIBS="$DPDK_LIB $extras $save_LIBS $DPDK_EXTRA_LIB -lnuma"
> +LIBS="$DPDK_LIB $extras $save_LIBS $DPDK_EXTRA_LIB"
>  AC_LINK_IFELSE(
> [AC_LANG_PROGRAM([#include 
>   #include ],
> diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.
> spec.in
> index 34c0f37..0657e81 100644
> --- a/rhel/openvswitch-fedora.spec.in
> +++ b/rhel/openvswitch-fedora.spec.in
> @@ -54,8 +54,6 @@ BuildRequires: libcap-ng libcap-ng-devel
>  %endif
>  %if %{with dpdk}
>  BuildRequires: dpdk-devel >= 2.2.0
> -BuildRequires: numactl-devel
> -Requires: numactl-libs
>  Provides: %{name}-dpdk = %{version}-%{release}
>  %endif
>
> --
> 2.4.3
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] ovsdb active backup deployment

2016-08-04 Thread Andy Zhou
On Wed, Jul 27, 2016 at 1:04 PM, Andy Zhou  wrote:

>
>
> On Tue, Jul 26, 2016 at 6:20 PM, Russell Bryant  wrote:
>
>>
>>
>> On Tue, Jul 26, 2016 at 3:48 PM, Andy Zhou  wrote:
>>
>>>
>>>
>>> On Tue, Jul 26, 2016 at 11:59 AM, Russell Bryant 
>>> wrote:
>>>


 On Tue, Jul 26, 2016 at 2:41 PM, Andy Zhou  wrote:

>
>
> On Tue, Jul 26, 2016 at 5:37 AM, Russell Bryant 
> wrote:
>
>>
>>
>> On Mon, Jul 25, 2016 at 8:15 PM, Andy Zhou  wrote:
>>
>>> Hi, Rayn and Russell,
>>>
>>
>> Can we move this discussion to the ovs dev mailing list?  Feel free
>> to just add it in a reply if you'd like.
>>
> Done.
>
>>
>>
>>> I am wondering how we can actually use the active/backup feature
>>> that is now part of
>>> OVSDB to increase OVN availability.
>>>
>>
>> TO be clear, I haven't actually tried this yet.  I'm only speaking
>> about how I think it should work.
>>
>>
>>> Specifically:
>>>
>>> 1. When the active OVSDB server failed, should the back up server
>>> take over, and allow write transactions? One simpler possibility is to
>>> allow read only access to the backup serve.
>>>
>>
>> The  backup server needs to take over.  It's OK if that requires
>> intervention by an HA manager like Pacemaker.  If we can't make the 
>> passive
>> server take over, I'd say the solution is incomplete.
>>
>
> O.K. make sense.
>
> One possible issue with backup server taking over is "split head".  In
> case due to network error, backup server becomes disconnected from the
> active
> server, then we may have both server thinking they are active server
> now.  Does Pacemaker help with solving this issue.
>

 It can, yes.  I would expect Pacemaker to explicitly configure a node
 to be either the active or passive node.

>>> Manual switching is more straight forward. I agree.
>>>

>>
>>> 2. When a crashed active OVSDB server recovers, should it become the
>>> new backup, or it should switch back.
>>>
>>
>> Becoming the new backup is fine.  Again, this can be orchestrated by
>> an HA manager (Pacemaker).
>>
> I am not familiar with pacemaker. Can I assume it can provide a
> correct --sync-from argument (pointing to backup server) when relaunch
> OVSDB server?
>

 Yes.  I'd have to consult with some Pacemaker experts on exactly what
 the implementation would look like, but roughly:

 Pacemaker manages services using "OCF Resource Agents", which are just
 scripts with a defined set of inputs and outputs for service management.  I
 would imagine a Pacemaker cluster being told it must have exactly 1 active
 and 1 passive OVSDB service.  When the passive OVSDB service is started, it
 would include the "sync-from" argument based on where the active OVSDB
 service is currently running.

 We really need to prototype this and document it.  I'm guessing too
 much.  Pacemaker is frequently used to manage active/passive HA, though.

 Sounds reasonable,  I will work on ovsdb internal changes to support
>>> manual switching, using appctl commands. Then looking into prototyping with
>>> HA systems.  I have not used pacemaker in the past, so it may take some
>>> time to ramp up.
>>>
>>
>> I should be able to help.  We need to do this work anyway for integration
>> into OpenStack deployment tools.  Let me see if I can get some helpful
>> examples to follow.
>>
>
> Thanks for helping out.
>
> Given that, I now plan to work from bottom up, initially focusing on ovsdb
> server changes.
>
> 1. Add a state in ovsdb-server for it to know whether it is an active
> server.  Backup server will not accept any connections.  Server started with
> --sync-from argument will be put in the back state by default.
>
> 2. Add appctl commands to allow manually switch state.
>
> 3. Add a new table for backup server to register its address and ports.
> OVSDB clients can learn about them at run time. Back up server should issue
> an
> transaction to register its address before issuing the monitoring
> request.  This feature is not strictly necessary, and can be pushed to HA
> manager,
> but having it built into ovsdb-server may make it simpler for integrationl.
>
> What do you think?
>
>
>
Russell, Would HA manager also manage ovn-controller switch over?
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH V2] netdev-dpdk: fix memory leak

2016-08-04 Thread Daniele Di Proietto
I'm glad we can finally uncomment this code!

The patch looks good to me.

I made a few style changes and pushed this to master

Thanks

2016-08-04 2:49 GMT-07:00 Mark Kavanagh :

> DPDK v16.07 introduces the ability to free memzones.
> Up until this point, DPDK memory pools created in OVS could
> not be destroyed, thus incurring a memory leak.
>
> Leverage the DPDK v16.07 rte_mempool API to free DPDK
> mempools when their associated reference count reaches 0 (this
> indicates that the memory pool is no longer in use).
>
> Signed-off-by: Mark Kavanagh 
> ---
>
> v2->v1: rebase to head of master, and remove 'RFC' tag
>
>  lib/netdev-dpdk.c | 29 +++--
>  1 file changed, 15 insertions(+), 14 deletions(-)
>
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index aaac0d1..ffcd35c 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -506,7 +506,7 @@ dpdk_mp_get(int socket_id, int mtu)
> OVS_REQUIRES(dpdk_mutex)
>  }
>
>  static void
> -dpdk_mp_put(struct dpdk_mp *dmp)
> +dpdk_mp_put(struct dpdk_mp *dmp) OVS_REQUIRES(dpdk_mutex)
>  {
>
>  if (!dmp) {
> @@ -514,15 +514,12 @@ dpdk_mp_put(struct dpdk_mp *dmp)
>  }
>
>  dmp->refcount--;
> -ovs_assert(dmp->refcount >= 0);
>
> -#if 0
> -/* I could not find any API to destroy mp. */
> -if (dmp->refcount == 0) {
> -list_delete(dmp->list_node);
> -/* destroy mp-pool. */
> -}
> -#endif
> +if (OVS_UNLIKELY(!dmp->refcount)) {
> +ovs_list_remove(>list_node);
> +rte_mempool_free(dmp->mp);
> + }
> +
>  }
>
>  static void
> @@ -928,16 +925,18 @@ netdev_dpdk_destruct(struct netdev *netdev)
>  {
>  struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
>
> +ovs_mutex_lock(_mutex);
>  ovs_mutex_lock(>mutex);
> +
>  rte_eth_dev_stop(dev->port_id);
>  free(ovsrcu_get_protected(struct ingress_policer *,
>>ingress_policer));
> -ovs_mutex_unlock(>mutex);
>
> -ovs_mutex_lock(_mutex);
>  rte_free(dev->tx_q);
>  ovs_list_remove(>list_node);
>  dpdk_mp_put(dev->dpdk_mp);
> +
> +ovs_mutex_unlock(>mutex);
>  ovs_mutex_unlock(_mutex);
>  }
>
> @@ -946,6 +945,9 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev)
>  {
>  struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
>
> +ovs_mutex_lock(_mutex);
> +ovs_mutex_lock(>mutex);
> +
>  /* Guest becomes an orphan if still attached. */
>  if (netdev_dpdk_get_vid(dev) >= 0) {
>  VLOG_ERR("Removing port '%s' while vhost device still attached.",
> @@ -961,15 +963,14 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev)
>  fatal_signal_remove_file_to_unlink(dev->vhost_id);
>  }
>
> -ovs_mutex_lock(>mutex);
>  free(ovsrcu_get_protected(struct ingress_policer *,
>>ingress_policer));
> -ovs_mutex_unlock(>mutex);
>
> -ovs_mutex_lock(_mutex);
>  rte_free(dev->tx_q);
>  ovs_list_remove(>list_node);
>  dpdk_mp_put(dev->dpdk_mp);
> +
> +ovs_mutex_unlock(>mutex);
>  ovs_mutex_unlock(_mutex);
>  }
>
> --
> 1.9.3
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ofproto-dpif-xlate: Log flow in XLATE_REPORT().

2016-08-04 Thread Joe Stringer
To assist debugging pipelines when resubmit resource checks fail, print
the base_flow from the translation context. This base flow can then be
used from ofproto/trace to figure out which parts of the pipeline lead
to this translation error.

As far as I can see, the "## __VA_ARGS__" trick is a GCC thing rather
than part of the C standard, but it successfully compiles on GCC 6.1.1,
Clang 3.8.1, and the compiler that Appveyor CI uses so it seems like it
is widely supported.

Signed-off-by: Joe Stringer 
---
 ofproto/ofproto-dpif-xlate.c | 21 ++---
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/ofproto/ofproto-dpif-xlate.c b/ofproto/ofproto-dpif-xlate.c
index 393854e4bfc7..73ab3e558f9d 100644
--- a/ofproto/ofproto-dpif-xlate.c
+++ b/ofproto/ofproto-dpif-xlate.c
@@ -627,13 +627,20 @@ xlate_report(struct xlate_ctx *ctx, const char *format, 
...)
 
 static struct vlog_rate_limit error_report_rl = VLOG_RATE_LIMIT_INIT(1, 5);
 
-#define XLATE_REPORT_ERROR(CTX, ...)\
-do {\
-if (OVS_UNLIKELY((CTX)->xin->report_hook)) {\
-xlate_report(CTX, __VA_ARGS__); \
-} else {\
-VLOG_ERR_RL(_report_rl, __VA_ARGS__); \
-}   \
+#define XLATE_REORDER(LAST, DUMMY, ...) __VA_ARGS__, LAST
+#define XLATE_REPORT_ERROR(CTX, FMT, ...)   \
+do {\
+if (OVS_UNLIKELY((CTX)->xin->report_hook)) {\
+xlate_report(CTX, FMT, ## __VA_ARGS__); \
+} else {\
+struct ds ds = DS_EMPTY_INITIALIZER;\
+\
+flow_format(, >base_flow);  \
+VLOG_ERR_RL(_report_rl,   \
+XLATE_REORDER(ds_cstr(), dummy,  \
+  FMT": %s", ## __VA_ARGS__));  \
+ds_destroy();\
+}   \
 } while (0)
 
 static inline void
-- 
2.9.2

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] qfoulp hmz

2016-08-04 Thread grosikopulos
The original message was received at Fri, 5 Aug 2016 05:03:32 +0800
from mm-sol.com [121.104.194.244]

- The following addresses had permanent fatal errors -


- Transcript of session follows -
  while talking to openvswitch.org.:
>>> MAIL From:grosikopu...@mm-sol.com
<<< 501 grosikopu...@mm-sol.com... Refused



___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] datapath: Remove incorrect WARN_ONCE().

2016-08-04 Thread Jarno Rajahalme

> On Aug 3, 2016, at 3:46 PM, Joe Stringer  wrote:
> 
> On 3 August 2016 at 15:25, Jarno Rajahalme  wrote:
>> Upstream commit:
>>ovs_ct_find_existing() issues a warning if an existing conntrack entry
>>classified as IP_CT_NEW is found, with the premise that this should
>>not happen.  However, a newly confirmed, non-expected conntrack entry
>>remains IP_CT_NEW as long as no reply direction traffic is seen.  This
>>has resulted into somewhat confusing kernel log messages.  This patch
>>removes this check and warning.
>> 
>>Fixes: 289f2253 ("openvswitch: Find existing conntrack entry after 
>> upcall.")
>>Suggested-by: Joe Stringer 
>>Signed-off-by: Jarno Rajahalme 
>>Acked-by: Joe Stringer 
>> 
>> Signed-off-by: Jarno Rajahalme 
> 
> Can you get the upstream commit id and add it into the commit message? Thanks.
> 
> Acked-by: Joe Stringer 

Pushed to master amended as requested,

  Jarno

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-vsctl: Change log level of vsctl_parent_process_info

2016-08-04 Thread Andy Zhou
On Thu, Aug 4, 2016 at 11:39 AM, Kyle Mestery  wrote:

> On Thu, Aug 4, 2016 at 12:56 PM, Andy Zhou  wrote:
> >
> >
> > On Thu, Aug 4, 2016 at 6:54 AM, Kyle Mestery 
> wrote:
> >>
> >> While running the ovn-scale-test [1] port-binding tests [2], I notice a
> >> continual stream of messages such as this:
> >>
> >> 2016-08-04 13:05:28.705 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-]
> >> bind lport_0996bf_cikzNO to sandbox-172.16.200.24 on
> >> ovn-farm-node-uat-dal09-compute-325
> >> 2016-08-04 13:05:28.712 547 INFO paramiko.transport [-] Connected
> (version
> >> 2.0, client OpenSSH_6.6.1p1)
> >> 2016-08-04 13:05:28.805 547 INFO paramiko.transport [-] Authentication
> >> (publickey) successful!
> >> 2016-08-04T13:05:28Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04 13:05:29.042 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-]
> >> bind lport_0996bf_tvovcK to sandbox-172.16.200.24 on
> >> ovn-farm-node-uat-dal09-compute-325
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04 13:05:29.285 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-]
> >> bind lport_0996bf_HwG7AK to sandbox-172.16.200.24 on
> >> ovn-farm-node-uat-dal09-compute-325
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04 13:05:29.505 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-]
> >> bind lport_0996bf_Lqbv92 to sandbox-172.16.200.24 on
> >> ovn-farm-node-uat-dal09-compute-325
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04 13:05:29.724 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-]
> >> bind lport_0996bf_6f8uQW to sandbox-172.16.200.24 on
> >> ovn-farm-node-uat-dal09-compute-325
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> >> such file or directory)
> >> 2016-08-04 13:05:29.944 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-]
> >> bind lport_0996bf_nKl2XF to sandbox-172.16.200.24 on
> >> ovn-farm-node-uat-dal09-compute-325
> >>
> >> Tracing these down, this is due to the check in
> >> vsctl_parent_process_info(),
> >> which is verifying if the parent process can be opened. Since
> >> ovn-scale-test
> >> runs sandboxes in containers, and these are run as root, there is no
> >> /proc/0
> >> in the container. Thus, the check fails, and the error message is
> printed
> >> out.
> >> Lowering the log level here results in less logs being dumped for this
> >> failure
> >> as ovn-scale-test runs.
> >>
> >> [1] https://github.com/openvswitch/ovn-scale-test
> >> [2]
> >> https://github.com/openvswitch/ovn-scale-test/
> blob/master/rally_ovs/plugins/ovs/scenarios/ovn.py#L255
> >>
> >> Signed-off-by: Kyle Mestery 
> >> ---
> >>  utilities/ovs-vsctl.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
> >> index 722dcd9..56f1906 100644
> >> --- a/utilities/ovs-vsctl.c
> >> +++ b/utilities/ovs-vsctl.c
> >> @@ -2483,7 +2483,7 @@ vsctl_parent_process_info(void)
> >>
> >>  f = fopen(procfile, "r");
> >>  if (!f) {
> >> -VLOG_WARN("%s: open failed (%s)", procfile,
> ovs_strerror(errno));
> >> +VLOG_DBG("%s: open failed (%s)", procfile,
> ovs_strerror(errno));
> >>  free(procfile);
> >>  return NULL;
> >>  }
> >> --
> >> 2.7.4 (Apple Git-66)
> >>
> >> ___
> >> dev mailing list
> >> dev@openvswitch.org
> >> http://openvswitch.org/mailman/listinfo/dev
> >
> >
> > I wonder if we should log it at all if not being able to proc file can be
> > expected in real life.
>
> I'm fine with that approach as well, I can spin another patch.
>

Thanks, that can useful when proc file system is not available in general.

In addition, I wonder if we should separate the case of parent_pid being
zero.
and  may be we can just return a hard coded string,  say "init", since
/proc/0 does not exist as you have pointed out.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ovs-vsctl: simply vsctl_parent_process_info()

2016-08-04 Thread Andy Zhou
Use ds_get_line() instead of hand rolling it. Rearrange the logic
to removes some duplication.

Signed-off-by: Andy Zhou 
---
 utilities/ovs-vsctl.c | 22 ++
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 722dcd9..1c18de8 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -2481,26 +2481,16 @@ vsctl_parent_process_info(void)
 parent_pid = getppid();
 procfile = xasprintf("/proc/%d/cmdline", parent_pid);
 
+ds_init();
 f = fopen(procfile, "r");
-if (!f) {
+if (f) {
+ds_get_line(, f);
+fclose(f);
+} else {
 VLOG_WARN("%s: open failed (%s)", procfile, ovs_strerror(errno));
-free(procfile);
-return NULL;
 }
-free(procfile);
-
-ds_init();
-for (;;) {
-int c = getc(f);
-if (!c || c == EOF) {
-break;
-}
-ds_put_char(, c);
-}
-fclose(f);
-
-ds_put_format(, " (pid %d)", parent_pid);
 
+free(procfile);
 return ds_steal_cstr();
 #else
 return NULL;
-- 
1.9.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v7] Windows: Local named pipe implementation

2016-08-04 Thread Alin Serdean
Thanks!

De la: Guru Shetty [mailto:g...@ovn.org]
Trimis: Wednesday, August 3, 2016 5:27 PM
Către: Alin Serdean 
Cc: dev@openvswitch.org
Subiect: Re: [ovs-dev] [PATCH v7] Windows: Local named pipe implementation



On 2 August 2016 at 11:19, Alin Serdean 
> wrote:
Currently in the case of command line arguments punix/unix, on Windows
we create a file, write a TCP port number to connect. This is a security
concern.

This patch adds support for the command line arguments punix/unix trying
to mimic AF_UNIX behind a local named pipe.

This patch drops the TCP socket implementation behind command line
arguments punix/unix and switches to the local named pipe implementation.

Since we do not write anything to the file created by the punix/unix
arguments, switch tests to plain file existence.

Man pages and code comments have been updated.

Signed-off-by: Alin Gabriel Serdean 
>
Acked-by: Paul Boca 
>
Thank you, applied.

---
v7: clarify that on 'unix' argument, we do not create a file
v6: resubmit for patchwork
v5: fix coding style
v4: improve spelling in man pages
v3: squash commits update documentation and code comments
v2: Address comments, fix handle leaks.
---
 lib/automake.mk  |   1 +
 lib/stream-tcp.c | 115 --
 lib/stream-windows.c | 581 +++
 lib/unixctl.c|   5 +-
 lib/unixctl.man  |  11 +-
 lib/vconn-active.man |   4 +-
 ovsdb/remote-active.man  |   7 +-
 ovsdb/remote-passive.man |   4 +-
 tests/ovsdb-server.at|   6 +-
 9 files changed, 603 insertions(+), 131 deletions(-)
 create mode 100644 lib/stream-windows.c

diff --git a/lib/automake.mk 
b/lib/automake.mk
index 646306d..97c83e9 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -302,6 +302,7 @@ lib_libopenvswitch_la_SOURCES += \
lib/latch-windows.c \
lib/route-table-stub.c \
lib/if-notifier-stub.c \
+   lib/stream-windows.c \
lib/strsep.c
 else
 lib_libopenvswitch_la_SOURCES += \
diff --git a/lib/stream-tcp.c b/lib/stream-tcp.c
index 2b57ca7..1749fad 100644
--- a/lib/stream-tcp.c
+++ b/lib/stream-tcp.c
@@ -74,64 +74,6 @@ const struct stream_class tcp_stream_class = {
 NULL,   /* run_wait */
 NULL,   /* wait */
 };
-
-#ifdef _WIN32
-#include "dirs.h"
-
-static int
-windows_open(const char *name, char *suffix, struct stream **streamp,
- uint8_t dscp)
-{
-int error, port;
-FILE *file;
-char *suffix_new, *path;
-
-/* If the path does not contain a ':', assume it is relative to
- * OVS_RUNDIR. */
-if (!strchr(suffix, ':')) {
-path = xasprintf("%s/%s", ovs_rundir(), suffix);
-} else {
-path = xstrdup(suffix);
-}
-
-file = fopen(path, "r");
-if (!file) {
-error = errno;
-VLOG_DBG("%s: could not open %s (%s)", name, suffix,
- ovs_strerror(error));
-return error;
-}
-
-error = fscanf(file, "%d", );
-if (error != 1) {
-VLOG_ERR("failed to read port from %s", suffix);
-fclose(file);
-return EINVAL;
-}
-fclose(file);
-
-suffix_new = xasprintf("127.0.0.1:%d", port);
-
-error = tcp_open(name, suffix_new, streamp, dscp);
-
-free(suffix_new);
-free(path);
-return error;
-}
-
-const struct stream_class windows_stream_class = {
-"unix", /* name */
-false,  /* needs_probes */
-windows_open,  /* open */
-NULL,   /* close */
-NULL,   /* connect */
-NULL,   /* recv */
-NULL,   /* send */
-NULL,   /* run */
-NULL,   /* run_wait */
-NULL,   /* wait */
-};
-#endif

 /* Passive TCP. */

@@ -198,60 +140,3 @@ const struct pstream_class ptcp_pstream_class = {
 NULL,
 NULL,
 };
-
-#ifdef _WIN32
-static int
-pwindows_open(const char *name, char *suffix, struct pstream **pstreamp,
-  uint8_t dscp)
-{
-int error;
-char *suffix_new, *path;
-FILE *file;
-struct pstream *listener;
-
-suffix_new = xstrdup("0:127.0.0.1");
-
-/* If the path does not contain a ':', assume it is relative to
- * OVS_RUNDIR. */
-if (!strchr(suffix, ':')) {
-path = xasprintf("%s/%s", ovs_rundir(), suffix);
-} else {
-path = xstrdup(suffix);
-}
-
-error = new_pstream(suffix_new, name, pstreamp, dscp, path, false);
-if (error) {
-goto exit;
-}
-listener = *pstreamp;
-

Re: [ovs-dev] [PATCH v3 3/3] Windows: document multiple NIC support setup

2016-08-04 Thread Alin Serdean
Thanks for the review! I agree with the comments and will update the 
documentation/respin a new series once the Patch 2/3 is reviewed.

Thanks,
Alin.

> Sai:
[Alin Gabriel Serdean: ] Did you also have a comment here?
> >+In our example,  this is how Œovs-vsctl show¹ looks like with the NICs
> >separated under
> >+different bridges:
> >+
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v3 1/3] Windows: Add internal switch port per OVS bridge

2016-08-04 Thread Alin Serdean
+Ben +Guru

Thanks a lot for the review!

To be short the subject of interest is the sanitization of the input during 
queries.

You need to have root access or know how the remote management was created and 
have access to it, thus you could do worse things.

WQL is based on DMTF(https://www.dmtf.org/) which lacks 
UPDATE/INSERT/DELETE/DROP commands.

Disregarding the above, the only character which can play a role is " ' ".

My question is the following:
is "etc'port" a valid port name?

If it is I will escape that character, if it isn't it should be trimmed further 
up.

Rest of the comments inlined.

> >+void
> >+get_hres_error(HRESULT hres)
> 
> Sai: This function looks very similar to ovs_format_message(int error).
> Can we reuse/modify the other one?
> FormatMessage needs the FORMAT_MESSAGE_IGNORE_INSERTS for the
> following
> reason:
> 
> 
> // Important! will fail otherwise, since we're not
>// (and CANNOT) pass insertion parameters
>|FORMAT_MESSAGE_IGNORE_INSERTS,
[Alin Gabriel Serdean: ] I could try to split. HRESULT can be a different type.
> 
> 
> 
> >+HRESULT
> >+get_uint16_t_value(IWbemClassObject* pcls_obj, wchar_t* field_name,
> >+   uint16_t* value)
> >+{
> 
> Sai: You should move the following lines to a different function and just
> cast the result.
> 
[Alin Gabriel Serdean: ] <
> >+VARIANT vt_prop;
> >+VariantInit(_prop);
> >+HRESULT hres = pcls_obj->lpVtbl->Get(pcls_obj, field_name, 0,
> >_prop,
> >+ 0, 0);
> >+
> >+if (FAILED(hres)) {
> 
> Is this missing: VariantClear(_prop); ?
> 
> >+return hres;
> >+}
> >+
[Alin Gabriel Serdean: ] >
> >+*value = V_UI2(_prop);
[Alin Gabriel Serdean: ] The problem is variant is a struct and uses macros to 
get the type(i.e. V_UI2). I can make the snippet common and just use the macros 
per type.
> >+VariantClear(_prop);
> >+
> >+if(!check_return_value(psvc->lpVtbl->GetObject(psvc, job_path,
> >0, NULL,
> 
> Sai: Can you split the arguments? Goes over the 78 char limit.
[Alin Gabriel Serdean: ] From the coding style 
(https://github.com/openvswitch/ovs/blob/master/CodingStyle.md) 79 is the limit 
and I think the above fits.
> 
> 
> >+/* Get the port with the element name equal to the name input */
> >+wchar_t internal_port_query[2048] = L"SELECT * from "
> >+L"Msvm_EthernetPortAllocationSettingData  WHERE ElementName =
> >\"" ;
> >+
> 
> 
> Sai: We should sanitize the input to avoid sql injections or errors.
[Alin Gabriel Serdean: ] Please see the WQL comment
> 
> >+/* Check if the element already exists on the switch */
> >+wchar_t internal_port_query[2048] = L"SELECT * FROM "
> >+L"Msvm_InternalEthernetPort WHERE ElementName = \"";
> >+
> 
> Sai: Same as above. Try to sanitize the input to get rid of ³.
[Alin Gabriel Serdean: ] Please see the WQL comment
> 

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-vsctl: Change log level of vsctl_parent_process_info

2016-08-04 Thread Kyle Mestery
On Thu, Aug 4, 2016 at 12:56 PM, Andy Zhou  wrote:
>
>
> On Thu, Aug 4, 2016 at 6:54 AM, Kyle Mestery  wrote:
>>
>> While running the ovn-scale-test [1] port-binding tests [2], I notice a
>> continual stream of messages such as this:
>>
>> 2016-08-04 13:05:28.705 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
>> bind lport_0996bf_cikzNO to sandbox-172.16.200.24 on
>> ovn-farm-node-uat-dal09-compute-325
>> 2016-08-04 13:05:28.712 547 INFO paramiko.transport [-] Connected (version
>> 2.0, client OpenSSH_6.6.1p1)
>> 2016-08-04 13:05:28.805 547 INFO paramiko.transport [-] Authentication
>> (publickey) successful!
>> 2016-08-04T13:05:28Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04 13:05:29.042 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
>> bind lport_0996bf_tvovcK to sandbox-172.16.200.24 on
>> ovn-farm-node-uat-dal09-compute-325
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04 13:05:29.285 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
>> bind lport_0996bf_HwG7AK to sandbox-172.16.200.24 on
>> ovn-farm-node-uat-dal09-compute-325
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04 13:05:29.505 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
>> bind lport_0996bf_Lqbv92 to sandbox-172.16.200.24 on
>> ovn-farm-node-uat-dal09-compute-325
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04 13:05:29.724 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
>> bind lport_0996bf_6f8uQW to sandbox-172.16.200.24 on
>> ovn-farm-node-uat-dal09-compute-325
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
>> such file or directory)
>> 2016-08-04 13:05:29.944 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
>> bind lport_0996bf_nKl2XF to sandbox-172.16.200.24 on
>> ovn-farm-node-uat-dal09-compute-325
>>
>> Tracing these down, this is due to the check in
>> vsctl_parent_process_info(),
>> which is verifying if the parent process can be opened. Since
>> ovn-scale-test
>> runs sandboxes in containers, and these are run as root, there is no
>> /proc/0
>> in the container. Thus, the check fails, and the error message is printed
>> out.
>> Lowering the log level here results in less logs being dumped for this
>> failure
>> as ovn-scale-test runs.
>>
>> [1] https://github.com/openvswitch/ovn-scale-test
>> [2]
>> https://github.com/openvswitch/ovn-scale-test/blob/master/rally_ovs/plugins/ovs/scenarios/ovn.py#L255
>>
>> Signed-off-by: Kyle Mestery 
>> ---
>>  utilities/ovs-vsctl.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
>> index 722dcd9..56f1906 100644
>> --- a/utilities/ovs-vsctl.c
>> +++ b/utilities/ovs-vsctl.c
>> @@ -2483,7 +2483,7 @@ vsctl_parent_process_info(void)
>>
>>  f = fopen(procfile, "r");
>>  if (!f) {
>> -VLOG_WARN("%s: open failed (%s)", procfile, ovs_strerror(errno));
>> +VLOG_DBG("%s: open failed (%s)", procfile, ovs_strerror(errno));
>>  free(procfile);
>>  return NULL;
>>  }
>> --
>> 2.7.4 (Apple Git-66)
>>
>> ___
>> dev mailing list
>> dev@openvswitch.org
>> http://openvswitch.org/mailman/listinfo/dev
>
>
> I wonder if we should log it at all if not being able to proc file can be
> expected in real life.

I'm fine with that approach as well, I can spin another patch.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-vsctl: Change log level of vsctl_parent_process_info

2016-08-04 Thread Andy Zhou
On Thu, Aug 4, 2016 at 6:54 AM, Kyle Mestery  wrote:

> While running the ovn-scale-test [1] port-binding tests [2], I notice a
> continual stream of messages such as this:
>
> 2016-08-04 13:05:28.705 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
> bind lport_0996bf_cikzNO to sandbox-172.16.200.24 on
> ovn-farm-node-uat-dal09-compute-325
> 2016-08-04 13:05:28.712 547 INFO paramiko.transport [-] Connected (version
> 2.0, client OpenSSH_6.6.1p1)
> 2016-08-04 13:05:28.805 547 INFO paramiko.transport [-] Authentication
> (publickey) successful!
> 2016-08-04T13:05:28Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04 13:05:29.042 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
> bind lport_0996bf_tvovcK to sandbox-172.16.200.24 on
> ovn-farm-node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04 13:05:29.285 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
> bind lport_0996bf_HwG7AK to sandbox-172.16.200.24 on
> ovn-farm-node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04 13:05:29.505 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
> bind lport_0996bf_Lqbv92 to sandbox-172.16.200.24 on
> ovn-farm-node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04 13:05:29.724 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
> bind lport_0996bf_6f8uQW to sandbox-172.16.200.24 on
> ovn-farm-node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No
> such file or directory)
> 2016-08-04 13:05:29.944 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-]
> bind lport_0996bf_nKl2XF to sandbox-172.16.200.24 on
> ovn-farm-node-uat-dal09-compute-325
>
> Tracing these down, this is due to the check in
> vsctl_parent_process_info(),
> which is verifying if the parent process can be opened. Since
> ovn-scale-test
> runs sandboxes in containers, and these are run as root, there is no
> /proc/0
> in the container. Thus, the check fails, and the error message is printed
> out.
> Lowering the log level here results in less logs being dumped for this
> failure
> as ovn-scale-test runs.
>
> [1] https://github.com/openvswitch/ovn-scale-test
> [2] https://github.com/openvswitch/ovn-scale-test/
> blob/master/rally_ovs/plugins/ovs/scenarios/ovn.py#L255
>
> Signed-off-by: Kyle Mestery 
> ---
>  utilities/ovs-vsctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
> index 722dcd9..56f1906 100644
> --- a/utilities/ovs-vsctl.c
> +++ b/utilities/ovs-vsctl.c
> @@ -2483,7 +2483,7 @@ vsctl_parent_process_info(void)
>
>  f = fopen(procfile, "r");
>  if (!f) {
> -VLOG_WARN("%s: open failed (%s)", procfile, ovs_strerror(errno));
> +VLOG_DBG("%s: open failed (%s)", procfile, ovs_strerror(errno));
>  free(procfile);
>  return NULL;
>  }
> --
> 2.7.4 (Apple Git-66)
>
> ___
> dev mailing list
> dev@openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>

I wonder if we should log it at all if not being able to proc file can be
expected in real life.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH v2 2/2] Add wrapper scripts for *ctl commands

2016-08-04 Thread Ryan Moats
This commit creates wrapper scripts for the *ctl commands to use
--dry-run for those that have them, and to allow for log level
setting vi ovs-appctl without allowing full access to ovs-appctl.
The debian install files for ovn-common, openvswitch-common and
openvswitch-vswitch have been modified to include the wrapper
scripts as part of files to be installed.

Tests have been added to make sure that the wrapper scripts
don't actually do anything when asked to perform a write operation.

Signed-off-by: Ryan Moats 
---
 v1->v2:
   Added unit test for ovs-appsetlog
   Included new scripts in appropriate debian package definitions

 debian/openvswitch-common.install |   2 +
 debian/openvswitch-switch.install |   2 +
 debian/ovn-common.install |   2 +
 ovn/utilities/automake.mk |   8 ++-
 ovn/utilities/ovn-nbread  |   2 +
 ovn/utilities/ovn-sbread  |   2 +
 tests/ovn-nbctl.at| 103 +++
 tests/ovn-sbctl.at|  46 
 tests/ovs-ofctl.at|  33 +
 tests/ovs-vsctl.at|  90 +++
 tests/vlog.at |  27 +++
 tests/vtep-ctl.at | 145 ++
 utilities/automake.mk |  10 ++-
 utilities/ovs-appsetlog   |  40 +++
 utilities/ovs-dpread  |   2 +
 utilities/ovs-ofread  |   2 +
 utilities/ovs-vsread  |   2 +
 vtep/automake.mk  |   5 +-
 vtep/vtep-read|   2 +
 19 files changed, 520 insertions(+), 5 deletions(-)
 create mode 100755 ovn/utilities/ovn-nbread
 create mode 100755 ovn/utilities/ovn-sbread
 create mode 100755 utilities/ovs-appsetlog
 create mode 100755 utilities/ovs-dpread
 create mode 100755 utilities/ovs-ofread
 create mode 100755 utilities/ovs-vsread
 create mode 100755 vtep/vtep-read

diff --git a/debian/openvswitch-common.install 
b/debian/openvswitch-common.install
index ebb7d5c..8b0ed03 100644
--- a/debian/openvswitch-common.install
+++ b/debian/openvswitch-common.install
@@ -7,6 +7,8 @@ usr/bin/ovs-pki
 usr/bin/ovsdb-client
 usr/sbin/ovs-bugtool
 usr/share/openvswitch/bugtool-plugins
+usr/share/openvswitch/scripts/ovs-appsetlog
 usr/share/openvswitch/scripts/ovs-bugtool-*
 usr/share/openvswitch/scripts/ovs-lib
+usr/share/openvswitch/scripts/ovs-ofread
 usr/lib/lib*.so.*
diff --git a/debian/openvswitch-switch.install 
b/debian/openvswitch-switch.install
index bfb391f..934915d 100644
--- a/debian/openvswitch-switch.install
+++ b/debian/openvswitch-switch.install
@@ -12,5 +12,7 @@ usr/sbin/ovs-vswitchd
 usr/sbin/ovsdb-server
 usr/share/openvswitch/scripts/ovs-check-dead-ifs
 usr/share/openvswitch/scripts/ovs-ctl
+usr/share/openvswitch/scripts/ovs-dpread
 usr/share/openvswitch/scripts/ovs-save
+usr/share/openvswitch/scripts/ovs-vsread
 usr/share/openvswitch/vswitch.ovsschema
diff --git a/debian/ovn-common.install b/debian/ovn-common.install
index acb1dc9..b9fae25 100644
--- a/debian/ovn-common.install
+++ b/debian/ovn-common.install
@@ -1,3 +1,5 @@
 usr/bin/ovn-nbctl
 usr/bin/ovn-sbctl
 usr/share/openvswitch/scripts/ovn-ctl
+usr/share/openvswitch/scripts/ovn-nbread
+usr/share/openvswitch/scripts/ovn-sbread
diff --git a/ovn/utilities/automake.mk b/ovn/utilities/automake.mk
index d84368c..c78a07f 100644
--- a/ovn/utilities/automake.mk
+++ b/ovn/utilities/automake.mk
@@ -1,5 +1,7 @@
 scripts_SCRIPTS += \
-ovn/utilities/ovn-ctl
+ovn/utilities/ovn-ctl \
+ovn/utilities/ovn-nbread \
+ovn/utilities/ovn-sbread
 
 man_MANS += \
 ovn/utilities/ovn-ctl.8 \
@@ -18,7 +20,9 @@ EXTRA_DIST += \
 ovn/utilities/ovn-ctl.8.xml \
 ovn/utilities/ovn-docker-overlay-driver \
 ovn/utilities/ovn-docker-underlay-driver \
-ovn/utilities/ovn-nbctl.8.xml
+ovn/utilities/ovn-nbctl.8.xml \
+ovn/utilities/ovn-nbread \
+ovn/utilities/ovn-sbread
 
 DISTCLEANFILES += \
 ovn/utilities/ovn-ctl.8 \
diff --git a/ovn/utilities/ovn-nbread b/ovn/utilities/ovn-nbread
new file mode 100755
index 000..27c9b71
--- /dev/null
+++ b/ovn/utilities/ovn-nbread
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec ovn-nbctl --dry-run "$@"
diff --git a/ovn/utilities/ovn-sbread b/ovn/utilities/ovn-sbread
new file mode 100755
index 000..d5c3f44
--- /dev/null
+++ b/ovn/utilities/ovn-sbread
@@ -0,0 +1,2 @@
+#! /bin/sh
+exec ovn-sbctl --dry-run "$@"
diff --git a/tests/ovn-nbctl.at b/tests/ovn-nbctl.at
index 5357ced..615e0fc 100644
--- a/tests/ovn-nbctl.at
+++ b/tests/ovn-nbctl.at
@@ -485,3 +485,106 @@ IPv6 Routes
 
 OVN_NBCTL_TEST_STOP
 AT_CLEANUP
+
+dnl -
+
+AT_SETUP([ovn-nbread - negative tests])
+OVN_NBCTL_TEST_START
+ovn-nbctl ls-add base
+ovn-nbctl ls-list > expout
+ovn-nbread init
+AT_CHECK([ovn-nbread ls-list], [0], [expout])
+ovn-nbread ls-add canary
+AT_CHECK([ovn-nbread ls-list], [0], [expout])
+ovn-nbread ls-del base

[ovs-dev] [PATCH v2 1/2] Add dry-run option to ovs-dpctl and ovs-ofctl commands.

2016-08-04 Thread Ryan Moats
ovs-dpctl and ovs-ofctl lack a dry-run option.  Add it
and the necessary scaffolding to each.

Signed-off-by: Ryan Moats 
---

v1->v2:
 Fixed typo in usage string

 lib/command-line.c |  50 +
 lib/command-line.h |   6 +-
 lib/db-ctl-base.h  |   2 +-
 lib/dpctl.c|  44 ++--
 lib/dpctl.h|   3 +
 ovsdb/ovsdb-tool.c |  28 
 tests/ovstest.c|   4 +-
 tests/test-bitmap.c|   6 +-
 tests/test-ccmap.c |   6 +-
 tests/test-classifier.c|  28 
 tests/test-cmap.c  |   6 +-
 tests/test-conntrack.c |   6 +-
 tests/test-heap.c  |  14 ++--
 tests/test-jsonrpc.c   |  10 +--
 tests/test-netlink-conntrack.c |   8 +--
 tests/test-ovn.c   |  24 +++
 tests/test-ovsdb.c |  78 ++--
 tests/test-reconnect.c |  32 -
 tests/test-util.c  |  34 -
 tests/test-vconn.c |  18 ++---
 utilities/ovs-dpctl.c  |   7 ++
 utilities/ovs-ofctl.8.in   |   3 +
 utilities/ovs-ofctl.c  | 160 ++---
 23 files changed, 317 insertions(+), 260 deletions(-)

diff --git a/lib/command-line.c b/lib/command-line.c
index bda5ed6..7f30646 100644
--- a/lib/command-line.c
+++ b/lib/command-line.c
@@ -87,20 +87,11 @@ ovs_cmdl_print_options(const struct option options[])
 ds_destroy();
 }
 
-/* Runs the command designated by argv[0] within the command table specified by
- * 'commands', which must be terminated by a command whose 'name' member is a
- * null pointer.
- *
- * Command-line options should be stripped off, so that a typical invocation
- * looks like:
- *struct ovs_cmdl_context ctx = {
- *.argc = argc - optind,
- *.argv = argv + optind,
- *};
- *ovs_cmdl_run_command(, my_commands);
- * */
-void
-ovs_cmdl_run_command(struct ovs_cmdl_context *ctx, const struct 
ovs_cmdl_command commands[])
+/* Whether to commit changes or not. */
+static bool dry_run; 
+
+static void
+_ovs_cmdl_run_command(struct ovs_cmdl_context *ctx, const struct 
ovs_cmdl_command commands[])
 {
 const struct ovs_cmdl_command *p;
 
@@ -118,6 +109,9 @@ ovs_cmdl_run_command(struct ovs_cmdl_context *ctx, const 
struct ovs_cmdl_command
 VLOG_FATAL("'%s' command takes at most %d arguments",
p->name, p->max_args);
 } else {
+if (p->mode == OVS_RW && dry_run) {
+return;
+}
 p->handler(ctx);
 if (ferror(stdout)) {
 VLOG_FATAL("write to stdout failed");
@@ -132,6 +126,34 @@ ovs_cmdl_run_command(struct ovs_cmdl_context *ctx, const 
struct ovs_cmdl_command
 
 VLOG_FATAL("unknown command '%s'; use --help for help", ctx->argv[0]);
 }
+
+/* Runs the command designated by argv[0] within the command table specified by
+ * 'commands', which must be terminated by a command whose 'name' member is a
+ * null pointer.
+ *
+ * Command-line options should be stripped off, so that a typical invocation
+ * looks like:
+ *struct ovs_cmdl_context ctx = {
+ *.argc = argc - optind,
+ *.argv = argv + optind,
+ *};
+ *ovs_cmdl_run_command(, my_commands);
+ * */
+void
+ovs_cmdl_run_command(struct ovs_cmdl_context *ctx,
+ const struct ovs_cmdl_command commands[])
+{
+dry_run = false;
+_ovs_cmdl_run_command(ctx, commands);
+}
+
+void
+ovs_cmdl_run_command_dry_run(struct ovs_cmdl_context *ctx,
+ const struct ovs_cmdl_command commands[])
+{
+dry_run = true;
+_ovs_cmdl_run_command(ctx, commands);
+}
 
 /* Process title. */
 
diff --git a/lib/command-line.h b/lib/command-line.h
index e9e3b7b..d0c4c3e 100644
--- a/lib/command-line.h
+++ b/lib/command-line.h
@@ -41,12 +41,16 @@ struct ovs_cmdl_command {
 int min_args;
 int max_args;
 ovs_cmdl_handler handler;
+enum { OVS_RO, OVS_RW } mode;/* Does this command modify things? */
 };
 
 char *ovs_cmdl_long_options_to_short_options(const struct option *options);
 void ovs_cmdl_print_options(const struct option *options);
 void ovs_cmdl_print_commands(const struct ovs_cmdl_command *commands);
-void ovs_cmdl_run_command(struct ovs_cmdl_context *, const struct 
ovs_cmdl_command[]);
+void ovs_cmdl_run_command(struct ovs_cmdl_context *,
+  const struct ovs_cmdl_command[]);
+void ovs_cmdl_run_command_dry_run(struct ovs_cmdl_context *,
+  const struct ovs_cmdl_command[]);
 
 void ovs_cmdl_proctitle_init(int argc, char **argv);
 #if defined(__FreeBSD__) || defined(__NetBSD__)
diff --git a/lib/db-ctl-base.h b/lib/db-ctl-base.h
index 0f4658e..e5a354d 100644
--- a/lib/db-ctl-base.h
+++ b/lib/db-ctl-base.h
@@ -120,7 +120,7 @@ struct ctl_command_syntax {
  * 

[ovs-dev] [PATCH v2 0/2] Read only versions of the *ctl commands

2016-08-04 Thread Ryan Moats
This patch series adds read-only wrapper scripts around the various
*ctl commands that leverage the --dry-run command line option.
This option is added to commands that don't currently have it
(ovs-dpctl and ovs-ofctl) and negative tests are included to verify
that the wrapper scripts don't change things.

v1->v2:
  Fixed typo in patch set one.
  Added unit test for ovs-appsetlog
  Added new scripts into approriate debian package definitions.

Ryan Moats (2):
  Add dry-run option to ovs-dpctl and ovs-ofctl commands.
  Add wrapper scripts for *ctl commands

 debian/openvswitch-common.install |   2 +
 debian/openvswitch-switch.install |   2 +
 debian/ovn-common.install |   2 +
 lib/command-line.c|  50 
 lib/command-line.h|   6 +-
 lib/db-ctl-base.h |   2 +-
 lib/dpctl.c   |  44 ++-
 lib/dpctl.h   |   3 +
 ovn/utilities/automake.mk |   8 +-
 ovn/utilities/ovn-nbread  |   2 +
 ovn/utilities/ovn-sbread  |   2 +
 ovsdb/ovsdb-tool.c|  28 +++
 tests/ovn-nbctl.at| 103 
 tests/ovn-sbctl.at|  46 +++
 tests/ovs-ofctl.at|  33 
 tests/ovs-vsctl.at|  90 +
 tests/ovstest.c   |   4 +-
 tests/test-bitmap.c   |   6 +-
 tests/test-ccmap.c|   6 +-
 tests/test-classifier.c   |  28 +++
 tests/test-cmap.c |   6 +-
 tests/test-conntrack.c|   6 +-
 tests/test-heap.c |  14 ++--
 tests/test-jsonrpc.c  |  10 +--
 tests/test-netlink-conntrack.c|   8 +-
 tests/test-ovn.c  |  24 +++---
 tests/test-ovsdb.c|  78 +--
 tests/test-reconnect.c|  32 
 tests/test-util.c |  34 
 tests/test-vconn.c|  18 ++---
 tests/vlog.at |  27 +++
 tests/vtep-ctl.at | 145 ++
 utilities/automake.mk |  10 ++-
 utilities/ovs-appsetlog   |  40 ++
 utilities/ovs-dpctl.c |   7 ++
 utilities/ovs-dpread  |   2 +
 utilities/ovs-ofctl.8.in  |   3 +
 utilities/ovs-ofctl.c | 160 +-
 utilities/ovs-ofread  |   2 +
 utilities/ovs-vsread  |   2 +
 vtep/automake.mk  |   5 +-
 vtep/vtep-read|   2 +
 42 files changed, 837 insertions(+), 265 deletions(-)
 create mode 100755 ovn/utilities/ovn-nbread
 create mode 100755 ovn/utilities/ovn-sbread
 create mode 100755 utilities/ovs-appsetlog
 create mode 100755 utilities/ovs-dpread
 create mode 100755 utilities/ovs-ofread
 create mode 100755 utilities/ovs-vsread
 create mode 100755 vtep/vtep-read

-- 
2.7.4

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] Let's talk the NB DB IDL Part I - things we've see scaling the networking-ovn to NB DB connection

2016-08-04 Thread Ryan Moats
"dev"  wrote on 08/03/2016 04:53:42 PM:

> From: Ben Pfaff 
> To: Russell Bryant 
> Cc: ovs-dev 
> Date: 08/03/2016 04:54 PM
> Subject: Re: [ovs-dev] Let's talk the NB DB IDL Part I - things
> we've see scaling the networking-ovn to NB DB connection
> Sent by: "dev" 
>
> On Wed, Aug 03, 2016 at 11:58:52AM -0400, Russell Bryant wrote:
> > On Wed, Aug 3, 2016 at 11:39 AM, Kyle Mestery 
wrote:
> >
> > > On Wed, Aug 3, 2016 at 10:30 AM, Ryan Moats 
wrote:
> > > >
> > > > Russell Bryant  wrote on 08/03/2016 10:11:57 AM:
> > > >
> > > >> From: Russell Bryant 
> > > >> To: Ryan Moats/Omaha/IBM@IBMUS
> > > >> Cc: Ben Pfaff , ovs-dev 
> > > >> Date: 08/03/2016 10:12 AM
> > > >> Subject: Re: [ovs-dev] Let's talk the NB DB IDL Part I - things
> > > >> we've see scaling the networking-ovn to NB DB connection
> > > >>
> > > >> On Wed, Aug 3, 2016 at 9:28 AM, Ryan Moats 
wrote:
> > > >>
> > > >>
> > > >> Ben Pfaff  wrote on 08/03/2016 12:27:48 AM:
> > > >>
> > > >> > From: Ben Pfaff 
> > > >> > To: Ryan Moats/Omaha/IBM@IBMUS
> > > >> > Cc: ovs-dev 
> > > >> > Date: 08/03/2016 12:28 AM
> > > >> > Subject: Re: [ovs-dev] Let's talk the NB DB IDL Part I - things
> > > >> > we've see scaling the networking-ovn to NB DB connection
> > > >> >
> > > >> > On Wed, Aug 03, 2016 at 12:06:47AM -0500, Ryan Moats wrote:
> > > >> > > Ben Pfaff  wrote on 08/02/2016 11:52:23 PM:
> > > >> > >
> > > >> > > > From: Ben Pfaff 
> > > >> > > > To: Ryan Moats/Omaha/IBM@IBMUS
> > > >> > > > Cc: ovs-dev 
> > > >> > > > Date: 08/02/2016 11:52 PM
> > > >> > > > Subject: Re: [ovs-dev] Let's talk the NB DB IDL Part I -
things
> > > >> > > > we've see scaling the networking-ovn to NB DB connection
> > > >> > > >
> > > >> > > > On Tue, Aug 02, 2016 at 11:45:07PM -0500, Ryan Moats wrote:
> > > >> > > > > "dev"  wrote on 08/02/2016
> > > 10:56:07
> > > >> PM:
> > > >> > > > > > Ben Pfaff  wrote on 08/02/2016 10:14:46 PM:
> > > >> > > > > > > Presumably this means that networking-ovn is calling
> > > "verify"
> > > >> on
> > > >> > > the
> > > >> > > > > > > column in question.  Probably, networking-ovn
> should use the
> > > >> > > partial
> > > >> > > > > map
> > > >> > > > > > > update functionality introduced in commit
f199df26e8e28
> > > >> "ovsdb-idl:
> > > >> > > Add
> > > >> > > > > > > partial map updates functionality."  I don't know
whether
> > > > it's
> > > >> in
> > > >> > > the
> > > >> > > > > > > Python IDL yet.
> > > >> > > > > >
> > > >> > > > > > Indeed they are and thanks for the pointer to the commit
-
> > > I'll
> > > >> dig
> > > >> > > > > > into it tomorrow and see if that code is reflected in
the
> > > > Python
> > > >> > > > > > IDL via that or another commit.  If it is, great.  If
not,
> > > > there
> > > >> > > > > > will likely also be a patch adding it so that we can
move
> > > > along.
> > > >> > > > >
> > > >> > > > > Hmm, maybe I'm misreading something, but I don't thing
that's
> > > > going
> > > >> > > > > to work without some additional modifications - the
partial map
> > > >> commit
> > > >> > > > > currently codes for columns that have a particular value
type
> > > >> defined
> > > >> > > > > by the schema.  The problem we are seeing is with theports
and
> > > >> acls
> > > >> > > > > columns of the logical switch table, which are lists of
strong
> > > >> > > > > references.  Since they don't have a defined value, the
> > > generated
> > > >> IDL
> > > >> > > > > code doesn't provide hooks for using partial map
operations and
> > > > we
> > > >> > > default
> > > >> > > > > back to update/verify with the given above results.
> > > >> > > > >
> > > >> > > > > Now, I think this an oversight, because I can argue that
since
> > > >> these
> > > >> > > > > are strong references, I should be able to use partial
maps to
> > > >> update
> > > >> > > > > them as keys with a null value.  Does this make sense or
am I
> > > >> breaking
> > > >> > > > > something if I look at going this route?
> > > >> > > >
> > > >> > > > If they're implemented as partial map operations only, then
we
> > > > should
> > > >> > > > extend them to support partial set operations too--the same
> > > >> principles
> > > >> > > > apply.
> > > >> > >
> > > >> > > I'm not sure I parsed this correctly, but I think we are
saying the
> > > >> same
> > > >> > > thing: change the IDL for columns that contain sets of strong
> > > >> references
> > > >> > > from using update/verify to using mutate for partial set
operations
> > > > (I
> > > >> > > realized after hitting the send button that I should have said
> > > > partial
> > > >> > > sets instead of partial maps...)
> > > >> >
> > > 

[ovs-dev] [PATCH v2 2/2] python: Add support for partial map and partial set updates

2016-08-04 Thread Ryan Moats
Allow the python IDL to use mutate operations more freely
by mimicing the partial map and partial set operations now
available in the C IDL.

Unit tests for both of these types of operations are included.
They are not carbon copies of the C tests, because testing
idempotency is a bit difficult for the current python IDL
test harness.

Signed-off-by: Ryan Moats 
---
 python/ovs/db/idl.py | 197 ---
 tests/ovsdb-idl.at   |  30 +++-
 tests/test-ovsdb.py  |  83 ++
 3 files changed, 298 insertions(+), 12 deletions(-)

diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py
index 92a7382..4957078 100644
--- a/python/ovs/db/idl.py
+++ b/python/ovs/db/idl.py
@@ -16,8 +16,10 @@ import functools
 import uuid
 
 import six
+import sys
 
 import ovs.jsonrpc
+import ovs.db.data as data
 import ovs.db.parser
 import ovs.db.schema
 from ovs.db import error
@@ -588,8 +590,7 @@ class Idl(object):
 continue
 
 try:
-datum_diff = ovs.db.data.Datum.from_json(column.type,
- datum_diff_json)
+datum_diff = data.Datum.from_json(column.type, datum_diff_json)
 except error.Error as e:
 # XXX rate-limit
 vlog.warn("error parsing column %s in table %s: %s"
@@ -614,7 +615,7 @@ class Idl(object):
 continue
 
 try:
-datum = ovs.db.data.Datum.from_json(column.type, datum_json)
+datum = data.Datum.from_json(column.type, datum_json)
 except error.Error as e:
 # XXX rate-limit
 vlog.warn("error parsing column %s in table %s: %s"
@@ -730,6 +731,24 @@ class Row(object):
 #   - None, if this transaction deletes this row.
 self.__dict__["_changes"] = {}
 
+# _mutations describes changes to this row to be handled via a
+# mutate operation on the wire.  It takes the following values:
+#
+#   - {}, the empty dictionary, if no transaction is active or if the
+# row has yet not been mutated within this transaction.
+#
+#   - A dictionary that contains two keys:
+#
+# - "_inserts" contains a dictionary that maps column names to
+#   new keys/key-value pairs that should be inserted into the
+#   column
+# - "_removes" contains a dictionary that maps column names to
+#   the keys/key-value pairs that should be removed from the
+#   column
+#
+#   - None, if this transaction deletes this row.
+self.__dict__["_mutations"] = {}
+
 # A dictionary whose keys are the names of columns that must be
 # verified as prerequisites when the transaction commits.  The values
 # in the dictionary are all None.
@@ -750,17 +769,47 @@ class Row(object):
 
 def __getattr__(self, column_name):
 assert self._changes is not None
+assert self._mutations is not None
 
 datum = self._changes.get(column_name)
+inserts = None
+if '_inserts' in self._mutations.keys():
+inserts = self._mutations['_inserts'].get(column_name)
+removes = None
+if '_removes' in self._mutations.keys():
+removes = self._mutations['_removes'].get(column_name)
 if datum is None:
 if self._data is None:
-raise AttributeError("%s instance has no attribute '%s'" %
- (self.__class__.__name__, column_name))
+if inserts is None:
+raise AttributeError("%s instance has no attribute '%s'" %
+ (self.__class__.__name__,
+  column_name))
+else:
+datum = inserts
 if column_name in self._data:
 datum = self._data[column_name]
+try:
+if inserts is not None:
+datum.extend(inserts)
+if removes is not None:
+datum = [x for x in datum if x not in removes]
+except error.Error:
+pass
+try:
+if inserts is not None:
+datum.merge(inserts)
+if removes is not None:
+for key in removes.keys():
+del datum[key]
+except error.Error:
+pass
 else:
-raise AttributeError("%s instance has no attribute '%s'" %
- (self.__class__.__name__, column_name))
+if inserts is None:
+raise AttributeError("%s instance has no attribute '%s'" %
+

[ovs-dev] [PATCH v2 1/2] ovsdb: Add/use partial set updates.

2016-08-04 Thread Ryan Moats
This patchset mimics the changes introduced in

  f199df26 (ovsdb-idl: Add partial map updates functionality.)
  010fe7ae (ovsdb-idlc.in: Autogenerate partial map updates functions.)
  7251075c (tests: Add test for partial map updates.)

but for columns that store sets of values rather than key-value
pairs.  These columns will now be able to use the OVSDB mutate
operation to transmit deltas on the wire rather than use
verify/update and transmit wait/update operations on the wire.

Signed-off-by: Ryan Moats 
---
 lib/automake.mk  |   2 +
 lib/ovsdb-idl-provider.h |   3 +
 lib/ovsdb-idl.c  | 390 +++
 lib/ovsdb-idl.h  |   6 +
 lib/ovsdb-set-op.c   | 170 +
 lib/ovsdb-set-op.h   |  44 ++
 ovsdb/ovsdb-idlc.in  |  65 +++-
 tests/idltest.ovsschema  |  14 ++
 tests/idltest2.ovsschema |  14 ++
 tests/ovsdb-idl.at   |  36 -
 tests/test-ovsdb.c   | 104 -
 11 files changed, 745 insertions(+), 103 deletions(-)
 create mode 100644 lib/ovsdb-set-op.c
 create mode 100644 lib/ovsdb-set-op.h

diff --git a/lib/automake.mk b/lib/automake.mk
index 97c83e9..30a281f 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -187,6 +187,8 @@ lib_libopenvswitch_la_SOURCES = \
lib/ovsdb-idl.h \
lib/ovsdb-map-op.c \
lib/ovsdb-map-op.h \
+   lib/ovsdb-set-op.c \
+   lib/ovsdb-set-op.h \
lib/ovsdb-condition.h \
lib/ovsdb-condition.c \
lib/ovsdb-parser.c \
diff --git a/lib/ovsdb-idl-provider.h b/lib/ovsdb-idl-provider.h
index 55ed793..64e8ec3 100644
--- a/lib/ovsdb-idl-provider.h
+++ b/lib/ovsdb-idl-provider.h
@@ -20,6 +20,7 @@
 #include "openvswitch/list.h"
 #include "ovsdb-idl.h"
 #include "ovsdb-map-op.h"
+#include "ovsdb-set-op.h"
 #include "ovsdb-types.h"
 #include "openvswitch/shash.h"
 #include "uuid.h"
@@ -39,6 +40,8 @@ struct ovsdb_idl_row {
 struct hmap_node txn_node;  /* Node in ovsdb_idl_txn's list. */
 unsigned long int *map_op_written; /* Bitmap of columns pending map ops. */
 struct map_op_list **map_op_lists; /* Per-column map operations. */
+unsigned long int *set_op_written; /* Bitmap of columns pending set ops. */
+struct set_op_list **set_op_lists; /* Per-column set operations. */
 
 /* Tracking data */
 unsigned int change_seqno[OVSDB_IDL_CHANGE_MAX];
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c
index d70fb10..dfd0ac9 100644
--- a/lib/ovsdb-idl.c
+++ b/lib/ovsdb-idl.c
@@ -184,6 +184,7 @@ static struct ovsdb_idl_row *ovsdb_idl_row_create(struct 
ovsdb_idl_table *,
 static void ovsdb_idl_row_destroy(struct ovsdb_idl_row *);
 static void ovsdb_idl_row_destroy_postprocess(struct ovsdb_idl *);
 static void ovsdb_idl_destroy_all_map_op_lists(struct ovsdb_idl_row *);
+static void ovsdb_idl_destroy_all_set_op_lists(struct ovsdb_idl_row *);
 
 static void ovsdb_idl_row_parse(struct ovsdb_idl_row *);
 static void ovsdb_idl_row_unparse(struct ovsdb_idl_row *);
@@ -200,6 +201,10 @@ static void ovsdb_idl_txn_add_map_op(struct ovsdb_idl_row 
*,
  const struct ovsdb_idl_column *,
  struct ovsdb_datum *,
  enum map_op_type);
+static void ovsdb_idl_txn_add_set_op(struct ovsdb_idl_row *,
+ const struct ovsdb_idl_column *,
+ struct ovsdb_datum *,
+ enum set_op_type);
 
 static void ovsdb_idl_send_lock_request(struct ovsdb_idl *);
 static void ovsdb_idl_send_unlock_request(struct ovsdb_idl *);
@@ -1811,7 +1816,9 @@ ovsdb_idl_row_create(struct ovsdb_idl_table *table, const 
struct uuid *uuid)
 row->uuid = *uuid;
 row->table = table;
 row->map_op_written = NULL;
-row->map_op_lists = NULL;
+row->map_op_written = NULL;
+row->set_op_lists = NULL;
+row->set_op_lists = NULL;
 return row;
 }
 
@@ -1822,6 +1829,7 @@ ovsdb_idl_row_destroy(struct ovsdb_idl_row *row)
 ovsdb_idl_row_clear_old(row);
 hmap_remove(>table->rows, >hmap_node);
 ovsdb_idl_destroy_all_map_op_lists(row);
+ovsdb_idl_destroy_all_set_op_lists(row);
 if (ovsdb_idl_track_is_set(row->table)) {
 row->change_seqno[OVSDB_IDL_CHANGE_DELETE]
 = row->table->change_seqno[OVSDB_IDL_CHANGE_DELETE]
@@ -1856,6 +1864,27 @@ ovsdb_idl_destroy_all_map_op_lists(struct ovsdb_idl_row 
*row)
 }
 
 static void
+ovsdb_idl_destroy_all_set_op_lists(struct ovsdb_idl_row *row)
+{
+if (row->set_op_written) {
+/* Clear Set Operation Lists */
+size_t idx, n_columns;
+const struct ovsdb_idl_column *columns;
+const struct ovsdb_type *type;
+n_columns = row->table->class->n_columns;
+columns = row->table->class->columns;
+BITMAP_FOR_EACH_1 (idx, n_columns, row->set_op_written) {
+type = [idx].type;
+  

[ovs-dev] [PATCH v2 0/2] Partial set operations and Python IDL update

2016-08-04 Thread Ryan Moats
The first of these patches supercedes [1] and makes the addition
of partial set operations officially open for reviews.

The second patch in the series updates the Python IDL to allow similar
partial set and partial map operations (as the original partial map
commits did not include Python code).  The unit tests in the second
commit are not a complete carbon copy of their C bretheren as the
Python IDL test harness does not appear to handle idempotency testing
and dumping of a map to string ends up dumping an unordered list
leading to sporadic test failures (suggestions for how to fix this
will be appreciated)

[1] http://patchwork.ozlabs.org/patch/65/

Ryan Moats (2):
  ovsdb: Add/use partial set updates.
  python: Add support for partial map and partial set updates

 lib/automake.mk  |   2 +
 lib/ovsdb-idl-provider.h |   3 +
 lib/ovsdb-idl.c  | 390 +++
 lib/ovsdb-idl.h  |   6 +
 lib/ovsdb-set-op.c   | 170 +
 lib/ovsdb-set-op.h   |  44 ++
 ovsdb/ovsdb-idlc.in  |  65 +++-
 python/ovs/db/idl.py | 197 ++--
 tests/idltest.ovsschema  |  14 ++
 tests/idltest2.ovsschema |  14 ++
 tests/ovsdb-idl.at   |  62 
 tests/test-ovsdb.c   | 104 -
 tests/test-ovsdb.py  |  83 ++
 13 files changed, 1041 insertions(+), 113 deletions(-)
 create mode 100644 lib/ovsdb-set-op.c
 create mode 100644 lib/ovsdb-set-op.h

-- 
2.7.4

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] POX application

2016-08-04 Thread Francesco Murador
Hi i need some help with POX, i need to realize a pox application that raise a 
message from openflow switches on mininet, but i need to do a custom openflow 
message, because all i have to do, it is to check the traffic of my network and 
than if in an openflow switch there’s a lot of traffic it had to send a message 
to the controller and than the controller says to the other to use another 
path, obviously i yet checked how to do the second part, i mean the part to 
ignore a determinate switch, so my question is…how can i create a custom 
openflow message in mininet(or pox i don’t know where to start in this part) to 
send to controller(where i’ll raise as an event)?
I think i need to do this in mininet, but i need some help to understand
Thank you for your help and i hope for a reply.
If you don’t understand something of what i wrote say it to me 


Inviato da Posta per Windows 10

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] ovs-vsctl: Change log level of vsctl_parent_process_info

2016-08-04 Thread Ryan Moats

"dev"  wrote on 08/04/2016 08:54:27 AM:

> From: Kyle Mestery 
> To: dev@openvswitch.org
> Date: 08/04/2016 08:54 AM
> Subject: [ovs-dev] [PATCH] ovs-vsctl: Change log level of
> vsctl_parent_process_info
> Sent by: "dev" 
>
> While running the ovn-scale-test [1] port-binding tests [2], I notice a
> continual stream of messages such as this:
>
> 2016-08-04 13:05:28.705 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-] bind lport_0996bf_cikzNO to sandbox-172.16.200.24 on ovn-farm-
> node-uat-dal09-compute-325
> 2016-08-04 13:05:28.712 547 INFO paramiko.transport [-] Connected
> (version 2.0, client OpenSSH_6.6.1p1)
> 2016-08-04 13:05:28.805 547 INFO paramiko.transport [-]
> Authentication (publickey) successful!
> 2016-08-04T13:05:28Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04 13:05:29.042 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-] bind lport_0996bf_tvovcK to sandbox-172.16.200.24 on ovn-farm-
> node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04 13:05:29.285 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-] bind lport_0996bf_HwG7AK to sandbox-172.16.200.24 on ovn-farm-
> node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04 13:05:29.505 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-] bind lport_0996bf_Lqbv92 to sandbox-172.16.200.24 on ovn-farm-
> node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04 13:05:29.724 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-] bind lport_0996bf_6f8uQW to sandbox-172.16.200.24 on ovn-farm-
> node-uat-dal09-compute-325
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed
> (No such file or directory)
> 2016-08-04 13:05:29.944 547 INFO rally_ovs.plugins.ovs.scenarios.ovn
> [-] bind lport_0996bf_nKl2XF to sandbox-172.16.200.24 on ovn-farm-
> node-uat-dal09-compute-325
>
> Tracing these down, this is due to the check in vsctl_parent_process_info
(),
> which is verifying if the parent process can be opened. Since
ovn-scale-test
> runs sandboxes in containers, and these are run as root, there is
no /proc/0
> in the container. Thus, the check fails, and the error message is printed
out.
> Lowering the log level here results in less logs being dumped for this
failure
> as ovn-scale-test runs.
>
> [1] https://github.com/openvswitch/ovn-scale-test
> [2] https://github.com/openvswitch/ovn-scale-test/blob/master/
> rally_ovs/plugins/ovs/scenarios/ovn.py#L255
>
> Signed-off-by: Kyle Mestery 
> ---
>  utilities/ovs-vsctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
> index 722dcd9..56f1906 100644
> --- a/utilities/ovs-vsctl.c
> +++ b/utilities/ovs-vsctl.c
> @@ -2483,7 +2483,7 @@ vsctl_parent_process_info(void)
>
>  f = fopen(procfile, "r");
>  if (!f) {
> -VLOG_WARN("%s: open failed (%s)", procfile, ovs_strerror
(errno));
> +VLOG_DBG("%s: open failed (%s)", procfile, ovs_strerror(errno));
>  free(procfile);
>  return NULL;
>  }

lgtm

Acked-by: Ryan Moats 

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH v2 1/3] netdev-dpdk: Remove dpdkvhostcuse ports

2016-08-04 Thread Ciara Loftus
This commit removes the 'dpdkvhostcuse' port type from the userspace
datapath. vhost-cuse ports are quickly becoming obsolete as the
vhost-user port type begins to support a greater feature-set thanks to
the addition of things like vhost-user multiqueue and potential
upcoming features like vhost-user client-mode and vhost-user reconnect.
The feature is also expected to be removed from DPDK soon.

One potential drawback of the removal of this support is that a
userspace vHost port type is not available in OVS for use with older
versions of QEMU (pre v2.2). Considering v2.2 is nearly two years old
this should however be a low impact change.

Signed-off-by: Ciara Loftus 
Acked-by: Flavio Leitner 
Acked-by: Daniele Di Proietto 
---
 INSTALL.DPDK-ADVANCED.md| 242 -
 NEWS|   1 +
 acinclude.m4|  12 -
 lib/netdev-dpdk.c   | 101 +---
 rhel/README.RHEL|   2 -
 rhel/etc_sysconfig_network-scripts_ifup-ovs |   7 -
 utilities/automake.mk   |   1 -
 utilities/qemu-wrap.py  | 389 
 vswitchd/vswitch.xml|  12 -
 9 files changed, 5 insertions(+), 762 deletions(-)
 delete mode 100755 utilities/qemu-wrap.py

diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index c8d69ae..f9587b5 100755
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -374,13 +374,6 @@ For users wanting to do packet forwarding using kernel 
stack below are the steps
```
 
 ##  6. Vhost Walkthrough
-
-DPDK 16.07 supports two types of vhost:
-
-1. vhost-user - enabled default
-
-2. vhost-cuse - Legacy, disabled by default
-
 ### 6.1 vhost-user
 
   - Prerequisites:
@@ -534,241 +527,6 @@ DPDK 16.07 supports two types of vhost:
 
   Note: For information on libvirt and further tuning refer [libvirt].
 
-### 6.2 vhost-cuse
-
-  - Prerequisites:
-
-QEMU version >= 2.2
-
-  - Enable vhost-cuse support
-
-1. Enable vhost cuse support in DPDK
-
-   Set `CONFIG_RTE_LIBRTE_VHOST_USER=n` in config/common_linuxapp and 
follow the
-   steps in 2.2 section of INSTALL.DPDK guide to build DPDK with cuse 
support.
-   OVS will detect that DPDK has vhost-cuse libraries compiled and in turn 
will enable
-   support for it in the switch and disable vhost-user support.
-
-2. Insert the Cuse module
-
-   `modprobe cuse`
-
-3. Build and insert the `eventfd_link` module
-
-   ```
-   cd $DPDK_DIR/lib/librte_vhost/eventfd_link/
-   make
-   insmod $DPDK_DIR/lib/librte_vhost/eventfd_link.ko
-   ```
-
-  - Adding vhost-cuse ports to Switch
-
-Unlike DPDK ring ports, DPDK vhost-cuse ports can have arbitrary names.
-For vhost-cuse, the name of the port type is `dpdkvhostcuse`
-
-```
-ovs-vsctl add-port br0 vhost-cuse-1 -- set Interface vhost-cuse-1
-type=dpdkvhostcuse
-```
-
-When attaching vhost-cuse ports to QEMU, the name provided during the
-add-port operation must match the ifname parameter on the QEMU cmd line.
-
-  - Adding vhost-cuse ports to VM
-
-vhost-cuse ports use a Linux* character device to communicate with QEMU.
-By default it is set to `/dev/vhost-net`. It is possible to reuse this
-standard device for DPDK vhost, which makes setup a little simpler but it
-is better practice to specify an alternative character device in order to
-avoid any conflicts if kernel vhost is to be used in parallel.
-
-1. This step is only needed if using an alternative character device.
-
-   ```
-   ./utilities/ovs-vsctl --no-wait set Open_vSwitch . \
-other_config:cuse-dev-name=my-vhost-net
-   ```
-
-   In the example above, the character device to be used will be
-   `/dev/my-vhost-net`.
-
-2. In case of reusing kernel vhost character device, there would be 
conflict
-   user should remove it.
-
-   `rm -rf /dev/vhost-net`
-
-3. Configure virtio-net adapters
-
-   The following parameters must be passed to the QEMU binary, repeat
-   the below parameters for multiple devices.
-
-   ```
-   -netdev tap,id=,script=no,downscript=no,ifname=,vhost=on
-   -device virtio-net-pci,netdev=net1,mac=
-   ```
-
-   The DPDK vhost library will negotiate its own features, so they
-   need not be passed in as command line params. Note that as offloads
-   are disabled this is the equivalent of setting
-
-   `csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off`
-
-   When using an alternative character device, it must be explicitly
-   passed to QEMU using the `vhostfd` argument
-
-   ```
-   -netdev tap,id=,script=no,downscript=no,ifname=,vhost=on,
-   vhostfd= -device virtio-net-pci,netdev=net1,mac=
-   ```
-
-   

Re: [ovs-dev] [ovs-dev, 3/3] netdev-dpdk: vHost client mode and reconnect

2016-08-04 Thread Loftus, Ciara
> 
> Hi, Ciara.
> I'm suggesting also following change:
> -
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 57dc437..f092fa2 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -959,7 +963,8 @@ netdev_dpdk_vhost_destruct(struct netdev
> *netdev)
>  struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
> 
>  /* Guest becomes an orphan if still attached. */
> -if (netdev_dpdk_get_vid(dev) >= 0) {
> +if (netdev_dpdk_get_vid(dev) >= 0
> +&& !(vhost_driver_flags & RTE_VHOST_USER_CLIENT)) {
>  VLOG_ERR("Removing port '%s' while vhost device still attached.",
>   netdev->name);
>  VLOG_ERR("To restore connectivity after re-adding of port, VM on
> socket"
> -
> 
> Few comments inline.

Thanks for the review Ilya. I've submitted a new version that incorporates your 
suggestions.

Ciara

> 
> On 04.08.2016 13:42, Ciara Loftus wrote:
> > A new other_config DB option has been added called 'vhost-driver-mode'.
> > By default this is set to 'server' which is the mode of operation OVS
> > with DPDK has used up until this point - whereby OVS creates and manages
> > vHost user sockets.
> >
> > If set to 'client', OVS will act as the vHost client and connect to
> > sockets created and managed by QEMU which acts as the server. This
> mode
> > allows for reconnect capability, which allows vHost ports to resume
> > normal connectivity in event of switch reset.
> >
> > QEMU v2.7.0+ is required when using OVS in client mode and QEMU in
> > server mode.
> >
> > Signed-off-by: Ciara Loftus 
> > ---
> >  INSTALL.DPDK-ADVANCED.md | 27 +++
> >  NEWS |  1 +
> >  lib/netdev-dpdk.c| 28 +---
> >  vswitchd/vswitch.xml | 13 +
> >  4 files changed, 62 insertions(+), 7 deletions(-)
> >
> > diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
> > index f9587b5..a773533 100755
> > --- a/INSTALL.DPDK-ADVANCED.md
> > +++ b/INSTALL.DPDK-ADVANCED.md
> > @@ -483,6 +483,33 @@ For users wanting to do packet forwarding using
> kernel stack below are the steps
> > where `-L`: Changes the numbers of channels of the specified network
> device
> > and `combined`: Changes the number of multi-purpose channels.
> >
> > +4. Enable OVS vHost client-mode & vHost reconnect (OPTIONAL)
> > +
> > +   By default, OVS DPDK acts as the vHost socket server and QEMU the
> > +   client. In QEMU v2.7 the option is available for QEMU to act as the
> > +   server. In order for this to work, OVS DPDK must be switched to 
> > 'client'
> > +   mode. This is possible by setting the 'vhost-driver-mode' DB entry 
> > to
> > +   'client' like so:
> > +
> > +   ```
> > +   ovs-vsctl set Open_vSwitch . other_config:vhost-driver-mode="client"
> > +   ```
> > +
> > +   This must be done before the switch is launched. It cannot 
> > sucessfully
> > +   be changed after switch has launched.
> > +
> > +   One must also append ',server' to the 'chardev' arguments on the
> QEMU
> > +   command line, to instruct QEMU to use vHost server mode, like so:
> > +
> > +   
> > +   -chardev
> socket,id=char0,path=/usr/local/var/run/openvswitch/vhost0,server
> > +   
> > +
> > +   One benefit of using this mode is the ability for vHost ports to
> > +   'reconnect' in event of the switch crashing or being brought down.
> Once
> > +   it is brought back up, the vHost ports will reconnect automatically 
> > and
> > +   normal service will resume.
> > +
> >- VM Configuration with libvirt
> >
> >  * change the user/group, access control policty and restart libvirtd.
> > diff --git a/NEWS b/NEWS
> > index 9f09e1c..99412ba 100644
> > --- a/NEWS
> > +++ b/NEWS
> > @@ -70,6 +70,7 @@ Post-v2.5.0
> > fragmentation or NAT support yet)
> >   * Support for DPDK 16.07
> >   * Remove dpdkvhostcuse port type.
> > + * OVS client mode for vHost and vHost reconnect (Requires QEMU 2.7)
> > - Increase number of registers to 16.
> > - ovs-benchmark: This utility has been removed due to lack of use and
> >   bitrot.
> > diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> > index 7692cc8..c528cb4 100644
> > --- a/lib/netdev-dpdk.c
> > +++ b/lib/netdev-dpdk.c
> > @@ -136,7 +136,8 @@ BUILD_ASSERT_DECL((MAX_NB_MBUF /
> ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF))
> >  #define OVS_VHOST_QUEUE_DISABLED(-2) /* Queue was disabled by
> guest and not
> >* yet mapped to another queue. */
> >
> > -static char *vhost_sock_dir = NULL;   /* Location of vhost-user sockets */
> > +static char *vhost_sock_dir = NULL; /* Location of vhost-user sockets 
> > */
> > +static uint64_t 

[ovs-dev] [PATCH v2 3/3] netdev-dpdk: vHost client mode and reconnect

2016-08-04 Thread Ciara Loftus
A new other_config DB option has been added called 'vhost-driver-mode'.
By default this is set to 'server' which is the mode of operation OVS
with DPDK has used up until this point - whereby OVS creates and manages
vHost user sockets.

If set to 'client', OVS will act as the vHost client and connect to
sockets created and managed by QEMU which acts as the server. This mode
allows for reconnect capability, which allows vHost ports to resume
normal connectivity in event of switch reset.

QEMU v2.7.0+ is required when using OVS in client mode and QEMU in
server mode.

Signed-off-by: Ciara Loftus 
---
v2
- Updated comments in vhost construct & destruct
- Add check for server-mode before printing error when destruct is called
  on a running VM
- Fixed coding style/standards issues
- Use strcmp instead of strncmp when processing 'vhost-driver-mode'

 INSTALL.DPDK-ADVANCED.md | 27 +++
 NEWS |  1 +
 lib/netdev-dpdk.c| 31 +++
 vswitchd/vswitch.xml | 13 +
 4 files changed, 64 insertions(+), 8 deletions(-)

diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index f9587b5..a773533 100755
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -483,6 +483,33 @@ For users wanting to do packet forwarding using kernel 
stack below are the steps
where `-L`: Changes the numbers of channels of the specified network 
device
and `combined`: Changes the number of multi-purpose channels.
 
+4. Enable OVS vHost client-mode & vHost reconnect (OPTIONAL)
+
+   By default, OVS DPDK acts as the vHost socket server and QEMU the
+   client. In QEMU v2.7 the option is available for QEMU to act as the
+   server. In order for this to work, OVS DPDK must be switched to 'client'
+   mode. This is possible by setting the 'vhost-driver-mode' DB entry to
+   'client' like so:
+
+   ```
+   ovs-vsctl set Open_vSwitch . other_config:vhost-driver-mode="client"
+   ```
+
+   This must be done before the switch is launched. It cannot sucessfully
+   be changed after switch has launched.
+
+   One must also append ',server' to the 'chardev' arguments on the QEMU
+   command line, to instruct QEMU to use vHost server mode, like so:
+
+   
+   -chardev 
socket,id=char0,path=/usr/local/var/run/openvswitch/vhost0,server
+   
+
+   One benefit of using this mode is the ability for vHost ports to
+   'reconnect' in event of the switch crashing or being brought down. Once
+   it is brought back up, the vHost ports will reconnect automatically and
+   normal service will resume.
+
   - VM Configuration with libvirt
 
 * change the user/group, access control policty and restart libvirtd.
diff --git a/NEWS b/NEWS
index 9f09e1c..99412ba 100644
--- a/NEWS
+++ b/NEWS
@@ -70,6 +70,7 @@ Post-v2.5.0
fragmentation or NAT support yet)
  * Support for DPDK 16.07
  * Remove dpdkvhostcuse port type.
+ * OVS client mode for vHost and vHost reconnect (Requires QEMU 2.7)
- Increase number of registers to 16.
- ovs-benchmark: This utility has been removed due to lack of use and
  bitrot.
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 7692cc8..39c448b 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -136,7 +136,8 @@ BUILD_ASSERT_DECL((MAX_NB_MBUF / 
ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF))
 #define OVS_VHOST_QUEUE_DISABLED(-2) /* Queue was disabled by guest and not
   * yet mapped to another queue. */
 
-static char *vhost_sock_dir = NULL;   /* Location of vhost-user sockets */
+static char *vhost_sock_dir = NULL; /* Location of vhost-user sockets */
+static uint64_t vhost_driver_flags = 0; /* Denote whether client/server mode */
 
 #define VHOST_ENQ_RETRY_NUM 8
 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
@@ -833,7 +834,6 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
 struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
 const char *name = netdev->name;
 int err;
-uint64_t flags = 0;
 
 /* 'name' is appended to 'vhost_sock_dir' and used to create a socket in
  * the file system. '/' or '\' would traverse directories, so they're not
@@ -856,14 +856,17 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
 snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
  vhost_sock_dir, name);
 
-err = rte_vhost_driver_register(dev->vhost_id, flags);
+err = rte_vhost_driver_register(dev->vhost_id, vhost_driver_flags);
 if (err) {
 VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
  dev->vhost_id);
 } else {
-fatal_signal_add_file_to_unlink(dev->vhost_id);
-VLOG_INFO("Socket %s created for vhost-user port %s\n",
-  dev->vhost_id, name);
+if (!(vhost_driver_flags & 

[ovs-dev] [PATCH v2 2/3] netdev-dpdk: Remove empty init function

2016-08-04 Thread Ciara Loftus
DPDK type ports no longer implement the netdev class 'init' function.
Set the function to NULL in NETDEV_DPDK_CLASS.

Suggested-by: Daniele Di Proietto 
Acked-by: Daniele Di Proietto 
Acked-by: Flavio Leitner 
Signed-off-by: Ciara Loftus 
---
 lib/netdev-dpdk.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 25c1363..7692cc8 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2439,12 +2439,6 @@ dpdk_vhost_class_init(void)
 return 0;
 }
 
-static int
-dpdk_vhost_user_class_init(void)
-{
-return 0;
-}
-
 static void
 dpdk_common_init(void)
 {
@@ -2878,7 +2872,7 @@ netdev_dpdk_vhost_user_reconfigure(struct netdev *netdev)
 return err;
 }
 
-#define NETDEV_DPDK_CLASS(NAME, INIT, CONSTRUCT, DESTRUCT,\
+#define NETDEV_DPDK_CLASS(NAME, CONSTRUCT, DESTRUCT,  \
   SET_CONFIG, SET_TX_MULTIQ, SEND,\
   GET_CARRIER, GET_STATS, \
   GET_FEATURES, GET_STATUS,   \
@@ -2886,7 +2880,7 @@ netdev_dpdk_vhost_user_reconfigure(struct netdev *netdev)
 { \
 NAME, \
 true,   /* is_pmd */  \
-INIT,   /* init */\
+NULL,   /* init */\
 NULL,   /* netdev_dpdk_run */ \
 NULL,   /* netdev_dpdk_wait */\
   \
@@ -3327,7 +3321,6 @@ dpdk_init(const struct smap *ovs_other_config)
 static const struct netdev_class dpdk_class =
 NETDEV_DPDK_CLASS(
 "dpdk",
-NULL,
 netdev_dpdk_construct,
 netdev_dpdk_destruct,
 netdev_dpdk_set_config,
@@ -3343,7 +3336,6 @@ static const struct netdev_class dpdk_class =
 static const struct netdev_class dpdk_ring_class =
 NETDEV_DPDK_CLASS(
 "dpdkr",
-NULL,
 netdev_dpdk_ring_construct,
 netdev_dpdk_destruct,
 netdev_dpdk_set_config,
@@ -3359,7 +3351,6 @@ static const struct netdev_class dpdk_ring_class =
 static const struct netdev_class OVS_UNUSED dpdk_vhost_user_class =
 NETDEV_DPDK_CLASS(
 "dpdkvhostuser",
-dpdk_vhost_user_class_init,
 netdev_dpdk_vhost_user_construct,
 netdev_dpdk_vhost_destruct,
 NULL,
-- 
2.4.3

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ovs-vsctl: Change log level of vsctl_parent_process_info

2016-08-04 Thread Kyle Mestery
While running the ovn-scale-test [1] port-binding tests [2], I notice a
continual stream of messages such as this:

2016-08-04 13:05:28.705 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-] bind 
lport_0996bf_cikzNO to sandbox-172.16.200.24 on 
ovn-farm-node-uat-dal09-compute-325
2016-08-04 13:05:28.712 547 INFO paramiko.transport [-] Connected (version 2.0, 
client OpenSSH_6.6.1p1)
2016-08-04 13:05:28.805 547 INFO paramiko.transport [-] Authentication 
(publickey) successful!
2016-08-04T13:05:28Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04 13:05:29.042 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-] bind 
lport_0996bf_tvovcK to sandbox-172.16.200.24 on 
ovn-farm-node-uat-dal09-compute-325
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04 13:05:29.285 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-] bind 
lport_0996bf_HwG7AK to sandbox-172.16.200.24 on 
ovn-farm-node-uat-dal09-compute-325
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04 13:05:29.505 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-] bind 
lport_0996bf_Lqbv92 to sandbox-172.16.200.24 on 
ovn-farm-node-uat-dal09-compute-325
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04 13:05:29.724 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-] bind 
lport_0996bf_6f8uQW to sandbox-172.16.200.24 on 
ovn-farm-node-uat-dal09-compute-325
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04T13:05:29Z|2|vsctl|WARN|/proc/0/cmdline: open failed (No such 
file or directory)
2016-08-04 13:05:29.944 547 INFO rally_ovs.plugins.ovs.scenarios.ovn [-] bind 
lport_0996bf_nKl2XF to sandbox-172.16.200.24 on 
ovn-farm-node-uat-dal09-compute-325

Tracing these down, this is due to the check in vsctl_parent_process_info(),
which is verifying if the parent process can be opened. Since ovn-scale-test
runs sandboxes in containers, and these are run as root, there is no /proc/0
in the container. Thus, the check fails, and the error message is printed out.
Lowering the log level here results in less logs being dumped for this failure
as ovn-scale-test runs.

[1] https://github.com/openvswitch/ovn-scale-test
[2] 
https://github.com/openvswitch/ovn-scale-test/blob/master/rally_ovs/plugins/ovs/scenarios/ovn.py#L255

Signed-off-by: Kyle Mestery 
---
 utilities/ovs-vsctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utilities/ovs-vsctl.c b/utilities/ovs-vsctl.c
index 722dcd9..56f1906 100644
--- a/utilities/ovs-vsctl.c
+++ b/utilities/ovs-vsctl.c
@@ -2483,7 +2483,7 @@ vsctl_parent_process_info(void)
 
 f = fopen(procfile, "r");
 if (!f) {
-VLOG_WARN("%s: open failed (%s)", procfile, ovs_strerror(errno));
+VLOG_DBG("%s: open failed (%s)", procfile, ovs_strerror(errno));
 free(procfile);
 return NULL;
 }
-- 
2.7.4 (Apple Git-66)

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [ovs-dev, 3/3] netdev-dpdk: vHost client mode and reconnect

2016-08-04 Thread Ilya Maximets
Hi, Ciara.
I'm suggesting also following change:
-
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 57dc437..f092fa2 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -959,7 +963,8 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev)
 struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
 
 /* Guest becomes an orphan if still attached. */
-if (netdev_dpdk_get_vid(dev) >= 0) {
+if (netdev_dpdk_get_vid(dev) >= 0
+&& !(vhost_driver_flags & RTE_VHOST_USER_CLIENT)) {
 VLOG_ERR("Removing port '%s' while vhost device still attached.",
  netdev->name);
 VLOG_ERR("To restore connectivity after re-adding of port, VM on 
socket"
-

Few comments inline.

On 04.08.2016 13:42, Ciara Loftus wrote:
> A new other_config DB option has been added called 'vhost-driver-mode'.
> By default this is set to 'server' which is the mode of operation OVS
> with DPDK has used up until this point - whereby OVS creates and manages
> vHost user sockets.
> 
> If set to 'client', OVS will act as the vHost client and connect to
> sockets created and managed by QEMU which acts as the server. This mode
> allows for reconnect capability, which allows vHost ports to resume
> normal connectivity in event of switch reset.
> 
> QEMU v2.7.0+ is required when using OVS in client mode and QEMU in
> server mode.
> 
> Signed-off-by: Ciara Loftus 
> ---
>  INSTALL.DPDK-ADVANCED.md | 27 +++
>  NEWS |  1 +
>  lib/netdev-dpdk.c| 28 +---
>  vswitchd/vswitch.xml | 13 +
>  4 files changed, 62 insertions(+), 7 deletions(-)
> 
> diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
> index f9587b5..a773533 100755
> --- a/INSTALL.DPDK-ADVANCED.md
> +++ b/INSTALL.DPDK-ADVANCED.md
> @@ -483,6 +483,33 @@ For users wanting to do packet forwarding using kernel 
> stack below are the steps
> where `-L`: Changes the numbers of channels of the specified network 
> device
> and `combined`: Changes the number of multi-purpose channels.
>  
> +4. Enable OVS vHost client-mode & vHost reconnect (OPTIONAL)
> +
> +   By default, OVS DPDK acts as the vHost socket server and QEMU the
> +   client. In QEMU v2.7 the option is available for QEMU to act as the
> +   server. In order for this to work, OVS DPDK must be switched to 
> 'client'
> +   mode. This is possible by setting the 'vhost-driver-mode' DB entry to
> +   'client' like so:
> +
> +   ```
> +   ovs-vsctl set Open_vSwitch . other_config:vhost-driver-mode="client"
> +   ```
> +
> +   This must be done before the switch is launched. It cannot sucessfully
> +   be changed after switch has launched.
> +
> +   One must also append ',server' to the 'chardev' arguments on the QEMU
> +   command line, to instruct QEMU to use vHost server mode, like so:
> +
> +   
> +   -chardev 
> socket,id=char0,path=/usr/local/var/run/openvswitch/vhost0,server
> +   
> +
> +   One benefit of using this mode is the ability for vHost ports to
> +   'reconnect' in event of the switch crashing or being brought down. 
> Once
> +   it is brought back up, the vHost ports will reconnect automatically 
> and
> +   normal service will resume.
> +
>- VM Configuration with libvirt
>  
>  * change the user/group, access control policty and restart libvirtd.
> diff --git a/NEWS b/NEWS
> index 9f09e1c..99412ba 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -70,6 +70,7 @@ Post-v2.5.0
> fragmentation or NAT support yet)
>   * Support for DPDK 16.07
>   * Remove dpdkvhostcuse port type.
> + * OVS client mode for vHost and vHost reconnect (Requires QEMU 2.7)
> - Increase number of registers to 16.
> - ovs-benchmark: This utility has been removed due to lack of use and
>   bitrot.
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index 7692cc8..c528cb4 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -136,7 +136,8 @@ BUILD_ASSERT_DECL((MAX_NB_MBUF / 
> ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF))
>  #define OVS_VHOST_QUEUE_DISABLED(-2) /* Queue was disabled by guest and 
> not
>* yet mapped to another queue. */
>  
> -static char *vhost_sock_dir = NULL;   /* Location of vhost-user sockets */
> +static char *vhost_sock_dir = NULL; /* Location of vhost-user sockets */
> +static uint64_t vhost_driver_flags = 0; /* Denote whether client/server mode 
> */
>  
>  #define VHOST_ENQ_RETRY_NUM 8
>  #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
> @@ -833,7 +834,6 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
>  struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
>  const char *name = 

Re: [ovs-dev] 答复: Re: 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread Ilya Maximets
On 04.08.2016 14:52, xu.binb...@zte.com.cn wrote:
> Thank you.
> 
> I saw the patch in the link: 
> http://openvswitch.org/pipermail/dev/2016-February/065556.html
> 
> But in the latest code of OVS, I can't find this path??

Did you read the whole discussion?

> By the way, should I keep the mode of 'lib/netdev-dpdk.c' file?

Definitely. But I don't think you should send second version if
you don't have very strong arguments for such solution.

> Ilya Maximets  写于 2016/08/04 19:33:58:
> 
>> 发件人:  Ilya Maximets 
>> 收件人:  xu.binb...@zte.com.cn,
>> 抄送: Ben Pfaff , dev@openvswitch.org, Heetae Ahn
>> , Dyasly Sergey 
>> 日期:  2016/08/04 19:34
>> 主题: Re: 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink
>> socket file when constructing vhostuser.
>>
>> On 04.08.2016 14:05, xu.binb...@zte.com.cn wrote:
>> > I get the source code clone from branch origin/master in the github.
>>
>> Sorry. All is OK, but you changed the mode of 'lib/netdev-dpdk.c' file.
>>
>> > In fact, I killed ovs-vswitchd process and then start it again.
>> > In this case, sockets left on the filesystem.
>>
>> That is normal. Why you using hard untrappable signals? There will be
>> no issues in normal case (even SIGTERM or SIGINT).
>>
>> There are few discussions about this in mail-list. That's an old topic.
>> Some links:
>> http://openvswitch.org/pipermail/dev/2016-February/065556.html
>> http://openvswitch.org/pipermail/dev/2016-February/065470.html
>>
>>
>> > Sorry for my description in the commit msg, it may be a puzzle to you.
>> >
>> >
>> >
>> >
>> > 发件人: Ilya Maximets 
>> > 收件人: xu.binb...@zte.com.cn, dev@openvswitch.org,
>> > 抄送:Ben Pfaff , Dyasly Sergey
>> , Heetae Ahn 
>> > 日期: 2016/08/04 18:42
>> > 主题:Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink
>> socket file when constructing vhostuser.
>> >
>> ---
 -
>>  --
>> >
>> >
>> >
>> > Oh, again...
>> >
>> > 1. This patch not for upstream version of OVS. (I guess your OVS patched
>> >   at least with vHost client support).
>> >
>> > 2. If you will restart OVS properly (even by SIGTERM or SIGINT) socket
>> >   will be removed inside 'rte_vhost_driver_unregister()' or inside
>> >   fatal_signal handler. Are you sure that it's the issue of upstream
>> >   OVS and not your local patches?
>> >
>> > 3. Segmentation fault or another hard failure is the only reason to
>> >   sockets left on the filesystem.
>> >
>> > Best regards, Ilya Maximets.
>> >
>> > On 04.08.2016 23:31, xu.binb...@zte.com.cn wrote:
>> >> Work with DPDK 16.07, a UNIX socket will be created when we
>> >> add vhostuser port. After that, the restarting of ovs-vswitchd
>> >> leads to the failure of socket binding, so the vhostuser port
>> >> can't be created successfully.
>> >>
>> >> This commit unlink socket file before creating UNIX socket to
>> >> avoid failure of socket binding.
>> >>
>> >> Signed-off-by: Binbin Xu 
>> >> ---
>> >>  lib/netdev-dpdk.c | 5 -
>> >>  1 file changed, 4 insertions(+), 1 deletion(-)
>> >>  mode change 100644 => 100755 lib/netdev-dpdk.c
>> >>
>> >> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> >> old mode 100644
>> >> new mode 100755
>> >> index aaac0d1..95cf7c3
>> >> --- a/lib/netdev-dpdk.c
>> >> +++ b/lib/netdev-dpdk.c
>> >> @@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct
>> netdev *netdev)
>> >>   */
>> >>  snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
>> >>   vhost_sock_dir, name);
>> >> -
>> >> +
>> >> +if (!(flags & RTE_VHOST_USER_CLIENT)) {
>> >> +unlink(dev->vhost_id);
>> >> +}
>> >>  err = rte_vhost_driver_register(dev->vhost_id, flags);
>> >>  if (err) {
>> >>  VLOG_ERR("vhost-user socket device setup failure for socket 
>> >> %s\n",
>> >>
>> >

[ovs-dev] Emailing: Sheet (0403).pdf

2016-08-04 Thread dev


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] 答复: Re: 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread xu . binbin1
Thank you.

I saw the patch in the link: 
http://openvswitch.org/pipermail/dev/2016-February/065556.html

But in the latest code of OVS, I can't find this path??

By the way, should I keep the mode of 'lib/netdev-dpdk.c' file?


Ilya Maximets  写于 2016/08/04 19:33:58:

> 发件人:  Ilya Maximets 
> 收件人:  xu.binb...@zte.com.cn, 
> 抄送: Ben Pfaff , dev@openvswitch.org, Heetae Ahn 
> , Dyasly Sergey 
> 日期:  2016/08/04 19:34
> 主题: Re: 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink 
> socket file when constructing vhostuser.
> 
> On 04.08.2016 14:05, xu.binb...@zte.com.cn wrote:
> > I get the source code clone from branch origin/master in the github.
> 
> Sorry. All is OK, but you changed the mode of 'lib/netdev-dpdk.c' file.
> 
> > In fact, I killed ovs-vswitchd process and then start it again.
> > In this case, sockets left on the filesystem.
> 
> That is normal. Why you using hard untrappable signals? There will be
> no issues in normal case (even SIGTERM or SIGINT).
> 
> There are few discussions about this in mail-list. That's an old topic.
> Some links:
> http://openvswitch.org/pipermail/dev/2016-February/065556.html
> http://openvswitch.org/pipermail/dev/2016-February/065470.html
> 
> 
> > Sorry for my description in the commit msg, it may be a puzzle to you.
> > 
> > 
> > 
> > 
> > 发件人: Ilya Maximets 
> > 收件人: xu.binb...@zte.com.cn, dev@openvswitch.org,
> > 抄送:Ben Pfaff , Dyasly Sergey 
> , Heetae Ahn 
> > 日期: 2016/08/04 18:42
> > 主题:Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink 
> socket file when constructing vhostuser.
> > 
> 

>  --
> > 
> > 
> > 
> > Oh, again...
> > 
> > 1. This patch not for upstream version of OVS. (I guess your OVS 
patched
> >   at least with vHost client support).
> > 
> > 2. If you will restart OVS properly (even by SIGTERM or SIGINT) socket
> >   will be removed inside 'rte_vhost_driver_unregister()' or inside
> >   fatal_signal handler. Are you sure that it's the issue of upstream
> >   OVS and not your local patches?
> > 
> > 3. Segmentation fault or another hard failure is the only reason to
> >   sockets left on the filesystem.
> > 
> > Best regards, Ilya Maximets.
> > 
> > On 04.08.2016 23:31, xu.binb...@zte.com.cn wrote:
> >> Work with DPDK 16.07, a UNIX socket will be created when we
> >> add vhostuser port. After that, the restarting of ovs-vswitchd
> >> leads to the failure of socket binding, so the vhostuser port
> >> can't be created successfully.
> >>
> >> This commit unlink socket file before creating UNIX socket to
> >> avoid failure of socket binding.
> >>
> >> Signed-off-by: Binbin Xu 
> >> ---
> >>  lib/netdev-dpdk.c | 5 -
> >>  1 file changed, 4 insertions(+), 1 deletion(-)
> >>  mode change 100644 => 100755 lib/netdev-dpdk.c
> >>
> >> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> >> old mode 100644
> >> new mode 100755
> >> index aaac0d1..95cf7c3
> >> --- a/lib/netdev-dpdk.c
> >> +++ b/lib/netdev-dpdk.c
> >> @@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct 
> netdev *netdev)
> >>   */
> >>  snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
> >>   vhost_sock_dir, name);
> >> -
> >> + 
> >> +if (!(flags & RTE_VHOST_USER_CLIENT)) {
> >> +unlink(dev->vhost_id);
> >> +}
> >>  err = rte_vhost_driver_register(dev->vhost_id, flags);
> >>  if (err) {
> >>  VLOG_ERR("vhost-user socket device setup failure for socket 
%s\n",
> >>
> > 

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] ovn-controller:improve the ofctrl_run, pinctrl_run

2016-08-04 Thread nickcooper-zhangtonghao
Before calling the function "ofctrl_run" and "pinctrl_run",
the "br-int"" has been checked. Remove the conditional statements in
the function may make the code clearer.

Signed-off-by: nickcooper-zhangtonghao 
---
 ovn/controller/ofctrl.c  | 15 +--
 ovn/controller/pinctrl.c | 16 +---
 2 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c
index 79d840d..9742e34 100644
--- a/ovn/controller/ofctrl.c
+++ b/ovn/controller/ofctrl.c
@@ -432,17 +432,12 @@ recv_S_UPDATE_FLOWS(const struct ofp_header *oh, enum 
ofptype type)
 enum mf_field_id
 ofctrl_run(const struct ovsrec_bridge *br_int)
 {
-if (br_int) {
-char *target;
-target = xasprintf("unix:%s/%s.mgmt", ovs_rundir(), br_int->name);
-if (strcmp(target, rconn_get_target(swconn))) {
-VLOG_INFO("%s: connecting to switch", target);
-rconn_connect(swconn, target, target);
-}
-free(target);
-} else {
-rconn_disconnect(swconn);
+char *target = xasprintf("unix:%s/%s.mgmt", ovs_rundir(), br_int->name);
+if (strcmp(target, rconn_get_target(swconn))) {
+VLOG_INFO("%s: connecting to switch", target);
+rconn_connect(swconn, target, target);
 }
+free(target);
 
 rconn_run(swconn);
 
diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c
index 416dad6..0377ef3 100644
--- a/ovn/controller/pinctrl.c
+++ b/ovn/controller/pinctrl.c
@@ -454,18 +454,12 @@ pinctrl_run(struct controller_ctx *ctx, const struct 
lport_index *lports,
 const char *chassis_id,
 struct hmap *local_datapaths)
 {
-if (br_int) {
-char *target;
-
-target = xasprintf("unix:%s/%s.mgmt", ovs_rundir(), br_int->name);
-if (strcmp(target, rconn_get_target(swconn))) {
-VLOG_INFO("%s: connecting to switch", target);
-rconn_connect(swconn, target, target);
-}
-free(target);
-} else {
-rconn_disconnect(swconn);
+char *target = xasprintf("unix:%s/%s.mgmt", ovs_rundir(), br_int->name);
+if (strcmp(target, rconn_get_target(swconn))) {
+VLOG_INFO("%s: connecting to switch", target);
+rconn_connect(swconn, target, target);
 }
+free(target);
 
 rconn_run(swconn);
 
-- 
1.8.3.1



___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Emailing: Document (36).tiff

2016-08-04 Thread dev


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v1] ovn: Extend Address_Set to Macros to support define port name sets

2016-08-04 Thread Russell Bryant
On Wed, Aug 3, 2016 at 6:31 PM, Ben Pfaff  wrote:

> On Wed, Aug 03, 2016 at 11:14:20PM +0800, Zong Kai LI wrote:
> > This patch aims to extend Address_Set to Macros, make it more common to
> > accept variable set, not only address. And by that, we can skinny down
> ACLs,
> > if we use Macros to defines port name sets for ACL to use, since lots of
> ACL
> > entries are similar but only "inport" and "outport" fields are different.
> >
> > Address_Set improves the performance of OVN control plane. But what more
> > important is, its implementation introduced a "$macros -- element_set"
> > mechanism, it's good way to do bunch jobs for ACLs, and even lflows.
>
> I'd prefer to defer this feature past the Open vSwitch 2.6 release.


On an earlier patch, I suggested the idea that we might want to at least
rename the table if we see that coming, even if we don't apply the rest of
the changes.  That way, we get the non-backwards compatible part out of the
way before 2.6.  What do you think?

-- 
Russell Bryant
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Emailing: Document (638).xls

2016-08-04 Thread dev


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Returned mail: Data format error

2016-08-04 Thread Mail Delivery Subsystem
The message was not delivered due to the following reason(s):

Your message could not be delivered because the destination server was
unreachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message could not be delivered within 3 days:
Host 101.85.3.197 is not responding.

The following recipients did not receive this message:


Please reply to postmas...@openvswitch.org
if you feel this message to be in error.

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread Ilya Maximets
On 04.08.2016 14:05, xu.binb...@zte.com.cn wrote:
> I get the source code clone from branch origin/master in the github.

Sorry. All is OK, but you changed the mode of 'lib/netdev-dpdk.c' file.

> In fact, I killed ovs-vswitchd process and then start it again.
> In this case, sockets left on the filesystem.

That is normal. Why you using hard untrappable signals? There will be
no issues in normal case (even SIGTERM or SIGINT).

There are few discussions about this in mail-list. That's an old topic.
Some links:
http://openvswitch.org/pipermail/dev/2016-February/065556.html
http://openvswitch.org/pipermail/dev/2016-February/065470.html


> Sorry for my description in the commit msg, it may be a puzzle to you.
> 
> 
> 
> 
> 发件人: Ilya Maximets 
> 收件人: xu.binb...@zte.com.cn, dev@openvswitch.org,
> 抄送:Ben Pfaff , Dyasly Sergey , 
> Heetae Ahn 
> 日期: 2016/08/04 18:42
> 主题:Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when 
> constructing vhostuser.
> 
 --
> 
> 
> 
> Oh, again...
> 
> 1. This patch not for upstream version of OVS. (I guess your OVS patched
>   at least with vHost client support).
> 
> 2. If you will restart OVS properly (even by SIGTERM or SIGINT) socket
>   will be removed inside 'rte_vhost_driver_unregister()' or inside
>   fatal_signal handler. Are you sure that it's the issue of upstream
>   OVS and not your local patches?
> 
> 3. Segmentation fault or another hard failure is the only reason to
>   sockets left on the filesystem.
> 
> Best regards, Ilya Maximets.
> 
> On 04.08.2016 23:31, xu.binb...@zte.com.cn wrote:
>> Work with DPDK 16.07, a UNIX socket will be created when we
>> add vhostuser port. After that, the restarting of ovs-vswitchd
>> leads to the failure of socket binding, so the vhostuser port
>> can't be created successfully.
>>
>> This commit unlink socket file before creating UNIX socket to
>> avoid failure of socket binding.
>>
>> Signed-off-by: Binbin Xu 
>> ---
>>  lib/netdev-dpdk.c | 5 -
>>  1 file changed, 4 insertions(+), 1 deletion(-)
>>  mode change 100644 => 100755 lib/netdev-dpdk.c
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> old mode 100644
>> new mode 100755
>> index aaac0d1..95cf7c3
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
>>   */
>>  snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
>>   vhost_sock_dir, name);
>> -
>> +
>> +if (!(flags & RTE_VHOST_USER_CLIENT)) {
>> +unlink(dev->vhost_id);
>> +}
>>  err = rte_vhost_driver_register(dev->vhost_id, flags);
>>  if (err) {
>>  VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
>>
> 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] 答复: Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread xu . binbin1
I get the source code clone from branch origin/master in the github. 

In fact, I killed ovs-vswitchd process and then start it again. In this 
case, sockets left on the filesystem.

Sorry for my description in the commit msg, it may be a puzzle to you.




发件人: Ilya Maximets 
收件人: xu.binb...@zte.com.cn, dev@openvswitch.org, 
抄送:   Ben Pfaff , Dyasly Sergey , 
Heetae Ahn 
日期:   2016/08/04 18:42
主题:   Re: [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when 
constructing vhostuser.



Oh, again...

1. This patch not for upstream version of OVS. (I guess your OVS patched
   at least with vHost client support).

2. If you will restart OVS properly (even by SIGTERM or SIGINT) socket
   will be removed inside 'rte_vhost_driver_unregister()' or inside
   fatal_signal handler. Are you sure that it's the issue of upstream
   OVS and not your local patches?

3. Segmentation fault or another hard failure is the only reason to
   sockets left on the filesystem.

Best regards, Ilya Maximets.

On 04.08.2016 23:31, xu.binb...@zte.com.cn wrote:
> Work with DPDK 16.07, a UNIX socket will be created when we
> add vhostuser port. After that, the restarting of ovs-vswitchd
> leads to the failure of socket binding, so the vhostuser port
> can't be created successfully.
> 
> This commit unlink socket file before creating UNIX socket to
> avoid failure of socket binding.
> 
> Signed-off-by: Binbin Xu 
> ---
>  lib/netdev-dpdk.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>  mode change 100644 => 100755 lib/netdev-dpdk.c
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> old mode 100644
> new mode 100755
> index aaac0d1..95cf7c3
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct netdev 
*netdev)
>   */
>  snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
>   vhost_sock_dir, name);
> -
> + 
> +if (!(flags & RTE_VHOST_USER_CLIENT)) {
> +unlink(dev->vhost_id);
> +}
>  err = rte_vhost_driver_register(dev->vhost_id, flags);
>  if (err) {
>  VLOG_ERR("vhost-user socket device setup failure for socket 
%s\n",
> 


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [CudaMailTagged] Bonjour

2016-08-04 Thread Françoise RABILLARD
Bonjour,

  Acceptez et tolérez cette intrusion peu décente dans votre messagerie. Je
sais que mon message sera d'une grande surprise quand t-il vous parviendra.
En effet, je suis Françoise Marcelle Clémence RABILLARD, chrétienne et j'ai
68 ans. J'ai le cœur serin vu que je suis touchée par une maladie
incurable. Selon mes dernières analyses, je suis atteinte du cancer des
voies aéro-digestives supérieures ou cancers ORL qui est à un niveau très
avancé. Ce mal a pris d’ampleur avant que je ne m'en rende compte. Depuis
la découverte, j’ai parcouru plusieurs grands pays à la recherche de remède
définitif et j’ai aussi consulté plusieurs grands médecins spécialistes du
cancer mais cela n’a pu améliorer mon état. Étant consciente de cette
affirmation, j'ai donc pris la décision d'arrêter le traitement médical vu
tout ce que j'ai déjà investi comme dépense pour ces traitements sans la
moindre amélioration. Il est vrai qu'on ne se connait pas, mais après une
longue réflexion et à travers mes prières, j'ai pris cette décision de vous
contacter. Je veux mettre à votre dis position une somme de 3 900 000 €
(Trois million neuf cent mille d'euros) que je vous offre pour réaliser un
projet qui consiste à aider les enfants de la rue, les orphelins, les
vagabonds, les handicapés, les centres d'accueil pour enfant qui sont dans
le grand besoin. Car ce sont nos œuvres qui resteront quand tombera sur
nous, le rideau de la mort. En mourant nous n'emportons aucun bien matériel
avec nous. Les prières et la foi valent beaucoup plus que l'or. Le destin
m’oriente vers vous, ce n'est pas un simple hasard. Votre destin n'est il
pas ainsi tracé par le seigneur? Toutefois, je comprendrais votre
étonnement quant à ma façon de procéder. J’ai toujours vécu dans la
solitude, je ne voudrais pas mourir en laissant cette somme au profil de la
banque ou du trésor public sans aucun bénéficiaire légitime. C’est pour
cela que je vous écris en ce jour pour vous faire part de mon œuvre, tout
en ayant conscience que nous ne nous connaissons pas.
J’apprendrai à vous connaitre et vous faire un récit complet de ma vie afin
que vous compreniez mieux. J'aimerais surtout que vous me répondiez car
c'est la  boite que je consulte le plus souvent et qui me donne l'espoir de
continuer à vivre et à retrouver le sourire qui s'est détalé de moi. Alors,
si vous êtes d'accord j'attends donc votre réponse. Veuillez prier pour moi
car je suis dans une situation critique.

Françoise RABILLARD
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] Emailing: Sheet (3424).pdf

2016-08-04 Thread dev


___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH] netdev-dpdk: add DPDK pdump capability

2016-08-04 Thread Ciara Loftus
This commit provides the ability to 'listen' on DPDK ports and save
packets to a pcap file with a DPDK app that uses the librte_pdump
library. One such app is the 'pdump' app that can be found in the DPDK
'app' directory. Instructions on how to use this can be found in
INSTALL.DPDK-ADVANCED.md

The pdump feature is optional. Should you wish to use it, pcap libraries
must to be installed on the system and the CONFIG_RTE_LIBRTE_PMD_PCAP=y
and CONFIG_RTE_LIBRTE_PDUMP=y options set in DPDK. Additionally you must
set the 'dpdk-pdump' ovs other_config DB value to 'true'.

Signed-off-by: Ciara Loftus 
---
 INSTALL.DPDK-ADVANCED.md | 30 --
 NEWS |  1 +
 acinclude.m4 | 23 +++
 lib/netdev-dpdk.c| 19 +++
 vswitchd/vswitch.xml | 12 
 5 files changed, 83 insertions(+), 2 deletions(-)

diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index c8d69ae..877824b 100755
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -12,7 +12,8 @@ OVS DPDK ADVANCED INSTALL GUIDE
 7. [QOS](#qos)
 8. [Rate Limiting](#rl)
 9. [Flow Control](#fc)
-10. [Vsperf](#vsperf)
+10. [Pdump](#pdump)
+11. [Vsperf](#vsperf)
 
 ##  1. Overview
 
@@ -862,7 +863,32 @@ respective parameter. To disable the flow control at tx 
side,
 
 `ovs-vsctl set Interface dpdk0 options:tx-flow-ctrl=false`
 
-##  10. Vsperf
+##  10. Pdump
+
+Pdump allows you to listen on DPDK ports and view the traffic that is
+passing on them. To use this utility, one must have libpcap installed
+on the system. Furthermore, DPDK must be built with CONFIG_RTE_LIBRTE_PDUMP=y
+and CONFIG_RTE_LIBRTE_PMD_PCAP=y. And finally, the following database
+value must be set before launching the switch, like so:
+
+`ovs-vsctl set Open_vSwitch . other_config:dpdk-pdump=true`
+
+To use pdump, simply launch OVS as usual. Then, navigate to the 'app/pdump'
+directory in DPDK, 'make' the application and run like so:
+
+`sudo ./build/app/dpdk_pdump -- --pdump 'port=0,queue=0,rx-dev=/tmp/rx.pcap'`
+
+The above command captures traffic received on queue 0 of port 0 and stores
+it in /tmp/rx.pcap. Other combinations of port numbers, queues numbers and
+pcap locations are of course also available to use. More information on the
+pdump app and its usage can be found in the below link.
+
+http://dpdk.org/doc/guides/sample_app_ug/pdump.html
+
+A performance decrease is expected when using a monitoring application like
+the DPDK pdump app.
+
+##  11. Vsperf
 
 Vsperf project goal is to develop vSwitch test framework that can be used to
 validate the suitability of different vSwitch implementations in a Telco 
deployment
diff --git a/NEWS b/NEWS
index c2ed71d..3f40e23 100644
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,7 @@ Post-v2.5.0
  * Basic connection tracking for the userspace datapath (no ALG,
fragmentation or NAT support yet)
  * Support for DPDK 16.07
+ * Optional support for DPDK pdump enabled.
- Increase number of registers to 16.
- ovs-benchmark: This utility has been removed due to lack of use and
  bitrot.
diff --git a/acinclude.m4 b/acinclude.m4
index f02166d..b8f1850 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -211,6 +211,29 @@ AC_DEFUN([OVS_CHECK_DPDK], [
 
 AC_SEARCH_LIBS([get_mempolicy],[numa],[],[AC_MSG_ERROR([unable to find 
libnuma, install the dependency package])])
 
+AC_COMPILE_IFELSE([
+  AC_LANG_PROGRAM(
+[
+  #include 
+#if RTE_LIBRTE_PMD_PCAP
+#error
+#endif
+], [])
+  ], [],
+  [AC_SEARCH_LIBS([pcap_dump],[pcap],[],[AC_MSG_ERROR([unable to find 
libpcap, install the dependency package])])
+   DPDK_EXTRA_LIB="-lpcap"
+   AC_COMPILE_IFELSE([
+ AC_LANG_PROGRAM(
+   [
+ #include 
+#if RTE_LIBRTE_PDUMP
+#error
+#endif
+ ], [])
+   ], [],
+   [AC_DEFINE([DPDK_PDUMP], [1], [DPDK pdump enabled in OVS.])])
+ ])
+
 # On some systems we have to add -ldl to link with dpdk
 #
 # This code, at first, tries to link without -ldl (""),
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index aaac0d1..9e4abd9 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -57,6 +57,9 @@
 #include "rte_config.h"
 #include "rte_mbuf.h"
 #include "rte_meter.h"
+#ifdef DPDK_PDUMP
+#include "rte_pdump.h"
+#endif
 #include "rte_virtio_net.h"
 
 VLOG_DEFINE_THIS_MODULE(dpdk);
@@ -3242,6 +3245,7 @@ dpdk_init__(const struct smap *ovs_other_config)
 #ifndef VHOST_CUSE
 char *sock_dir_subcomponent;
 #endif
+bool set_pdump = false;
 
 if (!smap_get_bool(ovs_other_config, "dpdk-init", false)) {
 VLOG_INFO("DPDK Disabled - to change this requires a restart.\n");
@@ -3382,6 +3386,21 @@ dpdk_init__(const struct smap *ovs_other_config)
 
 dpdk_vhost_class_init();
 
+set_pdump = smap_get_bool(ovs_other_config, "dpdk-pdump", false);
+
+if (set_pdump) {
+#ifdef DPDK_PDUMP
+

[ovs-dev] [PATCH] netdev-dpdk: Make libnuma dependencies optional

2016-08-04 Thread Ciara Loftus
Prior to this patch, OVS with DPDK required the libnuma packages to
build. This patch removes this dependency, making it only a requirement
when the CONFIG_RTE_LIBRTE_VHOST_NUMA option is detected as enabled in
the DPDK build.

Signed-off-by: Ciara Loftus 
---
 .travis.yml |  1 -
 INSTALL.DPDK-ADVANCED.md|  2 +-
 INSTALL.DPDK.md |  2 +-
 acinclude.m4| 14 --
 rhel/openvswitch-fedora.spec.in |  2 --
 5 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index a46994d..4ae6a5b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,7 +11,6 @@ addons:
 packages:
   - bc
   - gcc-multilib
-  - libnuma-dev
   - libssl-dev
   - llvm-dev
   - libjemalloc1
diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index c8d69ae..0ab43d4 100755
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -181,7 +181,7 @@ right PCIe slot.
   CONFIG_RTE_LIBRTE_VHOST_NUMA=y, vHost User ports automatically
   detect the NUMA socket of the QEMU vCPUs and will be serviced by a PMD
   from the same node provided a core on this node is enabled in the
-  pmd-cpu-mask.
+  pmd-cpu-mask. libnuma packages are required for this feature.
 
 ### 3.7 Compiler Optimizations
 
diff --git a/INSTALL.DPDK.md b/INSTALL.DPDK.md
index 0dae2ab..253d022 100644
--- a/INSTALL.DPDK.md
+++ b/INSTALL.DPDK.md
@@ -21,7 +21,7 @@ The DPDK support of Open vSwitch is considered 'experimental'.
 
 ### Prerequisites
 
-* Required: DPDK 16.07, libnuma
+* Required: DPDK 16.07
 * Hardware: [DPDK Supported NICs] when physical ports in use
 
 ##  2. Building and Installation
diff --git a/acinclude.m4 b/acinclude.m4
index f02166d..bbbad23 100644
--- a/acinclude.m4
+++ b/acinclude.m4
@@ -209,7 +209,17 @@ AC_DEFUN([OVS_CHECK_DPDK], [
   [AC_DEFINE([VHOST_CUSE], [1], [DPDK vhost-cuse support enabled, 
vhost-user disabled.])
DPDK_EXTRA_LIB="-lfuse"])
 
-AC_SEARCH_LIBS([get_mempolicy],[numa],[],[AC_MSG_ERROR([unable to find 
libnuma, install the dependency package])])
+AC_COMPILE_IFELSE([
+  AC_LANG_PROGRAM(
+[
+  #include 
+#if RTE_LIBRTE_VHOST_NUMA
+#error
+#endif
+], [])
+  ], [],
+  [AC_SEARCH_LIBS([get_mempolicy],[numa],[],[AC_MSG_ERROR([unable to find 
libnuma, install the dependency package])])
+   DPDK_EXTRA_LIB="-lnuma"])
 
 # On some systems we have to add -ldl to link with dpdk
 #
@@ -221,7 +231,7 @@ AC_DEFUN([OVS_CHECK_DPDK], [
 DPDKLIB_FOUND=false
 save_LIBS=$LIBS
 for extras in "" "-ldl"; do
-LIBS="$DPDK_LIB $extras $save_LIBS $DPDK_EXTRA_LIB -lnuma"
+LIBS="$DPDK_LIB $extras $save_LIBS $DPDK_EXTRA_LIB"
 AC_LINK_IFELSE(
[AC_LANG_PROGRAM([#include 
  #include ],
diff --git a/rhel/openvswitch-fedora.spec.in b/rhel/openvswitch-fedora.spec.in
index 34c0f37..0657e81 100644
--- a/rhel/openvswitch-fedora.spec.in
+++ b/rhel/openvswitch-fedora.spec.in
@@ -54,8 +54,6 @@ BuildRequires: libcap-ng libcap-ng-devel
 %endif
 %if %{with dpdk}
 BuildRequires: dpdk-devel >= 2.2.0
-BuildRequires: numactl-devel
-Requires: numactl-libs
 Provides: %{name}-dpdk = %{version}-%{release}
 %endif
 
-- 
2.4.3

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 1/3] netdev-dpdk: Remove dpdkvhostcuse ports

2016-08-04 Thread Ciara Loftus
This commit removes the 'dpdkvhostcuse' port type from the userspace
datapath. vhost-cuse ports are quickly becoming obsolete as the
vhost-user port type begins to support a greater feature-set thanks to
the addition of things like vhost-user multiqueue and potential
upcoming features like vhost-user client-mode and vhost-user reconnect.
The feature is also expected to be removed from DPDK soon.

One potential drawback of the removal of this support is that a
userspace vHost port type is not available in OVS for use with older
versions of QEMU (pre v2.2). Considering v2.2 is nearly two years old
this should however be a low impact change.

Signed-off-by: Ciara Loftus 
Acked-by: Flavio Leitner 
Acked-by: Daniele Di Proietto 
---
 INSTALL.DPDK-ADVANCED.md| 242 -
 NEWS|   1 +
 acinclude.m4|  12 -
 lib/netdev-dpdk.c   | 101 +---
 rhel/README.RHEL|   2 -
 rhel/etc_sysconfig_network-scripts_ifup-ovs |   7 -
 utilities/automake.mk   |   1 -
 utilities/qemu-wrap.py  | 389 
 vswitchd/vswitch.xml|  12 -
 9 files changed, 5 insertions(+), 762 deletions(-)
 delete mode 100755 utilities/qemu-wrap.py

diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index c8d69ae..f9587b5 100755
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -374,13 +374,6 @@ For users wanting to do packet forwarding using kernel 
stack below are the steps
```
 
 ##  6. Vhost Walkthrough
-
-DPDK 16.07 supports two types of vhost:
-
-1. vhost-user - enabled default
-
-2. vhost-cuse - Legacy, disabled by default
-
 ### 6.1 vhost-user
 
   - Prerequisites:
@@ -534,241 +527,6 @@ DPDK 16.07 supports two types of vhost:
 
   Note: For information on libvirt and further tuning refer [libvirt].
 
-### 6.2 vhost-cuse
-
-  - Prerequisites:
-
-QEMU version >= 2.2
-
-  - Enable vhost-cuse support
-
-1. Enable vhost cuse support in DPDK
-
-   Set `CONFIG_RTE_LIBRTE_VHOST_USER=n` in config/common_linuxapp and 
follow the
-   steps in 2.2 section of INSTALL.DPDK guide to build DPDK with cuse 
support.
-   OVS will detect that DPDK has vhost-cuse libraries compiled and in turn 
will enable
-   support for it in the switch and disable vhost-user support.
-
-2. Insert the Cuse module
-
-   `modprobe cuse`
-
-3. Build and insert the `eventfd_link` module
-
-   ```
-   cd $DPDK_DIR/lib/librte_vhost/eventfd_link/
-   make
-   insmod $DPDK_DIR/lib/librte_vhost/eventfd_link.ko
-   ```
-
-  - Adding vhost-cuse ports to Switch
-
-Unlike DPDK ring ports, DPDK vhost-cuse ports can have arbitrary names.
-For vhost-cuse, the name of the port type is `dpdkvhostcuse`
-
-```
-ovs-vsctl add-port br0 vhost-cuse-1 -- set Interface vhost-cuse-1
-type=dpdkvhostcuse
-```
-
-When attaching vhost-cuse ports to QEMU, the name provided during the
-add-port operation must match the ifname parameter on the QEMU cmd line.
-
-  - Adding vhost-cuse ports to VM
-
-vhost-cuse ports use a Linux* character device to communicate with QEMU.
-By default it is set to `/dev/vhost-net`. It is possible to reuse this
-standard device for DPDK vhost, which makes setup a little simpler but it
-is better practice to specify an alternative character device in order to
-avoid any conflicts if kernel vhost is to be used in parallel.
-
-1. This step is only needed if using an alternative character device.
-
-   ```
-   ./utilities/ovs-vsctl --no-wait set Open_vSwitch . \
-other_config:cuse-dev-name=my-vhost-net
-   ```
-
-   In the example above, the character device to be used will be
-   `/dev/my-vhost-net`.
-
-2. In case of reusing kernel vhost character device, there would be 
conflict
-   user should remove it.
-
-   `rm -rf /dev/vhost-net`
-
-3. Configure virtio-net adapters
-
-   The following parameters must be passed to the QEMU binary, repeat
-   the below parameters for multiple devices.
-
-   ```
-   -netdev tap,id=,script=no,downscript=no,ifname=,vhost=on
-   -device virtio-net-pci,netdev=net1,mac=
-   ```
-
-   The DPDK vhost library will negotiate its own features, so they
-   need not be passed in as command line params. Note that as offloads
-   are disabled this is the equivalent of setting
-
-   `csum=off,gso=off,guest_tso4=off,guest_tso6=off,guest_ecn=off`
-
-   When using an alternative character device, it must be explicitly
-   passed to QEMU using the `vhostfd` argument
-
-   ```
-   -netdev tap,id=,script=no,downscript=no,ifname=,vhost=on,
-   vhostfd= -device virtio-net-pci,netdev=net1,mac=
-   ```
-
-   

[ovs-dev] [PATCH 2/3] netdev-dpdk: Remove empty init function

2016-08-04 Thread Ciara Loftus
DPDK type ports no longer implement the netdev class 'init' function.
Set the function to NULL in NETDEV_DPDK_CLASS.

Suggested-by: Daniele Di Proietto 
Acked-by: Daniele Di Proietto 
Acked-by: Flavio Leitner 
Signed-off-by: Ciara Loftus 
---
 lib/netdev-dpdk.c | 13 ++---
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 25c1363..7692cc8 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2439,12 +2439,6 @@ dpdk_vhost_class_init(void)
 return 0;
 }
 
-static int
-dpdk_vhost_user_class_init(void)
-{
-return 0;
-}
-
 static void
 dpdk_common_init(void)
 {
@@ -2878,7 +2872,7 @@ netdev_dpdk_vhost_user_reconfigure(struct netdev *netdev)
 return err;
 }
 
-#define NETDEV_DPDK_CLASS(NAME, INIT, CONSTRUCT, DESTRUCT,\
+#define NETDEV_DPDK_CLASS(NAME, CONSTRUCT, DESTRUCT,  \
   SET_CONFIG, SET_TX_MULTIQ, SEND,\
   GET_CARRIER, GET_STATS, \
   GET_FEATURES, GET_STATUS,   \
@@ -2886,7 +2880,7 @@ netdev_dpdk_vhost_user_reconfigure(struct netdev *netdev)
 { \
 NAME, \
 true,   /* is_pmd */  \
-INIT,   /* init */\
+NULL,   /* init */\
 NULL,   /* netdev_dpdk_run */ \
 NULL,   /* netdev_dpdk_wait */\
   \
@@ -3327,7 +3321,6 @@ dpdk_init(const struct smap *ovs_other_config)
 static const struct netdev_class dpdk_class =
 NETDEV_DPDK_CLASS(
 "dpdk",
-NULL,
 netdev_dpdk_construct,
 netdev_dpdk_destruct,
 netdev_dpdk_set_config,
@@ -3343,7 +3336,6 @@ static const struct netdev_class dpdk_class =
 static const struct netdev_class dpdk_ring_class =
 NETDEV_DPDK_CLASS(
 "dpdkr",
-NULL,
 netdev_dpdk_ring_construct,
 netdev_dpdk_destruct,
 netdev_dpdk_set_config,
@@ -3359,7 +3351,6 @@ static const struct netdev_class dpdk_ring_class =
 static const struct netdev_class OVS_UNUSED dpdk_vhost_user_class =
 NETDEV_DPDK_CLASS(
 "dpdkvhostuser",
-dpdk_vhost_user_class_init,
 netdev_dpdk_vhost_user_construct,
 netdev_dpdk_vhost_destruct,
 NULL,
-- 
2.4.3

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH 3/3] netdev-dpdk: vHost client mode and reconnect

2016-08-04 Thread Ciara Loftus
A new other_config DB option has been added called 'vhost-driver-mode'.
By default this is set to 'server' which is the mode of operation OVS
with DPDK has used up until this point - whereby OVS creates and manages
vHost user sockets.

If set to 'client', OVS will act as the vHost client and connect to
sockets created and managed by QEMU which acts as the server. This mode
allows for reconnect capability, which allows vHost ports to resume
normal connectivity in event of switch reset.

QEMU v2.7.0+ is required when using OVS in client mode and QEMU in
server mode.

Signed-off-by: Ciara Loftus 
---
 INSTALL.DPDK-ADVANCED.md | 27 +++
 NEWS |  1 +
 lib/netdev-dpdk.c| 28 +---
 vswitchd/vswitch.xml | 13 +
 4 files changed, 62 insertions(+), 7 deletions(-)

diff --git a/INSTALL.DPDK-ADVANCED.md b/INSTALL.DPDK-ADVANCED.md
index f9587b5..a773533 100755
--- a/INSTALL.DPDK-ADVANCED.md
+++ b/INSTALL.DPDK-ADVANCED.md
@@ -483,6 +483,33 @@ For users wanting to do packet forwarding using kernel 
stack below are the steps
where `-L`: Changes the numbers of channels of the specified network 
device
and `combined`: Changes the number of multi-purpose channels.
 
+4. Enable OVS vHost client-mode & vHost reconnect (OPTIONAL)
+
+   By default, OVS DPDK acts as the vHost socket server and QEMU the
+   client. In QEMU v2.7 the option is available for QEMU to act as the
+   server. In order for this to work, OVS DPDK must be switched to 'client'
+   mode. This is possible by setting the 'vhost-driver-mode' DB entry to
+   'client' like so:
+
+   ```
+   ovs-vsctl set Open_vSwitch . other_config:vhost-driver-mode="client"
+   ```
+
+   This must be done before the switch is launched. It cannot sucessfully
+   be changed after switch has launched.
+
+   One must also append ',server' to the 'chardev' arguments on the QEMU
+   command line, to instruct QEMU to use vHost server mode, like so:
+
+   
+   -chardev 
socket,id=char0,path=/usr/local/var/run/openvswitch/vhost0,server
+   
+
+   One benefit of using this mode is the ability for vHost ports to
+   'reconnect' in event of the switch crashing or being brought down. Once
+   it is brought back up, the vHost ports will reconnect automatically and
+   normal service will resume.
+
   - VM Configuration with libvirt
 
 * change the user/group, access control policty and restart libvirtd.
diff --git a/NEWS b/NEWS
index 9f09e1c..99412ba 100644
--- a/NEWS
+++ b/NEWS
@@ -70,6 +70,7 @@ Post-v2.5.0
fragmentation or NAT support yet)
  * Support for DPDK 16.07
  * Remove dpdkvhostcuse port type.
+ * OVS client mode for vHost and vHost reconnect (Requires QEMU 2.7)
- Increase number of registers to 16.
- ovs-benchmark: This utility has been removed due to lack of use and
  bitrot.
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 7692cc8..c528cb4 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -136,7 +136,8 @@ BUILD_ASSERT_DECL((MAX_NB_MBUF / 
ROUND_DOWN_POW2(MAX_NB_MBUF/MIN_NB_MBUF))
 #define OVS_VHOST_QUEUE_DISABLED(-2) /* Queue was disabled by guest and not
   * yet mapped to another queue. */
 
-static char *vhost_sock_dir = NULL;   /* Location of vhost-user sockets */
+static char *vhost_sock_dir = NULL; /* Location of vhost-user sockets */
+static uint64_t vhost_driver_flags = 0; /* Denote whether client/server mode */
 
 #define VHOST_ENQ_RETRY_NUM 8
 #define IF_NAME_SZ (PATH_MAX > IFNAMSIZ ? PATH_MAX : IFNAMSIZ)
@@ -833,7 +834,6 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
 struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
 const char *name = netdev->name;
 int err;
-uint64_t flags = 0;
 
 /* 'name' is appended to 'vhost_sock_dir' and used to create a socket in
  * the file system. '/' or '\' would traverse directories, so they're not
@@ -856,14 +856,17 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
 snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
  vhost_sock_dir, name);
 
-err = rte_vhost_driver_register(dev->vhost_id, flags);
+err = rte_vhost_driver_register(dev->vhost_id, vhost_driver_flags);
 if (err) {
 VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
  dev->vhost_id);
 } else {
-fatal_signal_add_file_to_unlink(dev->vhost_id);
-VLOG_INFO("Socket %s created for vhost-user port %s\n",
-  dev->vhost_id, name);
+if (!(vhost_driver_flags & RTE_VHOST_USER_CLIENT)) {
+/* OVS server mode - OVS may delete the socket */
+fatal_signal_add_file_to_unlink(dev->vhost_id);
+VLOG_INFO("Socket %s created for vhost-user port %s\n",
+  dev->vhost_id, 

Re: [ovs-dev] [ovs-dev, CudaMailTagged] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread Ilya Maximets
Oh, again...

1. This patch not for upstream version of OVS. (I guess your OVS patched
   at least with vHost client support).

2. If you will restart OVS properly (even by SIGTERM or SIGINT) socket
   will be removed inside 'rte_vhost_driver_unregister()' or inside
   fatal_signal handler. Are you sure that it's the issue of upstream
   OVS and not your local patches?

3. Segmentation fault or another hard failure is the only reason to
   sockets left on the filesystem.

Best regards, Ilya Maximets.

On 04.08.2016 23:31, xu.binb...@zte.com.cn wrote:
> Work with DPDK 16.07, a UNIX socket will be created when we
> add vhostuser port. After that, the restarting of ovs-vswitchd
> leads to the failure of socket binding, so the vhostuser port
> can't be created successfully.
> 
> This commit unlink socket file before creating UNIX socket to
> avoid failure of socket binding.
> 
> Signed-off-by: Binbin Xu 
> ---
>  lib/netdev-dpdk.c | 5 -
>  1 file changed, 4 insertions(+), 1 deletion(-)
>  mode change 100644 => 100755 lib/netdev-dpdk.c
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> old mode 100644
> new mode 100755
> index aaac0d1..95cf7c3
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
>   */
>  snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
>   vhost_sock_dir, name);
> -
> +
> +if (!(flags & RTE_VHOST_USER_CLIENT)) {
> +unlink(dev->vhost_id);
> +}
>  err = rte_vhost_driver_register(dev->vhost_id, flags);
>  if (err) {
>  VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
> 
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [CudaMailTagged] [PATCH] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread Binbin Xu
Work with DPDK 16.07, a UNIX socket will be created when we
add vhostuser port. After that, the restarting of ovs-vswitchd
leads to the failure of socket binding, so the vhostuser port
can't be created successfully.

This commit unlink socket file before creating UNIX socket to
avoid failure of socket binding.

Signed-off-by: Binbin Xu 
---
 lib/netdev-dpdk.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 lib/netdev-dpdk.c

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
old mode 100644
new mode 100755
index aaac0d1..95cf7c3
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
  */
 snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
  vhost_sock_dir, name);
-
+
+if (!(flags & RTE_VHOST_USER_CLIENT)) {
+unlink(dev->vhost_id);
+}
 err = rte_vhost_driver_register(dev->vhost_id, flags);
 if (err) {
 VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
-- 
1.8.3.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [patch_v3] ovn: Add datapaths of interest filtering.

2016-08-04 Thread Liran Schour
"dev"  wrote on 03/08/2016 09:09:48 AM:

> From: Darrell Ball 
> To: dlu...@gmail.com, d...@openvswitch.com, b...@ovn.org
> Date: 03/08/2016 09:10 AM
> Subject: [ovs-dev] [patch_v3] ovn: Add datapaths of interest filtering.
> Sent by: "dev" 
> 
> This patch adds datapaths of interest support where only datapaths of
> local interest are monitored by the ovn-controller ovsdb client.  The
> idea is to do a flood fill in ovn-controller of datapath associations
> calculated by northd. A new column is added to the SB database
> datapath_binding table - related_datapaths to facilitate this so all
> datapaths associations are known quickly in ovn-controller.  This
> allows monitoring to adapt quickly with a single new monitor setting
> for all datapaths of interest locally.
> 
> Signed-off-by: Darrell Ball 
> ---
> 

I still think this work is mainly based on top of the conditional monitor 
work. However it introduces a flood fill in the ovn-controller using the 
new added column, related_datapaths, in the datapath_bindning table which 
is important optimization to the origin work.

Since the origin patch has went through 12 iterations and it is much more 
stable and mature (
http://openvswitch.org/pipermail/dev/2016-August/077008.html).
I propose to combine the 2 patches.

What do you think?

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [PATCH V2] netdev-dpdk: fix memory leak

2016-08-04 Thread Mark Kavanagh
DPDK v16.07 introduces the ability to free memzones.
Up until this point, DPDK memory pools created in OVS could
not be destroyed, thus incurring a memory leak.

Leverage the DPDK v16.07 rte_mempool API to free DPDK
mempools when their associated reference count reaches 0 (this
indicates that the memory pool is no longer in use).

Signed-off-by: Mark Kavanagh 
---

v2->v1: rebase to head of master, and remove 'RFC' tag

 lib/netdev-dpdk.c | 29 +++--
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index aaac0d1..ffcd35c 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -506,7 +506,7 @@ dpdk_mp_get(int socket_id, int mtu) OVS_REQUIRES(dpdk_mutex)
 }
 
 static void
-dpdk_mp_put(struct dpdk_mp *dmp)
+dpdk_mp_put(struct dpdk_mp *dmp) OVS_REQUIRES(dpdk_mutex)
 {
 
 if (!dmp) {
@@ -514,15 +514,12 @@ dpdk_mp_put(struct dpdk_mp *dmp)
 }
 
 dmp->refcount--;
-ovs_assert(dmp->refcount >= 0);
 
-#if 0
-/* I could not find any API to destroy mp. */
-if (dmp->refcount == 0) {
-list_delete(dmp->list_node);
-/* destroy mp-pool. */
-}
-#endif
+if (OVS_UNLIKELY(!dmp->refcount)) {
+ovs_list_remove(>list_node);
+rte_mempool_free(dmp->mp);
+ }
+
 }
 
 static void
@@ -928,16 +925,18 @@ netdev_dpdk_destruct(struct netdev *netdev)
 {
 struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
 
+ovs_mutex_lock(_mutex);
 ovs_mutex_lock(>mutex);
+
 rte_eth_dev_stop(dev->port_id);
 free(ovsrcu_get_protected(struct ingress_policer *,
   >ingress_policer));
-ovs_mutex_unlock(>mutex);
 
-ovs_mutex_lock(_mutex);
 rte_free(dev->tx_q);
 ovs_list_remove(>list_node);
 dpdk_mp_put(dev->dpdk_mp);
+
+ovs_mutex_unlock(>mutex);
 ovs_mutex_unlock(_mutex);
 }
 
@@ -946,6 +945,9 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev)
 {
 struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
 
+ovs_mutex_lock(_mutex);
+ovs_mutex_lock(>mutex);
+
 /* Guest becomes an orphan if still attached. */
 if (netdev_dpdk_get_vid(dev) >= 0) {
 VLOG_ERR("Removing port '%s' while vhost device still attached.",
@@ -961,15 +963,14 @@ netdev_dpdk_vhost_destruct(struct netdev *netdev)
 fatal_signal_remove_file_to_unlink(dev->vhost_id);
 }
 
-ovs_mutex_lock(>mutex);
 free(ovsrcu_get_protected(struct ingress_policer *,
   >ingress_policer));
-ovs_mutex_unlock(>mutex);
 
-ovs_mutex_lock(_mutex);
 rte_free(dev->tx_q);
 ovs_list_remove(>list_node);
 dpdk_mp_put(dev->dpdk_mp);
+
+ovs_mutex_unlock(>mutex);
 ovs_mutex_unlock(_mutex);
 }
 
-- 
1.9.3

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH V11 08/17] python tests: Skip python tests on Windows where POSIX pid is used

2016-08-04 Thread Paul Boca
Hi Guru!

Indeed there are some cases where that comment doesn’t apply.
Thanks for reporting this, I will update the comments accordingly.

Paul

From: Guru Shetty [mailto:g...@ovn.org]
Sent: Wednesday, August 3, 2016 6:51 PM
To: Paul Boca
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH V11 08/17] python tests: Skip python tests on 
Windows where POSIX pid is used



On 2 August 2016 at 10:45, Paul Boca 
> wrote:
There is a difference between POSIX pid and Windows pid, not all the time are 
equal.
On Windows when a python script is started, a sh command is triggered as the 
parent
for script. So when we try to get the daemon pid with 'echo $!', this will get 
the pid of sh
not of python.exe as expected.
Also the 'kill' command expects a POSIX pid, not the Windows pid written by the 
python
daemons in pid file.

Signed-off-by: Paul-Daniel Boca 
>
Acked-by: Alin Gabriel Serdean 
>

I applied the patches till here.
In this change, the following comment has been added for all the tests that are 
being skipped. Even those tests for which the comment is not relevant:
"Skip this test for Windows, echo $! gives shell pid instead of parent process".

So I am skipping this. Please re-look this patch.


---
V2: No changes
V3: No changes
V4: No changes
V5: No changes
V6: No changes
V7: Added comments explaining why the tests are skipped.
Enabled back the JSON-RPC tests
V8: No changes
V9: No changes
V10: No changes
V11: No changes
---
 tests/daemon-py.at | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/tests/daemon-py.at 
b/tests/daemon-py.at
index e59c11d..b1ff4fd 100644
--- a/tests/daemon-py.at
+++ b/tests/daemon-py.at
@@ -3,6 +3,8 @@ AT_BANNER([daemon unit tests - Python])
 m4_define([DAEMON_PYN],
   [AT_SETUP([daemon - $1])
AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_KEYWORDS([python daemon])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([expected])
@@ -26,6 +28,8 @@ DAEMON_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_MONITOR_PYN],
   [AT_SETUP([daemon --monitor - $1])
AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([parent])
AT_CAPTURE_FILE([parentpid])
@@ -73,6 +77,8 @@ DAEMON_MONITOR_PYN([Python3], [$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_MONITOR_RESTART_PYN],
   [AT_SETUP([daemon --monitor restart exit code - $1])
AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([parent])
AT_CAPTURE_FILE([parentpid])
@@ -120,6 +126,8 @@ DAEMON_MONITOR_RESTART_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([DAEMON_DETACH_PYN],
   [AT_SETUP([daemon --detach - $1])
AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
# Start the daemon and make sure that the pidfile exists immediately.
# We don't wait for the pidfile to get created because the daemon is
@@ -142,6 +150,8 @@ m4_define([CHECK],
 m4_define([DAEMON_DETACH_MONITOR_PYN],
   [AT_SETUP([daemon --detach --monitor - $1])
AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([daemon])
AT_CAPTURE_FILE([olddaemon])
AT_CAPTURE_FILE([newdaemon])
@@ -219,6 +229,8 @@ DAEMON_DETACH_MONITOR_ERRORS_PYN([Python3], 
[$HAVE_PYTHON3], [$PYTHON3])
 m4_define([DAEMON_DETACH_CLOSES_FDS_PYN],
   [AT_SETUP([daemon --detach closes standard fds - $1])
AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([status])
AT_CAPTURE_FILE([stderr])
@@ -243,6 +255,8 @@ DAEMON_DETACH_CLOSES_FDS_PYN([Python3], [$HAVE_PYTHON3], 
[$PYTHON3])
 m4_define([DAEMON_DETACH_MONITOR_CLOSES_FDS_PYN],
   [AT_SETUP([daemon --detach --monitor closes standard fds - $1])
AT_SKIP_IF([test $2 = no])
+   # Skip this test for Windows, echo $! gives shell pid instead of parent 
process
+   AT_SKIP_IF([test "$IS_WIN32" = "yes"])
AT_CAPTURE_FILE([pid])
AT_CAPTURE_FILE([status])
AT_CAPTURE_FILE([stderr])
--
2.7.2.windows.1
___
dev mailing list

Re: [ovs-dev] [PATCH V11 12/17] python tests: Prepare porting Python daemon on Windows

2016-08-04 Thread Paul Boca
Hi Guru!

Thanks for applying the patches so far.
I cannot see the call to ovs.daemon_windows in this patch; the calls to 
daemon_windows were added in next patch (13/17) where
the porting to windows was added.
Also daemon_unix.py has only some minor changes (comments and alignment) but I 
will include them in the commit description.

I will resend this patch after I add
[diff]
   renames = copies

Thanks,
Paul

From: Guru Shetty [mailto:g...@ovn.org]
Sent: Wednesday, August 3, 2016 7:07 PM
To: Paul Boca
Cc: dev@openvswitch.org
Subject: Re: [ovs-dev] [PATCH V11 12/17] python tests: Prepare porting Python 
daemon on Windows



On 2 August 2016 at 10:45, Paul Boca 
> wrote:
Renamed daemon.py to daemon_unix.py and implemented a wrapper over it.

Signed-off-by: Paul-Daniel Boca 
>
Acked-by: Alin Gabriel Serdean 
>

As a standalone commit, this likely fails because it calls ovs.daemon_windows 
which does not exist. I also notice that you have made additional changes in 
daemon_unix.py. Please do that as a separate commit with proper commit message.

Also, to be sure, please add the following to your .gitconfig

[diff]
   renames = copies



---
V8: Initial commit.
V9: No changes
V10: Fixed exception on Unix
V11: No changes
---
 python/automake.mk|   1 +
 python/ovs/daemon.py  | 489 ++
 python/ovs/daemon_unix.py | 530 ++
 3 files changed, 551 insertions(+), 469 deletions(-)
 create mode 100644 python/ovs/daemon_unix.py

diff --git a/python/automake.mk 
b/python/automake.mk
index 1c8fa38..4d3fcb6 100644
--- a/python/automake.mk
+++ b/python/automake.mk
@@ -11,6 +11,7 @@ ovstest_pyfiles = \
 ovs_pyfiles = \
python/ovs/__init__.py \
python/ovs/daemon.py \
+   python/ovs/daemon_unix.py \
python/ovs/fcntl_win.py \
python/ovs/db/__init__.py \
python/ovs/db/data.py \
diff --git a/python/ovs/daemon.py b/python/ovs/daemon.py
index bd06195..b1d6c36 100644
--- a/python/ovs/daemon.py
+++ b/python/ovs/daemon.py
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, 2011, 2012 Nicira, Inc.
+# Copyright (c) 2016 Cloudbase Solutions Srl
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -12,515 +12,66 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.

-import errno
-import fcntl
-import os
-import resource
-import signal
 import sys
-import time

-import ovs.dirs
-import ovs.fatal_signal
-import ovs.process
-import ovs.socket_util
-import ovs.timeval
-import ovs.util
-import ovs.vlog
+# This is only a wrapper over Linux implementations
+if sys.platform != "win32":
+import ovs.daemon_unix as daemon_util

-vlog = ovs.vlog.Vlog("daemon")
-
-# --detach: Should we run in the background?
-_detach = False
-
-# --pidfile: Name of pidfile (null if none).
-_pidfile = None
-
-# Our pidfile's inode and device, if we have created one.
-_pidfile_dev = None
-_pidfile_ino = None
-
-# --overwrite-pidfile: Create pidfile even if one already exists and is locked?
-_overwrite_pidfile = False
-
-# --no-chdir: Should we chdir to "/"?
-_chdir = True
-
-# --monitor: Should a supervisory process monitor the daemon and restart it if
-# it dies due to an error signal?
-_monitor = False
-
-# File descriptor used by daemonize_start() and daemonize_complete().
-_daemonize_fd = None
-
-RESTART_EXIT_CODE = 5
+RESTART_EXIT_CODE = daemon_util.RESTART_EXIT_CODE


 def make_pidfile_name(name):
-"""Returns the file name that would be used for a pidfile if 'name' were
-provided to set_pidfile()."""
-if name is None or name == "":
-return "%s/%s.pid" % (ovs.dirs.RUNDIR, ovs.util.PROGRAM_NAME)
-else:
-return ovs.util.abs_file_name(ovs.dirs.RUNDIR, name)
+return daemon_util.make_pidfile_name(name)


 def set_pidfile(name):
-"""Sets up a following call to daemonize() to create a pidfile named
-'name'.  If 'name' begins with '/', then it is treated as an absolute path.
-Otherwise, it is taken relative to ovs.util.RUNDIR, which is
-$(prefix)/var/run by default.
-
-If 'name' is null, then ovs.util.PROGRAM_NAME followed by ".pid" is
-used."""
-global _pidfile
-_pidfile = make_pidfile_name(name)
+daemon_util.set_pidfile(name)


 def set_no_chdir():
-"""Sets that we do not chdir to "/"."""
-global _chdir
-_chdir = False
+daemon_util.set_no_chdir()


 def ignore_existing_pidfile():
-"""Normally, daemonize() or daemonize_start() will terminate the program
-with a message if a locked pidfile already exists.  If 

Re: [ovs-dev] [PATCH] netdev-dpdk: Avoid reconfiguration on reconnection of same vhost device.

2016-08-04 Thread Ilya Maximets
On 04.08.2016 12:00, Loftus, Ciara wrote:
>>
>> Binding/unbinding of virtio driver inside VM leads to reconfiguration
>> of PMD threads. This behaviour may be abused by executing bind/unbind
>> in an infinite loop to break normal networking on all ports attached
>> to the same instance of Open vSwitch.
>>
>> Fix that by avoiding reconfiguration if it's not necessary.
>> Number of queues will not be decreased to 1 on device disconnection but
>> it's not very important in comparison with possible DOS attack from the
>> inside of guest OS.
>>
>> Fixes: 81acebdaaf27 ("netdev-dpdk: Obtain number of queues for vhost
>>   ports from attached virtio.")
>> Reported-by: Ciara Loftus 
>> Signed-off-by: Ilya Maximets 
>> ---
>>  lib/netdev-dpdk.c | 17 -
>>  1 file changed, 8 insertions(+), 9 deletions(-)
>>
>> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
>> index a0d541a..98369f1 100644
>> --- a/lib/netdev-dpdk.c
>> +++ b/lib/netdev-dpdk.c
>> @@ -2273,11 +2273,14 @@ new_device(struct virtio_net *virtio_dev)
>>  newnode = dev->socket_id;
>>  }
>>
>> -dev->requested_socket_id = newnode;
>> -dev->requested_n_rxq = qp_num;
>> -dev->requested_n_txq = qp_num;
>> -netdev_request_reconfigure(>up);
>> -
>> +if (dev->requested_n_txq != qp_num
>> +|| dev->requested_n_rxq != qp_num
>> +|| dev->requested_socket_id != newnode) {
>> +dev->requested_socket_id = newnode;
>> +dev->requested_n_rxq = qp_num;
>> +dev->requested_n_txq = qp_num;
>> +netdev_request_reconfigure(>up);
>> +}
>>  ovsrcu_set(>virtio_dev, virtio_dev);
>>  exists = true;
>>
>> @@ -2333,11 +2336,7 @@ destroy_device(volatile struct virtio_net
>> *virtio_dev)
>>  ovs_mutex_lock(>mutex);
>>  virtio_dev->flags &= ~VIRTIO_DEV_RUNNING;
>>  ovsrcu_set(>virtio_dev, NULL);
>> -/* Clear tx/rx queue settings. */
>>  netdev_dpdk_txq_map_clear(dev);
>> -dev->requested_n_rxq = NR_QUEUE;
>> -dev->requested_n_txq = NR_QUEUE;
>> -netdev_request_reconfigure(>up);
> 
> Hi Ilya,
> 
> I assume we will still poll on N queues despite the device being down?
> Do you have any data showing how this may affect performance?

No, I haven't. But it must be negligible because there will be instant
return from 'netdev_dpdk_vhost_rxq_recv()'. Anyway we're polling
queue #0 now all the time. Also, I think that the state when no driver
loaded for device should not last long.

Best regards, Ilya Maximets.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH v1] ovn: Extend Address_Set to Macros to support define port name sets

2016-08-04 Thread Zong Kai Li
On Thu, Aug 4, 2016 at 6:31 AM, Ben Pfaff  wrote:
> On Wed, Aug 03, 2016 at 11:14:20PM +0800, Zong Kai LI wrote:
>> This patch aims to extend Address_Set to Macros, make it more common to
>> accept variable set, not only address. And by that, we can skinny down ACLs,
>> if we use Macros to defines port name sets for ACL to use, since lots of ACL
>> entries are similar but only "inport" and "outport" fields are different.
>>
>> Address_Set improves the performance of OVN control plane. But what more
>> important is, its implementation introduced a "$macros -- element_set"
>> mechanism, it's good way to do bunch jobs for ACLs, and even lflows.
>
> I'd prefer to defer this feature past the Open vSwitch 2.6 release.

Sure, it's ok to defer this, that will buy me some time to fix details
and complete TODO.
"Macros" tells the name column and "$MACROS_NAME" in lflows, "Set"
tells each row in table is a set of something, like addresses and port
names. Well, "Set" seems closer to the table, I will choose it in
future version.

Thanks and have a nice day! :)
Zongkai, LI
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


Re: [ovs-dev] [PATCH] netdev-dpdk: Avoid reconfiguration on reconnection of same vhost device.

2016-08-04 Thread Loftus, Ciara
> 
> Binding/unbinding of virtio driver inside VM leads to reconfiguration
> of PMD threads. This behaviour may be abused by executing bind/unbind
> in an infinite loop to break normal networking on all ports attached
> to the same instance of Open vSwitch.
> 
> Fix that by avoiding reconfiguration if it's not necessary.
> Number of queues will not be decreased to 1 on device disconnection but
> it's not very important in comparison with possible DOS attack from the
> inside of guest OS.
> 
> Fixes: 81acebdaaf27 ("netdev-dpdk: Obtain number of queues for vhost
>   ports from attached virtio.")
> Reported-by: Ciara Loftus 
> Signed-off-by: Ilya Maximets 
> ---
>  lib/netdev-dpdk.c | 17 -
>  1 file changed, 8 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
> index a0d541a..98369f1 100644
> --- a/lib/netdev-dpdk.c
> +++ b/lib/netdev-dpdk.c
> @@ -2273,11 +2273,14 @@ new_device(struct virtio_net *virtio_dev)
>  newnode = dev->socket_id;
>  }
> 
> -dev->requested_socket_id = newnode;
> -dev->requested_n_rxq = qp_num;
> -dev->requested_n_txq = qp_num;
> -netdev_request_reconfigure(>up);
> -
> +if (dev->requested_n_txq != qp_num
> +|| dev->requested_n_rxq != qp_num
> +|| dev->requested_socket_id != newnode) {
> +dev->requested_socket_id = newnode;
> +dev->requested_n_rxq = qp_num;
> +dev->requested_n_txq = qp_num;
> +netdev_request_reconfigure(>up);
> +}
>  ovsrcu_set(>virtio_dev, virtio_dev);
>  exists = true;
> 
> @@ -2333,11 +2336,7 @@ destroy_device(volatile struct virtio_net
> *virtio_dev)
>  ovs_mutex_lock(>mutex);
>  virtio_dev->flags &= ~VIRTIO_DEV_RUNNING;
>  ovsrcu_set(>virtio_dev, NULL);
> -/* Clear tx/rx queue settings. */
>  netdev_dpdk_txq_map_clear(dev);
> -dev->requested_n_rxq = NR_QUEUE;
> -dev->requested_n_txq = NR_QUEUE;
> -netdev_request_reconfigure(>up);

Hi Ilya,

I assume we will still poll on N queues despite the device being down? Do you 
have any data showing how this may affect performance?

Thanks,
Ciara

> 
>  netdev_change_seq_changed(>up);
>  ovs_mutex_unlock(>mutex);
> --
> 2.7.4

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] I have some questions about kernel space

2016-08-04 Thread Nam Bong Ha
Hi, all

How can I look flow table of kernel space?

What does flows mean which shows when I type 'ovs-dpctl show'?

How can I measure flow table lookup time of kernel space?

How can I know flow table max size of kernel space?

Thank you.
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [CudaMailTagged] [PATCH] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread Binbin Xu
Work with DPDK 16.07, a UNIX socket will be created when we
add vhostuser port. After that, the restarting of ovs-vswitchd
leads to the failure of socket binding, so the vhostuser port
can't be created successfully.

This commit unlink socket file before creating UNIX socket to
avoid failure of socket binding.

Signed-off-by: Binbin Xu 
---
 lib/netdev-dpdk.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 lib/netdev-dpdk.c

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
old mode 100644
new mode 100755
index aaac0d1..95cf7c3
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
  */
 snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
  vhost_sock_dir, name);
-
+
+if (!(flags & RTE_VHOST_USER_CLIENT)) {
+unlink(dev->vhost_id);
+}
 err = rte_vhost_driver_register(dev->vhost_id, flags);
 if (err) {
 VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
-- 
1.8.3.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] [CudaMailTagged] [PATCH] netdev-dpdk: unlink socket file when constructing vhostuser.

2016-08-04 Thread Binbin Xu
Work with DPDK 16.07, a UNIX socket will be created when we
add vhostuser port. After that, the restarting of ovs-vswitchd
leads to the failure of socket binding, so the vhostuser port
can't be created successfully.

This commit unlink socket file before creating UNIX socket to
avoid failure of socket binding.

Signed-off-by: Binbin Xu 
---
 lib/netdev-dpdk.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)
 mode change 100644 => 100755 lib/netdev-dpdk.c

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
old mode 100644
new mode 100755
index aaac0d1..95cf7c3
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -885,7 +885,10 @@ netdev_dpdk_vhost_user_construct(struct netdev *netdev)
  */
 snprintf(dev->vhost_id, sizeof(dev->vhost_id), "%s/%s",
  vhost_sock_dir, name);
-
+
+if (!(flags & RTE_VHOST_USER_CLIENT)) {
+unlink(dev->vhost_id);
+}
 err = rte_vhost_driver_register(dev->vhost_id, flags);
 if (err) {
 VLOG_ERR("vhost-user socket device setup failure for socket %s\n",
-- 
1.8.3.1

___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev


[ovs-dev] UPS专线,欧美最火的路线,价格优美,时效稳定

2016-08-04 Thread Bright
|

欧州/重量

|

21-50KG

|

51-100KG

|

101-299KG

|

300+KG

|
|

荷兰

|

33.5

|

32.5

|

31.5

|

31

|
|

比利时/德国/卢森堡

|

34

|

32

|

31

|

30

|
|

英国

|

35

|

32

|

31

|

30

|

民海国际欧美UPS专线双清包税到门可到亚马逊仓

 

 

 

|

美国/重量

|

21-100KG

|

101-300KG

|

301-500KG

|

501-1000KG

|

1000+KG

|
|

美东(0-3)

|

28

|

25.5

|

25

|

24.5

|

24

|
|

美中(4-6)

|

27.5

|

25

|

24.5

|

24

|

23

|
|

美西(7-9)

|

26.5

|

24.5

|

24

|

23

|

21.5

|

备注:所有纺织品,皮革产品,箱包产品,鞋类,汽车室内装饰品,带电产品(必须绝缘,有开关,其他一律不接),保健产品(只接男女性用品),商检产品,带有磁性产品,(单独报关带有磁性产品单件不能低于10KG),木制品,航空箱,所有笔类,家庭道具(管制刀具不接)产品加收2/KG,3D眼镜(其他眼镜不接),手表(带电另外加收),产品加收3/KG,化妆品,硒鼓,墨盒,彩印,移动电源加收5/KG,(带磁带电二种品名在一起,需加收二种费用(2+2),其他产品正常)时效延长1-2个工作日.(清关延误不算在正常派送日内,请谅解)可单独报关,501KG以下报关费500元,501KG以上报关300元.

 

深圳市民海国际物流有限公司

Shenzhen minhai international logistics co., LTD

网址:www.minhaiwuliu.com

联系人:   梁亮/Bright

联系电话:18320766890

在线QQ:  327044034

E_MAIL:bri...@minhaiwuliu.com

地址:深圳市宝安区福永镇兴华路北创业城A栋305
___
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev