[ovs-dev] Why I can't get max line speed using ovs-dpdk and vhost-user port?

2017-11-09 Thread Sam
Hi all,

I'm using ovs-dpdk with vhost-user port and 10 VM started by qemu, topology
is:

VM1  ~  VM10
  | |
-OVS
 |
  dpdk-bond

the start command of ovs-dpdk is:

root  8969  200  0.1 107748696 231284 ?S ovs-vswitchd --dpdk -c 0x40004 -n 4 --socket-mem 10240 --proc-type
> secondary -w :01:00.0 -w :01:00.1 --
> unix:/usr/local/var/run/openvswitch/db.sock --pidfile --detach --log-file
> --mlockall --no-chdir
> --log-file=/usr/local/var/log/openvswitch/ovs-vswitchd.log
> --pidfile=/usr/local/var/run/openvswitch/ovs-vswitchd.pid --detach --monitor


qemu command is:

root 48635  0.9  0.0 3550624 94492 ?   Sl   Nov07  30:37
> /usr/local/bin/qemu-system-x86_64_2.6.0 -enable-kvm -cpu
> qemu64,+vmx,+ssse3,+sse4.1,+sse4.2,+x2apic,+aes,+avx,+vme,+pat,+ss,+pclmulqdq,+xsave,level=13
> -machine pc,accel=kvm -chardev
> socket,id=hmqmondev,port=55924,host=127.0.0.1,nodelay,server,nowait -mon
> chardev=hmqmondev,id=hmqmon,mode=readline -rtc
> base=utc,clock=host,driftfix=none -usb -device usb-tablet -daemonize
> -nodefaults -nodefconfig -no-kvm-pit-reinjection -global
> kvm-pit.lost_tick_policy=discard -vga std -k en-us -smp 8 -name
> gangyewei-35 -m 2048 -boot order=cdn -vnc :24,password -drive
> file=/opt/cloud/workspace/disks/0ce6db23-627c-475d-b7ff-36266ba9492a,if=none,id=drive_0,format=qcow2,cache=none,aio=native
> -device virtio-blk-pci,id=dev_drive_0,drive=drive_0,bus=pci.0,addr=0x5
> -drive
> file=/opt/cloud/workspace/disks/7f11a37e-28bb-4c54-b903-de2a5b28b284,if=none,id=drive_1,format=qcow2,cache=none,aio=native
> -device virtio-blk-pci,id=dev_drive_1,drive=drive_1,bus=pci.0,addr=0x6
> -drive
> file=/opt/cloud/workspace/disks/f2a7e4fb-c457-4e60-a147-18e4fadcb4dc,if=none,id=drive_2,format=qcow2,cache=none,aio=native
> -device virtio-blk-pci,id=dev_drive_2,drive=drive_2,bus=pci.0,addr=0x7
> -device ide-cd,drive=ide0-cd0,bus=ide.1,unit=1 -drive
> id=ide0-cd0,media=cdrom,if=none -chardev
> socket,id=char-n-650b42fe,path=/usr/local/var/run/openvswitch/n-650b42fe,server
> -netdev type=vhost-user,id=n-650b42fe,chardev=char-n-650b42fe,vhostforce=on
> -device
> virtio-net-pci,netdev=n-650b42fe,mac=00:22:65:0b:42:fe,id=netdev-n-650b42fe,addr=0xf
> -object memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on
> -numa node,memdev=mem -pidfile
> /opt/cloud/workspace/servers/a6d3bb5f-fc6c-4891-864c-a0d947d84867/pid
> -chardev
> socket,path=/opt/cloud/workspace/servers/a6d3bb5f-fc6c-4891-864c-a0d947d84867/qga.sock,server,nowait,id=qga0
> -device virtio-serial -device
> virtserialport,chardev=qga0,name=org.qemu.guest_agent.0


the interface between ovs-dpdk and qemu is  netdev=n-650b42fe, for ovs-dpdk
side, it's vhost-user type interface.

the dpdk-bond interface of ovs-dpdk is dpdk bond type.

Then I start 10 VM to send TCP packets using iperf3. I use 10Gbps
netdevice, but there are only about 5600Mbps through dpdk-bond port, why?
Is there someone who have testing of VM and ovs-dpdk bond port, and could
you please share the test report?
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] odp-execute: Bug Fix - missing break statement for CLONE action

2017-11-09 Thread Vishal Deep Ajmera
Adding the break statement for CLONE action case.

Signed-off-by: Vishal Deep Ajmera 
---
lib/odp-execute.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/lib/odp-execute.c b/lib/odp-execute.c
index 3011479..2d20cd5 100644
--- a/lib/odp-execute.c
+++ b/lib/odp-execute.c
@@ -800,6 +800,7 @@ odp_execute_actions(void *dp, struct dp_packet_batch 
*batch, bool steal,
  * stolen them.  */
 return;
 }
+break;
 case OVS_ACTION_ATTR_METER:
 /* Not implemented yet. */
 break;

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


[ovs-dev] [PATCH] openvswitch: add null pointer check on upcall

2017-11-09 Thread Colin King
From: Colin Ian King 

upcall may be assigned a NULL pointer as genlmsg_put can potentially
return a NULL.  Add a null check to avoid a null pointer dereference
on upcall.

Detected by CoverityScan, CID#728404 ("Dereference null return value")

Fixes: commit ccb1352e76cf ("net: Add Open vSwitch kernel components.")
Signed-off-by: Colin Ian King 
---
 net/openvswitch/datapath.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 4d38ac044cee..e8fb3d76fa6e 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -461,6 +461,10 @@ static int queue_userspace_packet(struct datapath *dp, 
struct sk_buff *skb,
 
upcall = genlmsg_put(user_skb, 0, 0, _packet_genl_family,
 0, upcall_info->cmd);
+   if (!upcall) {
+   err = -ENOBUFS;
+   goto out;
+   }
upcall->dp_ifindex = dp_ifindex;
 
err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb);
-- 
2.14.1

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


Re: [ovs-dev] [PATCH 3/2] vswitchd: Document netdev-dpdk commands.

2017-11-09 Thread Flavio Leitner

Hi Ilya,

This patch is doing two things.  If we need to revert the
mempool stuff, it will impact on everything on top of the
documentation refactoring.

I think the refactoring looks easier for Ian to get in.

I could ack just the refactoring because I haven't reviewed
the mempool change.

fbl


On Tue, 31 Oct 2017 18:18:07 +0300
Ilya Maximets  wrote:

> Signed-off-by: Ilya Maximets 
> ---
>  NEWS|  3 +++
>  lib/automake.mk |  1 +
>  lib/netdev-dpdk-unixctl.man | 13 +
>  manpages.mk |  2 ++
>  vswitchd/ovs-vswitchd.8.in  |  1 +
>  5 files changed, 20 insertions(+)
>  create mode 100644 lib/netdev-dpdk-unixctl.man
> 
> diff --git a/NEWS b/NEWS
> index 1325d31..6c09d71 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -5,6 +5,9 @@ Post-v2.8.0
> chassis "hostname" in addition to a chassis "name".
> - Linux kernel 4.13
>   * Add support for compiling OVS with the latest Linux 4.13 kernel
> +   - DPDK:
> + * New debug appctl command 'netdev-dpdk/get-mempool-info'.
> + * All the netdev-dpdk appctl commands described in ovs-vswitchd man 
> page.
>  
>  v2.8.0 - 31 Aug 2017
>  
> diff --git a/lib/automake.mk b/lib/automake.mk
> index ca1cf5d..f6a82d5 100644
> --- a/lib/automake.mk
> +++ b/lib/automake.mk
> @@ -467,6 +467,7 @@ MAN_FRAGMENTS += \
>   lib/db-ctl-base.man \
>   lib/dpctl.man \
>   lib/memory-unixctl.man \
> + lib/netdev-dpdk-unixctl.man \
>   lib/ofp-version.man \
>   lib/ovs.tmac \
>   lib/service.man \
> diff --git a/lib/netdev-dpdk-unixctl.man b/lib/netdev-dpdk-unixctl.man
> new file mode 100644
> index 000..73b2e10
> --- /dev/null
> +++ b/lib/netdev-dpdk-unixctl.man
> @@ -0,0 +1,13 @@
> +.SS "NETDEV-DPDK COMMANDS"
> +These commands manage DPDK related ports (\fItype=dpdk*\fR).
> +.IP "\fBnetdev-dpdk/set-admin-state\fR [\fIinterface\fR] \fIstate\fR"
> +Sets admin state for DPDK \fIinterface\fR (or all interfaces if none is 
> given)
> +to \fIstate\fR.  \fIstate\fR can be "up" or "down".
> +.IP "\fBnetdev-dpdk/detach\fR \fIpci-address\fR"
> +Detaches device with corresponding \fIpci-address\fR from DPDK.  This command
> +can be used to detach device if it wasn't detached automatically after port
> +deletion. Refer to the documentation for details and instructions.
> +.IP "\fBnetdev-dpdk/get-mempool-info\fR [\fIinterface\fR]"
> +Prints the debug information about memory pool used by DPDK \fIinterface\fR.
> +If called without arguments, information of all the available mempools will
> +be printed.
> diff --git a/manpages.mk b/manpages.mk
> index d610d88..c89bc45 100644
> --- a/manpages.mk
> +++ b/manpages.mk
> @@ -279,6 +279,7 @@ vswitchd/ovs-vswitchd.8: \
>   lib/daemon.man \
>   lib/dpctl.man \
>   lib/memory-unixctl.man \
> + lib/netdev-dpdk-unixctl.man \
>   lib/service.man \
>   lib/ssl-bootstrap.man \
>   lib/ssl.man \
> @@ -296,6 +297,7 @@ lib/coverage-unixctl.man:
>  lib/daemon.man:
>  lib/dpctl.man:
>  lib/memory-unixctl.man:
> +lib/netdev-dpdk-unixctl.man:
>  lib/service.man:
>  lib/ssl-bootstrap.man:
>  lib/ssl.man:
> diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
> index c18baf6..76ccfcb 100644
> --- a/vswitchd/ovs-vswitchd.8.in
> +++ b/vswitchd/ovs-vswitchd.8.in
> @@ -283,6 +283,7 @@ port names, which this thread polls.
>  .IP "\fBdpif-netdev/pmd-rxq-rebalance\fR [\fIdp\fR]"
>  Reassigns rxqs to pmds in the datapath \fIdp\fR based on their current usage.
>  .
> +.so lib/netdev-dpdk-unixctl.man
>  .so ofproto/ofproto-dpif-unixctl.man
>  .so ofproto/ofproto-unixctl.man
>  .so lib/vlog-unixctl.man



-- 
Flavio

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


Re: [ovs-dev] [PATCH] openvswitch: add null pointer check on upcall

2017-11-09 Thread Pravin Shelar
On Thu, Nov 9, 2017 at 7:29 PM, Colin King  wrote:
> From: Colin Ian King 
>
> upcall may be assigned a NULL pointer as genlmsg_put can potentially
> return a NULL.  Add a null check to avoid a null pointer dereference
> on upcall.
>
> Detected by CoverityScan, CID#728404 ("Dereference null return value")
>
> Fixes: commit ccb1352e76cf ("net: Add Open vSwitch kernel components.")
> Signed-off-by: Colin Ian King 
> ---
>  net/openvswitch/datapath.c | 4 
>  1 file changed, 4 insertions(+)
>
> diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
> index 4d38ac044cee..e8fb3d76fa6e 100644
> --- a/net/openvswitch/datapath.c
> +++ b/net/openvswitch/datapath.c
> @@ -461,6 +461,10 @@ static int queue_userspace_packet(struct datapath *dp, 
> struct sk_buff *skb,
>
> upcall = genlmsg_put(user_skb, 0, 0, _packet_genl_family,
>  0, upcall_info->cmd);
> +   if (!upcall) {
> +   err = -ENOBUFS;
> +   goto out;
> +   }
user_skb is allocated according to all required attributes, so
genlmsg_put() can not return null value.


> upcall->dp_ifindex = dp_ifindex;
>
> err = ovs_nla_put_key(key, key, OVS_PACKET_ATTR_KEY, false, user_skb);
> --
> 2.14.1
>
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH] netdev: Remove EOPNOTSUPP related comment for netdev_send().

2017-11-09 Thread Ilya Maximets
Since 57eebbb4c315, the caller must make sure that 'netdev' supports
sending. This mentioned at the start of the comment.

Fixes: 57eebbb4c315 ("dpif-netdev: Don't try to output on a device without 
txqs.")
Signed-off-by: Ilya Maximets 
---
 lib/netdev.c | 5 +
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/netdev.c b/lib/netdev.c
index 704b38f..3c6fbfa 100644
--- a/lib/netdev.c
+++ b/lib/netdev.c
@@ -784,10 +784,7 @@ netdev_get_pt_mode(const struct netdev *netdev)
  * transmission queues, so that the caller does not ordinarily have to
  * do additional queuing of packets.  'qid' specifies the queue to use
  * and can be ignored if the implementation does not support multiple
- * queues.
- *
- * Some network devices may not implement support for this function.  In such
- * cases this function will always return EOPNOTSUPP. */
+ * queues. */
 int
 netdev_send(struct netdev *netdev, int qid, struct dp_packet_batch *batch,
 bool may_steal, bool concurrent_txq)
-- 
2.7.4

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


[ovs-dev] GOD BLESS YOU!!

2017-11-09 Thread MARIA DAVIDSON
Greetings in the name of the lord.Sorry to say if i intruded into 
your privacy, l'm Mrs Maria Davidson, a born again christian, 
also .God Fearing Woman, With due respect to you my dear in 
Christ. Am here for a message from the Lord to you which will 
change the life of people round you. Am hopeless now, so i need 
some one that have fear of the lord,which i can trust will all 
what i have to tell him or her to do in the lord's works.My late 
Husband was very wealthy and Missionary after his death,i 
inherited all his business and wealth† with mine too.so once the 
doctor has advice me that i may not live for more than three 
month and am on life supporting machine for now .so i decided to 
give out all this wealth,to contribute to the development of the 
church in Africa,America,Asia and Europe.which i have prayed over 
it.So, I now decide to give all of my wealth, by contributing to 
the development of the motherless baby homes,less privileges, 
needy, poor, charity homes,widows and Cancer patient too in your 
country and i just want you to forget about the distance between 
me and you. I am willing to donate the sum of $10.000,000.00, 
which is still the major inheritance i have which my late husband 
left behind in my name . I wish you could be someone who i could 
trust with all my heart,to make this wish of mine come true 
despite the my prayers over you before i get to contact you. I 
want you to help me claim my funds from where it has been 
deposited but the question once more is CAN I TRUST YOU?I will 
appreciate you write me via email (mariad5...@gmail.com).. 



Stay Blessed.
Maria Davidson



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


[ovs-dev] [PATCH v2 7/8] nlmon: added netns support.

2017-11-09 Thread Flavio Leitner
Signed-off-by: Flavio Leitner 
---
 utilities/nlmon.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/utilities/nlmon.c b/utilities/nlmon.c
index d38a70b6f..8d9d20f97 100644
--- a/utilities/nlmon.c
+++ b/utilities/nlmon.c
@@ -41,6 +41,7 @@ main(int argc OVS_UNUSED, char *argv[])
 {
 uint64_t buf_stub[4096 / 64];
 struct nl_sock *sock;
+struct netns ns;
 struct ofpbuf buf;
 int error;
 
@@ -57,9 +58,10 @@ main(int argc OVS_UNUSED, char *argv[])
 ovs_fatal(error, "could not join RTNLGRP_LINK multicast group");
 }
 
+nl_sock_listen_all_nsid(sock, true);
 ofpbuf_use_stub(, buf_stub, sizeof buf_stub);
 for (;;) {
-error = nl_sock_recv(sock, , NULL, false);
+error = nl_sock_recv(sock, , , false);
 if (error == EAGAIN) {
 /* Nothing to do. */
 } else if (error == ENOBUFS) {
@@ -123,6 +125,11 @@ main(int argc OVS_UNUSED, char *argv[])
 }
 }
 printf("\n");
+if (netns_is_remote()) {
+printf("\tnetns id: %d\n", ns.id);
+} else {
+printf("\tnetns id: local\n");
+}
 if (attrs[IFLA_MASTER]) {
 uint32_t idx = nl_attr_get_u32(attrs[IFLA_MASTER]);
 char ifname[IFNAMSIZ];
-- 
2.13.6

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


[ovs-dev] [PATCH v2 8/8] netdev-linux: fail ops not supporting remote netns.

2017-11-09 Thread Flavio Leitner
When the netdev is in another namespace and the operation doesn't
support network namespaces, return the correct error.

Signed-off-by: Flavio Leitner 
---
 lib/netdev-linux.c | 134 +++--
 1 file changed, 120 insertions(+), 14 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index ce8df4c6b..2aee6c226 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -1342,6 +1342,11 @@ netdev_linux_send(struct netdev *netdev_, int qid 
OVS_UNUSED,
 int sock = 0;
 
 if (!is_tap_netdev(netdev_)) {
+if (netdev_linux_netns_is_remote(netdev_linux_cast(netdev_))) {
+error = EOPNOTSUPP;
+goto free_batch;
+}
+
 sock = af_packet_sock();
 if (sock < 0) {
 error = -sock;
@@ -1401,6 +1406,10 @@ netdev_linux_set_etheraddr(struct netdev *netdev_, const 
struct eth_addr mac)
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
 
 if (netdev->cache_valid & VALID_ETHERADDR) {
 error = netdev->ether_addr_error;
@@ -1514,6 +1523,11 @@ netdev_linux_set_mtu(struct netdev *netdev_, int mtu)
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 if (netdev->cache_valid & VALID_MTU) {
 error = netdev->netdev_mtu_error;
 if (error || netdev->mtu == mtu) {
@@ -1543,9 +1557,14 @@ netdev_linux_get_ifindex(const struct netdev *netdev_)
 int ifindex, error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
 error = get_ifindex(netdev_, );
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error ? -error : ifindex;
 }
 
@@ -2086,6 +2105,11 @@ netdev_linux_get_features(const struct netdev *netdev_,
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 netdev_linux_read_features(netdev);
 if (!netdev->get_features_error) {
 *current = netdev->current;
@@ -2094,8 +2118,9 @@ netdev_linux_get_features(const struct netdev *netdev_,
 *peer = 0;  /* XXX */
 }
 error = netdev->get_features_error;
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error;
 }
 
@@ -2111,6 +2136,12 @@ netdev_linux_set_advertisements(struct netdev *netdev_,
 ovs_mutex_lock(>mutex);
 
 COVERAGE_INC(netdev_get_ethtool);
+
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 memset(, 0, sizeof ecmd);
 error = netdev_linux_do_ethtool(netdev_get_name(netdev_), ,
 ETHTOOL_GSET, "ETHTOOL_GSET");
@@ -2188,6 +2219,11 @@ netdev_linux_set_policing(struct netdev *netdev_,
: kbits_burst);   /* Stick with user-specified value. */
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto out;
+}
+
 if (netdev->cache_valid & VALID_POLICING) {
 error = netdev->netdev_policing_error;
 if (error || (netdev->kbits_rate == kbits_rate &&
@@ -2324,6 +2360,11 @@ netdev_linux_get_qos(const struct netdev *netdev_,
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 error = tc_query_qdisc(netdev_);
 if (!error) {
 *typep = netdev->tc->ops->ovs_name;
@@ -2331,8 +2372,9 @@ netdev_linux_get_qos(const struct netdev *netdev_,
  ? netdev->tc->ops->qdisc_get(netdev_, details)
  : 0);
 }
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error;
 }
 
@@ -2354,6 +2396,11 @@ netdev_linux_set_qos(struct netdev *netdev_,
 }
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 error = tc_query_qdisc(netdev_);
 if (error) {
 goto exit;
@@ -2387,6 +2434,11 @@ netdev_linux_get_queue(const struct netdev *netdev_,
 int error;
 
 ovs_mutex_lock(>mutex);
+if (netdev_linux_netns_is_remote(netdev)) {
+error = EOPNOTSUPP;
+goto exit;
+}
+
 error = tc_query_qdisc(netdev_);
 if (!error) {
 struct tc_queue *queue = tc_find_queue(netdev_, queue_id);
@@ -2394,8 +2446,9 @@ netdev_linux_get_queue(const struct netdev *netdev_,
 ? netdev->tc->ops->class_get(netdev_, queue, details)
 : ENOENT);
 }
-ovs_mutex_unlock(>mutex);
 
+exit:
+ovs_mutex_unlock(>mutex);
 return error;
 }
 
@@ -2407,6 +2460,11 @@ netdev_linux_set_queue(struct netdev *netdev_,
 

Re: [ovs-dev] ovs-tcpdump error

2017-11-09 Thread Aaron Conole
Aaron Conole  writes:

> Hi Bhanu,
>
> "Bodireddy, Bhanuprakash"  writes:
>
>> Hi,
>>
>>  
>>
>> ovs-tcpdump throws the below error when trying to capture packets on one of 
>> the
>> vhostuserports.
>>
>>  
>>
>> $ ovs-tcpdump -i dpdkvhostuser0
>>
>>ERROR: Please create an interface called `midpdkvhostuser0`
>>
>> See your OS guide for how to do this.
>>
>> Ex: ip link add midpdkvhostuser0 type veth peer name midpdkvhostuser02
>>
>>  
>>
>> $ ip link add midpdkvhostuser0 type veth peer name midpdkvhostuser02
>>
>>  Error: argument "midpdkvhostuser0" is wrong: "name" too long
>>
>>  
>>
>> To get around this issue, I have to pass  ‘—mirror-to’ option as below.
>>
>>  
>>
>> $ ovs-tcpdump -i dpdkvhostuser0 -XX --mirror-to vh0
>>
>>  
>>
>> Is this due to the length of the port name?  Would be nice to fix this issue.
>
> Thanks for the detailed write up.
>
> It is related to the mirror port name length.  The mirror port is bound
> by IFNAMSIZ restriction, so it must be 15 characters + nul, and
> midpdkvhostuser0 would be 16 + nul.  This is a linux specific
> restriction, and it won't be changed because it is very much a well
> established UAPI (and changing it will have implications on code not
> able to deal with larger sized name buffers).
>
> I'm not sure how best to fix it.  My concession was the mirror-to
> option.  Perhaps there's a better way?

Hi Bhanu, I've been thinking about this a bit more.  How about something
like the following patch?

If you think it's acceptable, I'll submit it formally.

---

diff --git a/utilities/ovs-tcpdump.in b/utilities/ovs-tcpdump.in
index 6718c77..76e8a7b 100755
--- a/utilities/ovs-tcpdump.in
+++ b/utilities/ovs-tcpdump.in
@@ -18,6 +18,7 @@ import fcntl
 
 import os
 import pwd
+import random.randint
 import struct
 import subprocess
 import sys
@@ -39,6 +40,7 @@ except Exception:
 
 tapdev_fd = None
 _make_taps = {}
+_make_mirror_name = {}
 
 
 def _doexec(*args, **kwargs):
@@ -76,8 +78,16 @@ def _install_tap_linux(tap_name, mtu_value=None):
 pipe.wait()
 
 
+def _make_linux_mirror_name(interface_name):
+if interface_name.length() > 13:
+return "ovsmi%06d" % random.randint(1, 99)
+return "mi%s" % interface_name
+
+
 _make_taps['linux'] = _install_tap_linux
 _make_taps['linux2'] = _install_tap_linux
+_make_mirror_name['linux'] = _make_linux_mirror_name
+_make_mirror_name['linux2'] = _make_linux_mirror_name
 
 
 def username():
@@ -406,7 +416,7 @@ def main():
 print("TCPDUMP Args: %s" % ' '.join(tcpdargs))
 
 ovsdb = OVSDB(db_sock)
-mirror_interface = mirror_interface or "mi%s" % interface
+mirror_interface = mirror_interface or _make_mirror_name(interface)
 
 if sys.platform in _make_taps and \
mirror_interface not in netifaces.interfaces():
---
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2 2/2] OpenvSwitch logrotate: Use ctl file path as target in ovs-appctl to reset logs

2017-11-09 Thread Mark Michelson
I feel much better about this approach.

On Wed, Nov 8, 2017 at 3:00 AM  wrote:

> From: Numan Siddique 
>
> Presently, logrotate script, searches for the pid files in
> /var/log/openvswitch
> and passes the pid file name (without .pid) as target to ovs-appctl. This
> approach
> doesn't work for OVN DB servers since the ctl files are generated as
> "ovnnb_db.ctl"
> and "ovnsb_db.ctl". So search for the .ctl files instead and use them as
> target to
> ovs-appctl.
>
> Suggested-by: Ben Pfaff 
> Signed-off-by: Numan Siddique 
>
Acked-by: Mark Michelson 

> ---
>  debian/openvswitch-switch.logrotate | 6 +++---
>  rhel/etc_logrotate.d_openvswitch| 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/debian/openvswitch-switch.logrotate
> b/debian/openvswitch-switch.logrotate
> index 7752af90c..802d36566 100644
> --- a/debian/openvswitch-switch.logrotate
> +++ b/debian/openvswitch-switch.logrotate
> @@ -8,9 +8,9 @@
>  postrotate
> # Tell Open vSwitch daemons to reopen their log files
> if [ -d /var/run/openvswitch ]; then
> -   for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
> -   ovs-appctl -t "${pidfile%%.pid}" vlog/reopen 2>/dev/null
> || :
> -   done
> +for ctl in /var/run/openvswitch/*.ctl; do
> +ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
> +done
> fi
>  endscript
>  }
> diff --git a/rhel/etc_logrotate.d_openvswitch
> b/rhel/etc_logrotate.d_openvswitch
> index d93a56e51..ed7d733c9 100644
> --- a/rhel/etc_logrotate.d_openvswitch
> +++ b/rhel/etc_logrotate.d_openvswitch
> @@ -13,8 +13,8 @@
>  postrotate
>  # Tell Open vSwitch daemons to reopen their log files
>  if [ -d /var/run/openvswitch ]; then
> -for pidfile in `cd /var/run/openvswitch && echo *.pid`; do
> -ovs-appctl -t "${pidfile%%.pid}" vlog/reopen 2>/dev/null
> || :
> +for ctl in /var/run/openvswitch/*.ctl; do
> +ovs-appctl -t "$ctl" vlog/reopen 2>/dev/null || :
>  done
>  fi
>  endscript
> --
> 2.13.5
>
> ___
> dev mailing list
> d...@openvswitch.org
> https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 0/8] Add minimum network namespace support.

2017-11-09 Thread Flavio Leitner
Today Open vSwitch doesn't know about network namespaces (netns), but
users are moving internal ports to other namespaces.  Although packets
are still flowing, the daemon fails to find out basic port information,
like if it is UP or DOWN, for instance.

This patchset rely on a new kernel vport API recently accepted to find
out the new network namespace ID of a bridge's port. This information
along with the port's name recorded in the database is used to match the
corresponding netlink messages.

This patchset also leverages another kernel API that allows the daemon
to listen to all netlink messages from all netns which has an ID assigned
into it.  This and the previous change allows the userspace to track ports
in other network namespaces.

If any of the APIs aren't available, it falls back to the older APIs to
not break backwards compatibility.


Flavio Leitner (8):
  netlink: provide network namespace id from a msg.
  netdev-linux: initialize netns as invalid.
  vport: retrieve the netnsid if available.
  netdev: update device info only if netns matches.
  netdev-linux: use netlink to update netdev.
  netlink linux: enable listening to all nsids
  nlmon: added netns support.
  netdev-linux: fail ops not supporting remote netns.

 configure.ac  |   3 +-
 datapath/linux/compat/include/linux/openvswitch.h |   2 +
 lib/automake.mk   |   1 +
 lib/daemon-unix.c |   3 +-
 lib/daemon.man|   6 +-
 lib/daemon.xml|   8 +-
 lib/dpif-netlink.c|  12 +-
 lib/dpif-netlink.h|   2 +
 lib/netdev-linux.c| 314 --
 lib/netlink-notifier.c|   2 +-
 lib/netlink-protocol.h|   6 +
 lib/netlink-socket.c  |  80 +-
 lib/netlink-socket.h  |   6 +-
 lib/netns.h   | 119 
 tests/ofproto-macros.at   |   1 +
 tests/ovn-controller-vtep.at  |   1 +
 utilities/nlmon.c |   9 +-
 17 files changed, 531 insertions(+), 44 deletions(-)
 create mode 100644 lib/netns.h

-- 
2.13.6

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


[ovs-dev] [PATCH v2 3/8] vport: retrieve the netnsid if available.

2017-11-09 Thread Flavio Leitner
Recent kernels provide the network namespace ID of a port,
so use that to discover where the port currently is.

Signed-off-by: Flavio Leitner 
---
 datapath/linux/compat/include/linux/openvswitch.h |  2 ++
 lib/dpif-netlink.c|  6 ++
 lib/dpif-netlink.h|  2 ++
 lib/netdev-linux.c| 20 
 4 files changed, 30 insertions(+)

diff --git a/datapath/linux/compat/include/linux/openvswitch.h 
b/datapath/linux/compat/include/linux/openvswitch.h
index bc6c94b8d..d2712d05f 100644
--- a/datapath/linux/compat/include/linux/openvswitch.h
+++ b/datapath/linux/compat/include/linux/openvswitch.h
@@ -283,6 +283,8 @@ enum ovs_vport_attr {
/* receiving upcalls */
OVS_VPORT_ATTR_STATS,   /* struct ovs_vport_stats */
OVS_VPORT_ATTR_PAD,
+   OVS_VPORT_ATTR_IFINDEX,
+   OVS_VPORT_ATTR_NETNSID,
__OVS_VPORT_ATTR_MAX
 };
 
diff --git a/lib/dpif-netlink.c b/lib/dpif-netlink.c
index fd333094d..b85e74c50 100644
--- a/lib/dpif-netlink.c
+++ b/lib/dpif-netlink.c
@@ -3065,6 +3065,7 @@ dpif_netlink_vport_from_ofpbuf(struct dpif_netlink_vport 
*vport,
 [OVS_VPORT_ATTR_STATS] = { NL_POLICY_FOR(struct ovs_vport_stats),
.optional = true },
 [OVS_VPORT_ATTR_OPTIONS] = { .type = NL_A_NESTED, .optional = true },
+[OVS_VPORT_ATTR_NETNSID] = { .type = NL_A_U32, .optional = true },
 };
 
 dpif_netlink_vport_init(vport);
@@ -3100,6 +3101,11 @@ dpif_netlink_vport_from_ofpbuf(struct dpif_netlink_vport 
*vport,
 vport->options = nl_attr_get(a[OVS_VPORT_ATTR_OPTIONS]);
 vport->options_len = nl_attr_get_size(a[OVS_VPORT_ATTR_OPTIONS]);
 }
+if (a[OVS_VPORT_ATTR_NETNSID]) {
+netns_set_id(>netns, 
nl_attr_get_u32(a[OVS_VPORT_ATTR_NETNSID]));
+} else {
+netns_set_local(>netns);
+}
 return 0;
 }
 
diff --git a/lib/dpif-netlink.h b/lib/dpif-netlink.h
index 568b81441..680a74c2f 100644
--- a/lib/dpif-netlink.h
+++ b/lib/dpif-netlink.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include "odp-netlink.h"
+#include "netns.h"
 
 #include "flow.h"
 
@@ -32,6 +33,7 @@ struct dpif_netlink_vport {
 
 /* ovs_vport header. */
 int dp_ifindex;
+struct netns netns;
 odp_port_t port_no;/* ODPP_NONE if unknown. */
 enum ovs_vport_type type;
 
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index c31334ce1..fd181272b 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -476,6 +476,7 @@ struct netdev_linux {
 long long int miimon_interval;  /* Miimon Poll rate. Disabled if <= 0. */
 struct timer miimon_timer;
 
+struct netns netns; /* network namespace. */
 /* The following are figured out "on demand" only.  They are only valid
  * when the corresponding VALID_* bit in 'cache_valid' is set. */
 int ifindex;
@@ -571,6 +572,25 @@ netdev_rxq_linux_cast(const struct netdev_rxq *rx)
 return CONTAINER_OF(rx, struct netdev_rxq_linux, up);
 }
 
+static int
+netdev_linux_netns_update(struct netdev_linux *netdev)
+{
+struct netns *dev_netns = >netns;
+struct dpif_netlink_vport reply;
+struct ofpbuf *buf;
+int error;
+
+error = dpif_netlink_vport_get(netdev_get_name(>up), , );
+if (error) {
+netns_set_invalid(dev_netns);
+return error;
+}
+
+netns_copy(dev_netns, );
+ofpbuf_delete(buf);
+return 0;
+}
+
 static void netdev_linux_update(struct netdev_linux *netdev,
 const struct rtnetlink_change *)
 OVS_REQUIRES(netdev->mutex);
-- 
2.13.6

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


[ovs-dev] [PATCH v2 5/8] netdev-linux: use netlink to update netdev.

2017-11-09 Thread Flavio Leitner
The ioctl interface doesn't support network namespaces, so
try updating the netdev using netlink message instead.

To provide backwards compatibility, fall back to the previous
method if netlink isn't supported or fails.

Signed-off-by: Flavio Leitner 
---
 lib/netdev-linux.c | 107 +++--
 1 file changed, 104 insertions(+), 3 deletions(-)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 7a6937cc8..703e1baf9 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -86,6 +86,9 @@ COVERAGE_DEFINE(netdev_get_ethtool);
 COVERAGE_DEFINE(netdev_set_ethtool);
 
 
+#ifndef IFLA_IF_NETNSID
+#define IFLA_IF_NETNSID 0x45
+#endif
 /* These were introduced in Linux 2.6.14, so they might be missing if we have
  * old headers. */
 #ifndef ADVERTISED_Pause
@@ -615,6 +618,7 @@ netdev_linux_netns_is_eq(struct netdev_linux *netdev, 
struct netns *ns)
 return netns_eq(>netns, ns);
 }
 
+static int netdev_linux_update_via_netlink(struct netdev_linux *);
 static void netdev_linux_update(struct netdev_linux *netdev, struct netns *,
 const struct rtnetlink_change *)
 OVS_REQUIRES(netdev->mutex);
@@ -1436,6 +1440,11 @@ netdev_linux_get_etheraddr(const struct netdev *netdev_, 
struct eth_addr *mac)
 
 ovs_mutex_lock(>mutex);
 if (!(netdev->cache_valid & VALID_ETHERADDR)) {
+netdev_linux_update_via_netlink(netdev);
+}
+
+if (!(netdev->cache_valid & VALID_ETHERADDR)) {
+/* Fall back to ioctl if netlink fails */
 netdev->ether_addr_error = get_etheraddr(netdev_get_name(netdev_),
  >etheraddr);
 netdev->cache_valid |= VALID_ETHERADDR;
@@ -1456,6 +1465,11 @@ netdev_linux_get_mtu__(struct netdev_linux *netdev, int 
*mtup)
 int error;
 
 if (!(netdev->cache_valid & VALID_MTU)) {
+netdev_linux_update_via_netlink(netdev);
+}
+
+if (!(netdev->cache_valid & VALID_MTU)) {
+/* Fall back to ioctl if netlink fails */
 struct ifreq ifr;
 
 netdev->netdev_mtu_error = af_inet_ifreq_ioctl(
@@ -2868,12 +2882,21 @@ netdev_linux_update_flags(struct netdev *netdev_, enum 
netdev_flags off,
   enum netdev_flags on, enum netdev_flags *old_flagsp)
 {
 struct netdev_linux *netdev = netdev_linux_cast(netdev_);
-int error;
+int error = 0;
 
 ovs_mutex_lock(>mutex);
-error = update_flags(netdev, off, on, old_flagsp);
+if (on || off) {
+/* Changing flags over netlink isn't support yet. */
+error = update_flags(netdev, off, on, old_flagsp);
+} else {
+/* Try reading flags over netlink, or fall back to ioctl. */
+if (!netdev_linux_update_via_netlink(netdev)) {
+*old_flagsp = iff_to_nd_flags(netdev->ifi_flags);
+} else {
+error = update_flags(netdev, off, on, old_flagsp);
+}
+}
 ovs_mutex_unlock(>mutex);
-
 return error;
 }
 
@@ -5515,6 +5538,11 @@ get_ifindex(const struct netdev *netdev_, int *ifindexp)
 struct netdev_linux *netdev = netdev_linux_cast(netdev_);
 
 if (!(netdev->cache_valid & VALID_IFINDEX)) {
+netdev_linux_update_via_netlink(netdev);
+}
+
+if (!(netdev->cache_valid & VALID_IFINDEX)) {
+/* Fall back to ioctl if netlink fails */
 int ifindex = linux_get_ifindex(netdev_get_name(netdev_));
 
 if (ifindex < 0) {
@@ -5532,6 +5560,79 @@ get_ifindex(const struct netdev *netdev_, int *ifindexp)
 }
 
 static int
+netdev_linux_update_via_netlink(struct netdev_linux *netdev)
+{
+struct ofpbuf request;
+struct ofpbuf *reply;
+struct rtnetlink_change chg;
+struct rtnetlink_change *change = 
+int error;
+
+ofpbuf_init(, 0);
+nl_msg_put_nlmsghdr(,
+sizeof(struct ifinfomsg) + NL_ATTR_SIZE(IFNAMSIZ),
+RTM_GETLINK, NLM_F_REQUEST);
+ofpbuf_put_zeros(, sizeof(struct ifinfomsg));
+
+/* The correct identifiers for a Linux device are netnsid and ifindex,
+ * but ifindex changes as the port is moved to another network namespace
+ * and the interface name statically stored in ovsdb. */
+nl_msg_put_string(, IFLA_IFNAME, netdev_get_name(>up));
+if (netdev_linux_netns_is_remote(netdev)) {
+nl_msg_push_u32(, IFLA_IF_NETNSID, netdev->netns.id);
+}
+error = nl_transact(NETLINK_ROUTE, , );
+ofpbuf_uninit();
+if (error) {
+ofpbuf_delete(reply);
+return error;
+}
+
+if (rtnetlink_parse(reply, change)
+&& change->nlmsg_type == RTM_NEWLINK) {
+bool changed = false;
+error = 0;
+
+/* Update netdev from rtnl msg and increment its seq if needed. */
+if ((change->ifi_flags ^ netdev->ifi_flags) & IFF_RUNNING) {
+netdev->carrier_resets++;
+changed = true;
+}
+if (change->ifi_flags != netdev->ifi_flags) {
+

[ovs-dev] [PATCH v2 6/8] netlink linux: enable listening to all nsids

2017-11-09 Thread Flavio Leitner
Internal ports may be moved to another network namespace
and when that happens, the vswitch stops receiving netlink
notifications.

This patch enables the vswitch to listen to all network
namespaces that have a nsid assigned into the network
namespace where the socket has been opened.

It requires kernel 4.2 or newer.

Signed-off-by: Flavio Leitner 
---
 lib/daemon-unix.c|  3 ++-
 lib/daemon.man   |  6 +++---
 lib/daemon.xml   |  8 
 lib/netdev-linux.c   |  1 +
 lib/netlink-protocol.h   |  6 ++
 lib/netlink-socket.c | 27 +++
 lib/netlink-socket.h |  2 ++
 tests/ofproto-macros.at  |  1 +
 tests/ovn-controller-vtep.at |  1 +
 9 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/lib/daemon-unix.c b/lib/daemon-unix.c
index 967a28432..be6d29cbe 100644
--- a/lib/daemon-unix.c
+++ b/lib/daemon-unix.c
@@ -818,7 +818,8 @@ daemon_become_new_user_linux(bool access_datapath 
OVS_UNUSED)
 
 if (access_datapath && !ret) {
 ret = capng_update(CAPNG_ADD, cap_sets, CAP_NET_ADMIN)
-  || capng_update(CAPNG_ADD, cap_sets, CAP_NET_RAW);
+  || capng_update(CAPNG_ADD, cap_sets, CAP_NET_RAW)
+  || capng_update(CAPNG_ADD, cap_sets, CAP_NET_BROADCAST);
 }
 } else {
 ret = -1;
diff --git a/lib/daemon.man b/lib/daemon.man
index 820a09903..68c0a312d 100644
--- a/lib/daemon.man
+++ b/lib/daemon.man
@@ -76,9 +76,9 @@ started by the root user accepts this argument.
 .IP
 On Linux, daemons will be granted CAP_IPC_LOCK and CAP_NET_BIND_SERVICES
 before dropping root privileges. Daemons that interact with a datapath,
-such as \fBovs\-vswitchd\fR, will be granted two additional capabilities, 
namely
-CAP_NET_ADMIN and CAP_NET_RAW. The capability change will apply even if
-new user is "root".
+such as \fBovs\-vswitchd\fR, will be granted three additional capabilities,
+namely CAP_NET_ADMIN, CAP_NET_BROADCAST and CAP_NET_RAW.  The capability
+change will apply even if the new user is root.
 .IP
 On Windows, this option is not currently supported. For security reasons,
 specifying this option will cause the daemon process not to start.
diff --git a/lib/daemon.xml b/lib/daemon.xml
index 5cb447c49..1b5e8acae 100644
--- a/lib/daemon.xml
+++ b/lib/daemon.xml
@@ -107,10 +107,10 @@
   On Linux, daemons will be granted CAP_IPC_LOCK and
   CAP_NET_BIND_SERVICES before dropping root privileges.
   Daemons that interact with a datapath, such as
-  ovs-vswitchd, will be granted two additional
-  capabilities, namely CAP_NET_ADMIN and
-  CAP_NET_RAW.  The capability change will apply even
-  if the new user is root.
+  ovs-vswitchd, will be granted three additional
+  capabilities, namely CAP_NET_ADMIN,
+  CAP_NET_BROADCAST and CAP_NET_RAW.  The
+  capability change will apply even if the new user is root.
 
 
 
diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 703e1baf9..ce8df4c6b 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -653,6 +653,7 @@ netdev_linux_notify_sock(void)
 }
 }
 }
+nl_sock_listen_all_nsid(sock, true);
 ovsthread_once_done();
 }
 
diff --git a/lib/netlink-protocol.h b/lib/netlink-protocol.h
index a7b9a65fa..c0617dfad 100644
--- a/lib/netlink-protocol.h
+++ b/lib/netlink-protocol.h
@@ -158,6 +158,12 @@ enum {
 #define NETLINK_DROP_MEMBERSHIP 2
 #endif
 
+/* This was introduced in v4.2.  (We want our programs to support the newer
+ * kernel features even if compiled with older headers.) */
+#ifndef NETLINK_LISTEN_ALL_NSID
+#define NETLINK_LISTEN_ALL_NSID 8
+#endif
+
 /* These were introduced all together in 2.6.23.  (We want our programs to
  * support the newer kernel features even if compiled with older headers.) */
 #ifndef CTRL_ATTR_MCAST_GRP_MAX
diff --git a/lib/netlink-socket.c b/lib/netlink-socket.c
index 4e0317fbe..022b53f2d 100644
--- a/lib/netlink-socket.c
+++ b/lib/netlink-socket.c
@@ -441,6 +441,33 @@ nl_sock_join_mcgroup(struct nl_sock *sock, unsigned int 
multicast_group)
 return 0;
 }
 
+/* When 'enable' is true, it tries to enable 'sock' to receive netlink
+ * notifications form all network namespaces that have an nsid assigned
+ * into the network namespace where the socket has been opened. The
+ * running kernel needs to provide support for that. When 'enable' is
+ * false, it will receive netlink notifications only from the network
+ * namespace where the socket has been opened.
+ *
+ * Returns 0 if successful, otherwise a positive errno.  */
+int
+nl_sock_listen_all_nsid(struct nl_sock *sock, bool enable)
+{
+int error;
+int val = enable ? 1 : 0;
+
+#ifndef _WIN32
+if (setsockopt(sock->fd, SOL_NETLINK, NETLINK_LISTEN_ALL_NSID, ,
+   sizeof val) < 0) {
+error = errno;
+VLOG_INFO("netlink: could not 

[ovs-dev] [PATCH v2 2/8] netdev-linux: initialize netns as invalid.

2017-11-09 Thread Flavio Leitner
A port might be already in another netns, so initialize it
as invalid to force a state update.

Signed-off-by: Flavio Leitner 
---
 lib/netdev-linux.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c
index 184822816..c31334ce1 100644
--- a/lib/netdev-linux.c
+++ b/lib/netdev-linux.c
@@ -788,6 +788,10 @@ netdev_linux_common_construct(struct netdev *netdev_)
 return EINVAL;
 }
 
+/* The device could be in the same network namespace or in another one.
+ * Initialize as invalid to force a state update. */
+netns_set_invalid(>netns);
+
 ovs_mutex_init(>mutex);
 return 0;
 }
-- 
2.13.6

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


[ovs-dev] CFDI de Nóminas

2017-11-09 Thread Conceptos obligatorios
Actualice sus conocimientos en materia fiscal y cumpla con las disposiciones 
del SAT

CFDI de Nóminas
17 de noviembre - Mtro. David Lozada Martínez9am-8pm

La Reforma Fiscal del año 2014 trajo consigo la modificación del artículo 99 en 
su fracción III de la Ley del Impuesto sobre la Renta, señalando que quienes 
realizan pagos por salarios y conceptos asimilados, tienen la obligación de 
expedir y entregar un CFDI. Con el fin de dar cumplimiento a esta nueva 
obligación, el SAT ha dado a conocer a través de reglas de carácter general los 
pormenores para ejecutar el Complemento de Nómina V. 1.2, ya que ahora se deben 
utilizar más catálogos y llenar más campos obligatorios.

BENEFICIOS DE ASISTIR: 

1. Formas y método de pago de los CFDI.
2. Validaciones para timbrar los CFDI de nóminas.
3. Complemento de Nóminas. 
4. Llenado de los Comprobantes de Nóminas. 
5. Conceptos obligatorios y opcionales. 

¿Requiere la información a la Brevedad? responda este email con la palabra: 
CFDI + nombre - teléfono - correo.


centro telefónico:018002120744


 


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


Re: [ovs-dev] [PATCH v2] ovn: Add document describing new features in OVN added in version 2.8.

2017-11-09 Thread Ben Pfaff
On Wed, Nov 08, 2017 at 09:44:53PM +, Mark Michelson wrote:
> Hi Ben, I gave this another read and found a couple of small issues. I
> think once those are cleared up, I'll be ready to ack this.
> 
> On Tue, Nov 7, 2017 at 8:50 PM Ben Pfaff  wrote:
> 
> > This is adapted from a talk I gave at OpenStack Summit Sydney on Nov. 6.
> >
> > Signed-off-by: Ben Pfaff 
> > ---
> > v1->v2: Replace overview of OVN with reference to ovn-architecture(7).
> >   (Thanks Mark.)
> >
> >  Documentation/automake.mk |   1 +
> >  Documentation/topics/index.rst|   1 +
> >  Documentation/topics/ovn-news-2.8.rst | 281
> > ++
> >  3 files changed, 283 insertions(+)
> >  create mode 100644 Documentation/topics/ovn-news-2.8.rst
> >
> > diff --git a/Documentation/automake.mk b/Documentation/automake.mk
> > index 733da3ca9da1..3ea2c2cb5fe0 100644
> > --- a/Documentation/automake.mk
> > +++ b/Documentation/automake.mk
> > @@ -40,6 +40,7 @@ DOC_SOURCE = \
> > Documentation/topics/integration.rst \
> > Documentation/topics/language-bindings.rst \
> > Documentation/topics/openflow.rst \
> > +   Documentation/topics/ovn-news-2.8.rst \
> > Documentation/topics/ovsdb-replication.rst \
> > Documentation/topics/porting.rst \
> > Documentation/topics/role-based-access-control.rst \
> > diff --git a/Documentation/topics/index.rst
> > b/Documentation/topics/index.rst
> > index 00d6b0b837ec..13b6d8abbb30 100644
> > --- a/Documentation/topics/index.rst
> > +++ b/Documentation/topics/index.rst
> > @@ -58,6 +58,7 @@ OVN
> >
> > high-availability
> > role-based-access-control
> > +   ovn-news-2.8
> >
> >  .. list-table::
> >
> > diff --git a/Documentation/topics/ovn-news-2.8.rst
> > b/Documentation/topics/ovn-news-2.8.rst
> > new file mode 100644
> > index ..173d500ae3b7
> > --- /dev/null
> > +++ b/Documentation/topics/ovn-news-2.8.rst
> > @@ -0,0 +1,281 @@
> > +..
> > +  Licensed under the Apache License, Version 2.0 (the "License"); you
> > may
> > +  not use this file except in compliance with the License. You may
> > obtain
> > +  a copy of the License at
> > +
> > +  http://www.apache.org/licenses/LICENSE-2.0
> > +
> > +  Unless required by applicable law or agreed to in writing, software
> > +  distributed under the License is distributed on an "AS IS" BASIS,
> > WITHOUT
> > +  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> > See the
> > +  License for the specific language governing permissions and
> > limitations
> > +  under the License.
> > +
> > +  Convention for heading levels in Open vSwitch documentation:
> > +
> > +  ===  Heading 0 (reserved for the title in a document)
> > +  ---  Heading 1
> > +  ~~~  Heading 2
> > +  +++  Heading 3
> > +  '''  Heading 4
> > +
> > +  Avoid deeper levels because they do not render well.
> > +
> > +===
> > +What's New with OVS and OVN 2.8
> > +===
> > +
> > +This document is about what was added in Open vSwitch 2.8, which was
> > released
> > +at the end of August 2017, concentrating on the new features in OVN.  It
> > also
> > +covers some of what is coming up in Open vSwitch and OVN 2.9, which is
> > due to
> > +be released in February 2018.  OVN has many features, and this document
> > does
> > +not cover every new or enhanced feature (but contributions are welcome).
> > +
> > +This document assumes a basic familiarity with Open vSwitch, OVN, and
> > their
> > +associated tools.  For more information, please refer to the Open vSwitch
> > and
> > +OVN documentation, such as the ``ovn-architecture``\(7) manpage.
> >
> 
> Hm, the left parenthesis is backslash-escaped but the right is not. Is that
> a quirk of restructured text or should both be escaped?

I think that's a quirk of restructured text.  I am imitating the style I
see elsewhere in the tree.  It looks like the formatted version comes
out looking correct.

> > +Connections Between Levels
> > +~~
> > +
> > +OVN and Open vSwitch work almost like a stack of compilers: Neutron
> > +configuration is translated to OVN northbound configuration, which the OVN
> > +Neutron plugin translates to OVN southbound logical flows, which
> > ``ovn-northd``
> > +translates to OpenFlow flows, which Open vSwitch translates to datapath
> > flows.
> >
> 
> The actors in this sentence are off. ovn-northd translates the northbound
> configuration into southbound logical flows, and then ovn-controller
> translates those into openflow flows.

Oh, that's weird.  Thanks, I rewrote it.

> > +OVN has built-in support for DHCPv4 and DHCPv6.  OVN 2.8 adds small
> > +refinements.
> >
> 
> It would be good to briefly state what these small refinements are. Or if
> they're so small that they don't warrant calling out specifically in this
> 

Re: [ovs-dev] [PATCH v2] ovn: Add document describing new features in OVN added in version 2.8.

2017-11-09 Thread Mark Michelson
Looks good by me!

On Thu, Nov 9, 2017 at 4:03 PM Ben Pfaff  wrote:

> This is adapted from a talk I gave at OpenStack Summit Sydney on Nov. 6.
>
> Signed-off-by: Ben Pfaff 
>
Acked-by: Mark Michelson 

> ---
> v1->v2: Replace overview of OVN with reference to ovn-architecture(7).
>   (Thanks Mark!)
> v2->v3: Additional improvements from Mark Michelson.
>
>  Documentation/automake.mk |   1 +
>  Documentation/topics/index.rst|   1 +
>  Documentation/topics/ovn-news-2.8.rst | 278
> ++
>  3 files changed, 280 insertions(+)
>  create mode 100644 Documentation/topics/ovn-news-2.8.rst
>
> diff --git a/Documentation/automake.mk b/Documentation/automake.mk
> index 733da3ca9da1..3ea2c2cb5fe0 100644
> --- a/Documentation/automake.mk
> +++ b/Documentation/automake.mk
> @@ -40,6 +40,7 @@ DOC_SOURCE = \
> Documentation/topics/integration.rst \
> Documentation/topics/language-bindings.rst \
> Documentation/topics/openflow.rst \
> +   Documentation/topics/ovn-news-2.8.rst \
> Documentation/topics/ovsdb-replication.rst \
> Documentation/topics/porting.rst \
> Documentation/topics/role-based-access-control.rst \
> diff --git a/Documentation/topics/index.rst
> b/Documentation/topics/index.rst
> index 00d6b0b837ec..13b6d8abbb30 100644
> --- a/Documentation/topics/index.rst
> +++ b/Documentation/topics/index.rst
> @@ -58,6 +58,7 @@ OVN
>
> high-availability
> role-based-access-control
> +   ovn-news-2.8
>
>  .. list-table::
>
> diff --git a/Documentation/topics/ovn-news-2.8.rst
> b/Documentation/topics/ovn-news-2.8.rst
> new file mode 100644
> index ..fae0a4278157
> --- /dev/null
> +++ b/Documentation/topics/ovn-news-2.8.rst
> @@ -0,0 +1,278 @@
> +..
> +  Licensed under the Apache License, Version 2.0 (the "License"); you
> may
> +  not use this file except in compliance with the License. You may
> obtain
> +  a copy of the License at
> +
> +  http://www.apache.org/licenses/LICENSE-2.0
> +
> +  Unless required by applicable law or agreed to in writing, software
> +  distributed under the License is distributed on an "AS IS" BASIS,
> WITHOUT
> +  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
> See the
> +  License for the specific language governing permissions and
> limitations
> +  under the License.
> +
> +  Convention for heading levels in Open vSwitch documentation:
> +
> +  ===  Heading 0 (reserved for the title in a document)
> +  ---  Heading 1
> +  ~~~  Heading 2
> +  +++  Heading 3
> +  '''  Heading 4
> +
> +  Avoid deeper levels because they do not render well.
> +
> +===
> +What's New with OVS and OVN 2.8
> +===
> +
> +This document is about what was added in Open vSwitch 2.8, which was
> released
> +at the end of August 2017, concentrating on the new features in OVN.  It
> also
> +covers some of what is coming up in Open vSwitch and OVN 2.9, which is
> due to
> +be released in February 2018.  OVN has many features, and this document
> does
> +not cover every new or enhanced feature (but contributions are welcome).
> +
> +This document assumes a basic familiarity with Open vSwitch, OVN, and
> their
> +associated tools.  For more information, please refer to the Open vSwitch
> and
> +OVN documentation, such as the ``ovn-architecture``\(7) manpage.
> +
> +Debugging and Troubleshooting
> +-
> +
> +Before version 2.8, Open vSwitch command-line tools were far more painful
> to
> +use than they needed to be.  This section covers the improvements made to
> the
> +CLI in the 2.8 release.
> +
> +User-Hostile UUIDs
> +~~
> +
> +The OVN CLI, through ``ovn-nbctl``, ``ovn-nbctl``, and ``ovn-trace``, used
> +full-length UUIDs almost everywhere.  It didn't even provide any
> assistance
> +with completion, etc., which in practice meant always cutting and pasting
> UUIDs
> +from one command or window to another.  This problem wasn't limited to the
> +places where one would expect to have to see or use a UUID, either.  In
> many
> +places where one would expect to be able to use a network, router, or port
> +name, a UUID was required instead.  In many places where one would want
> to see
> +a name, the UUID was displayed instead.  More than anything else, these
> +shortcomings made the CLI user-hostile.
> +
> +There was an underlying problem that the southbound database didn't
> actually
> +contain all the information needed to provide a decent user interface.
> In some
> +cases, for example, the human-friendly names that one would want to use
> for
> +entities simply weren't part of the database.  These names weren't
> necessary
> +for correctness, only for usability.
> +
> +OVN 2.8 eased many of these problems.  Most parts of the CLI now allow
> the user
> 

Re: [ovs-dev] (no subject)

2017-11-09 Thread Carlos Solis Monge

Hallo, ein SPÄTERER KUNDE, DER DEN GLEICHEN LETZTEN NAMEN MIT IHNEN TEILT, 
starb Intestate mit einem nicht beanspruchten Vermögenswert. Wir möchten Sie 
für den Anspruch präsentieren.Antwort für Details
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v2] ovn: Add document describing new features in OVN added in version 2.8.

2017-11-09 Thread Ben Pfaff
Oops, this is v3, not v2, sorry about that.

On Thu, Nov 09, 2017 at 02:02:29PM -0800, Ben Pfaff wrote:
> This is adapted from a talk I gave at OpenStack Summit Sydney on Nov. 6.
> 
> Signed-off-by: Ben Pfaff 
> ---
> v1->v2: Replace overview of OVN with reference to ovn-architecture(7).
>   (Thanks Mark!)
> v2->v3: Additional improvements from Mark Michelson.
> 
>  Documentation/automake.mk |   1 +
>  Documentation/topics/index.rst|   1 +
>  Documentation/topics/ovn-news-2.8.rst | 278 
> ++
>  3 files changed, 280 insertions(+)
>  create mode 100644 Documentation/topics/ovn-news-2.8.rst
> 
> diff --git a/Documentation/automake.mk b/Documentation/automake.mk
> index 733da3ca9da1..3ea2c2cb5fe0 100644
> --- a/Documentation/automake.mk
> +++ b/Documentation/automake.mk
> @@ -40,6 +40,7 @@ DOC_SOURCE = \
>   Documentation/topics/integration.rst \
>   Documentation/topics/language-bindings.rst \
>   Documentation/topics/openflow.rst \
> + Documentation/topics/ovn-news-2.8.rst \
>   Documentation/topics/ovsdb-replication.rst \
>   Documentation/topics/porting.rst \
>   Documentation/topics/role-based-access-control.rst \
> diff --git a/Documentation/topics/index.rst b/Documentation/topics/index.rst
> index 00d6b0b837ec..13b6d8abbb30 100644
> --- a/Documentation/topics/index.rst
> +++ b/Documentation/topics/index.rst
> @@ -58,6 +58,7 @@ OVN
>  
> high-availability
> role-based-access-control
> +   ovn-news-2.8
>  
>  .. list-table::
>  
> diff --git a/Documentation/topics/ovn-news-2.8.rst 
> b/Documentation/topics/ovn-news-2.8.rst
> new file mode 100644
> index ..fae0a4278157
> --- /dev/null
> +++ b/Documentation/topics/ovn-news-2.8.rst
> @@ -0,0 +1,278 @@
> +..
> +  Licensed under the Apache License, Version 2.0 (the "License"); you may
> +  not use this file except in compliance with the License. You may obtain
> +  a copy of the License at
> +
> +  http://www.apache.org/licenses/LICENSE-2.0
> +
> +  Unless required by applicable law or agreed to in writing, software
> +  distributed under the License is distributed on an "AS IS" BASIS, 
> WITHOUT
> +  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See 
> the
> +  License for the specific language governing permissions and limitations
> +  under the License.
> +
> +  Convention for heading levels in Open vSwitch documentation:
> +
> +  ===  Heading 0 (reserved for the title in a document)
> +  ---  Heading 1
> +  ~~~  Heading 2
> +  +++  Heading 3
> +  '''  Heading 4
> +
> +  Avoid deeper levels because they do not render well.
> +
> +===
> +What's New with OVS and OVN 2.8
> +===
> +
> +This document is about what was added in Open vSwitch 2.8, which was released
> +at the end of August 2017, concentrating on the new features in OVN.  It also
> +covers some of what is coming up in Open vSwitch and OVN 2.9, which is due to
> +be released in February 2018.  OVN has many features, and this document does
> +not cover every new or enhanced feature (but contributions are welcome).
> +
> +This document assumes a basic familiarity with Open vSwitch, OVN, and their
> +associated tools.  For more information, please refer to the Open vSwitch and
> +OVN documentation, such as the ``ovn-architecture``\(7) manpage.
> +
> +Debugging and Troubleshooting
> +-
> +
> +Before version 2.8, Open vSwitch command-line tools were far more painful to
> +use than they needed to be.  This section covers the improvements made to the
> +CLI in the 2.8 release.
> +
> +User-Hostile UUIDs
> +~~
> +
> +The OVN CLI, through ``ovn-nbctl``, ``ovn-nbctl``, and ``ovn-trace``, used
> +full-length UUIDs almost everywhere.  It didn't even provide any assistance
> +with completion, etc., which in practice meant always cutting and pasting 
> UUIDs
> +from one command or window to another.  This problem wasn't limited to the
> +places where one would expect to have to see or use a UUID, either.  In many
> +places where one would expect to be able to use a network, router, or port
> +name, a UUID was required instead.  In many places where one would want to 
> see
> +a name, the UUID was displayed instead.  More than anything else, these
> +shortcomings made the CLI user-hostile.
> +
> +There was an underlying problem that the southbound database didn't actually
> +contain all the information needed to provide a decent user interface.  In 
> some
> +cases, for example, the human-friendly names that one would want to use for
> +entities simply weren't part of the database.  These names weren't necessary
> +for correctness, only for usability.
> +
> +OVN 2.8 eased many of these problems.  Most parts of the CLI now allow the 
> user
> +to abbreviate UUIDs, as long as the abbreviations are 

Re: [ovs-dev] [PATCH] netdev: Remove EOPNOTSUPP related comment for netdev_send().

2017-11-09 Thread Ben Pfaff
On Fri, Nov 10, 2017 at 06:02:17AM +0900, Gregory Rose wrote:
> 
> On 11/9/2017 9:34 PM, Ilya Maximets wrote:
> >Since 57eebbb4c315, the caller must make sure that 'netdev' supports
> >sending. This mentioned at the start of the comment.
> >
> >Fixes: 57eebbb4c315 ("dpif-netdev: Don't try to output on a device without 
> >txqs.")
> >Signed-off-by: Ilya Maximets 
> >---
> >  lib/netdev.c | 5 +
> >  1 file changed, 1 insertion(+), 4 deletions(-)
> >
> >diff --git a/lib/netdev.c b/lib/netdev.c
> >index 704b38f..3c6fbfa 100644
> >--- a/lib/netdev.c
> >+++ b/lib/netdev.c
> >@@ -784,10 +784,7 @@ netdev_get_pt_mode(const struct netdev *netdev)
> >   * transmission queues, so that the caller does not ordinarily have to
> >   * do additional queuing of packets.  'qid' specifies the queue to use
> >   * and can be ignored if the implementation does not support multiple
> >- * queues.
> >- *
> >- * Some network devices may not implement support for this function.  In 
> >such
> >- * cases this function will always return EOPNOTSUPP. */
> >+ * queues. */
> >  int
> >  netdev_send(struct netdev *netdev, int qid, struct dp_packet_batch *batch,
> >  bool may_steal, bool concurrent_txq)
> 
> Right.
> 
> Reviewed-by: Greg Rose 

Thanks Ilya and Greg, I applied this to master.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] Gastos de Viaje - En línea

2017-11-09 Thread Gastos que pueden Deducirse
En línea y en Vivo / Para todo su Equipo con una sola Conexión 

Gastos de Viaje, Viáticos y su Régimen Fiscal
17 de noviembre - Online en Vivo - 10:00 a 13:00 y de 15:00 a 18:00 Hrs
 
Asista a esta completa capacitación y aprenda cuáles son los requisitos 
fiscales que deben cumplirse para que los gastos de viaje puedan ser deducibles 
y estén exentos en el ISR. Además, conocerá los elementos para que en función 
de lo fiscal defina las “Políticas corporativas de gastos de viaje” que debe 
adoptar su empresa para un fácil manejo fiscal y administrativo. 


TEMARIO:

1. Gastos de viaje y viáticos.
2. Requisitos para deducir gastos de viaje.
3. Gastos que pueden deducirse y sus límites.
4. Requisitos para deducir y acreditar gastos de viaje y viáticos.

...¡Y mucho más!

¿Requiere la información a la Brevedad?
responda este email con la palabra: 
Viáticos.

Junto con los siguientes datos:
Nombre:
Empresa:
Teléfono:
centro telefónico: 018002129393
 

Lic. María Canul
Coordinador de Evento

¿Demasiados mensajes en su cuenta? Responda este mensaje indicando que solo 
desea recibir CALENDARIO y sólo recibirá un correo al mes. Si desea cancelar la 
suscripción, solicite su BAJA. 


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


[ovs-dev] [PATCH 2/2] Adding configuration option to whitelist DPDK physical ports.

2017-11-09 Thread Sugesh Chandran
Adding a OVS configuration option to whitelist DPDK physical ports. By default
running multiple instances of DPDK on a single platform cannot use physical
ports at the same time even though they are distinct.

The eal init scans all the ports that are bound to DPDK and initialize the
drivers accordingly. This happens for every DPDK process init.
On a multi instance deployment usecase, it causes issues for using physical
NIC ports.
Consider a two DPDK process that are running on a single platform,
the second DPDK primary process will try to initialize the drivers for all the
physical ports even though it may be used in first DPDK process.

To avoid this situation user can whitelist the ports for each DPDK application.
Whitelisting of ports/PCI-ID in a DPDK process will limit the eal-init only on
those ports.

To whitelist two physical ports ":06:00.0" and ":06:00.1", the
configuration option in OVS would be
  ovs-vsctl  set Open_vSwitch . 
other_config:dpdk-whitelist-pci-ids=":06:00.0,:06:00.1"

To update the whitelist ports, OVS daemon has to be restarted.

Signed-off-by: Sugesh Chandran 
---
 lib/dpdk.c   | 29 +
 vswitchd/vswitch.xml | 21 +
 2 files changed, 50 insertions(+)

diff --git a/lib/dpdk.c b/lib/dpdk.c
index 9d187c7..0f11977 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -323,6 +323,34 @@ dpdk_isolate_rte_mem_config(const struct smap 
*ovs_other_config,
 }
 
 static void
+dpdk_whitelist_pci_ids(const struct smap *ovs_other_config, char ***argv,
+   int *argc)
+{
+const char *pci_ids;
+char *pci_dev;
+int len;
+int i;
+pci_ids = smap_get(ovs_other_config, "dpdk-whitelist-pci-ids");
+if (!pci_ids) {
+return;
+}
+len = strlen(pci_ids);
+do {
+i = strcspn(pci_ids, ",");
+pci_dev = xmemdup0(pci_ids, i);
+if (!strlen(pci_dev)) {
+ break;
+}
+*argv = grow_argv(argv, *argc, 2);
+(*argv)[(*argc)++] = xstrdup("-w");
+(*argv)[(*argc)++] = pci_dev;
+i++;
+pci_ids += i;
+len -= i;
+} while (pci_ids && len > 0);
+}
+
+static void
 dpdk_init__(const struct smap *ovs_other_config)
 {
 char **argv = NULL, **argv_to_release = NULL;
@@ -409,6 +437,7 @@ dpdk_init__(const struct smap *ovs_other_config)
 }
 
 dpdk_isolate_rte_mem_config(ovs_other_config, , );
+dpdk_whitelist_pci_ids(ovs_other_config, , );
 argv = grow_argv(, argc, 1);
 argv[argc] = NULL;
 
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index 7462b30..0b64b25 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -442,6 +442,27 @@
 
   
 
+  
+
+  Specifies list of pci-ids separated by , for whitelisting available
+  physical NIC ports in OVS. The option valid only when DPDK is enabled
+  in OVS and the ports are already bound to DPDK userspace driver.
+
+
+  By default, all the DPDK bound ports are initialized at the time of
+  vswitchd start. Whitelisting a list of pci-ids is used to limit the
+  initialization only to specific ports. Changing this value requires
+  restarting the daemon.
+
+
+ This option allow user to run multiple instance of DPDK including
+ vswitchd simultaneously by exclusively allocating the physical NIC
+ ports between them. Its impossible to use the NIC ports in
+ multiple primary DPDK processes without whitelisting them
+ even the application is using distinct ports.
+
+  
+
 
 
 
-- 
2.7.4

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


[ovs-dev] [PATCH 1/2] Adding DPDK configuration option to isolate rte-mempool allocation.

2017-11-09 Thread Sugesh Chandran
DPDK allocate memory regions at the time of vswitchd init. To run multiple
primary instance of DPDK including OVS on a single platform, the memory map
regions in the filesystem should be distinct.

The new configuration option let user to enable the memory isolation in need.
By default, OVS uses default dpdk memory regions.

To isolate the memory regions, DPDK prefix the memory map files with user
input string. This implementation uses the pid of vswitchd process as a memory
map prefix, because its unique in the platform.

For eg: a vswitchd process with pid '1234A' create memory map regions with
prefix 'ovs-1234A-' in the filesystem.

The following configuration option is used to enable the feature and changing
this value requires restarting the daemon.

 ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-isolate-mem=true

Signed-off-by: Sugesh Chandran 
---
 lib/dpdk.c   | 21 +
 vswitchd/vswitch.xml | 23 +++
 2 files changed, 44 insertions(+)

diff --git a/lib/dpdk.c b/lib/dpdk.c
index 8da6c32..9d187c7 100644
--- a/lib/dpdk.c
+++ b/lib/dpdk.c
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -302,6 +303,25 @@ static cookie_io_functions_t dpdk_log_func = {
 .write = dpdk_log_write,
 };
 
+/*
+ * Isolate the dpdk rte_memory pool for the vswitch process.
+ * The isolation is achieved by using a specific prefix for rte memory maps.
+ * the prefix is created from the pid of the vswitchd. This allows to run
+ * multiple ovs-dpdk instance on same platform in need.
+ */
+static void
+dpdk_isolate_rte_mem_config(const struct smap *ovs_other_config,
+char ***argv, int *argc)
+{
+if (smap_get_bool(ovs_other_config, "dpdk-isolate-mem", false)) {
+pid_t pid;
+pid = getpid();
+*argv = grow_argv(argv, *argc, 2);
+(*argv)[(*argc)++] = xstrdup("--file-prefix");
+(*argv)[(*argc)++] = xasprintf("%s-%lX-", "ovs", (long int)pid);
+}
+}
+
 static void
 dpdk_init__(const struct smap *ovs_other_config)
 {
@@ -388,6 +408,7 @@ dpdk_init__(const struct smap *ovs_other_config)
 }
 }
 
+dpdk_isolate_rte_mem_config(ovs_other_config, , );
 argv = grow_argv(, argc, 1);
 argv[argc] = NULL;
 
diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml
index c145e1a..7462b30 100644
--- a/vswitchd/vswitch.xml
+++ b/vswitchd/vswitch.xml
@@ -419,6 +419,29 @@
   VLAN.
 
   
+
+  
+
+  Set this value to true to isolate DPDK rte mempool at
+  the time of allocation. The option is valid only when DPDK is enabled
+  in OVS.
+
+
+  The default value is false. Changing this value requires
+  restarting the daemon.
+
+
+  The rte_mempool map is created at the time of vswitchd init and its
+  been used by all DPDK processes including vswitchd in the platform.
+  dpdk-isolate-mem option let vswitchd to use a separate
+  memory region than other processes for isolation. The separate
+  memory region map are prefixed by ovs-pid
+  in the filesystem. pid is the process id of vswitchd
+  process.
+
+  
+
 
 
 
-- 
2.7.4

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


[ovs-dev] [PATCH 0/2] Adding ovs configuration options to run multiple DPDK instances on a single platform.

2017-11-09 Thread Sugesh Chandran
The current OVS-DPDK implementation doesnt allow users to run another DPDK
application simultaneously on the same platform.

To avoid this limitation, the patch series offers two configuration options
to isolate the OVS-DPDK process completely on a platform.

1) The configuration option is added to isolate the DPDK memory allocation in
need. This option allocate and use a seperate DPDK memory pool region for OVS,
instead of standard DPDK memory pool.

2) Configuration option to whitelist the ports that are going to use in OVS.
This option causes DPDK to init only specific ports and its drivers at the time
of vswitchd init.

Sugesh Chandran (2):
  Adding DPDK configuration option to isolate rte-mempool allocation.
  Adding configuration option to whitelist DPDK physical ports.

 lib/dpdk.c   | 50 ++
 vswitchd/vswitch.xml | 44 
 2 files changed, 94 insertions(+)

-- 
2.7.4

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


[ovs-dev] [PATCH v2 0/3] netdev-dpdk: Mempool creation failure + Appctl

2017-11-09 Thread Ilya Maximets
This series implemented on top of my previous patch-set:
 * [PATCH v2 0/4] netdev-dpdk: mempool management: Leaks & Refactoring.
   https://mail.openvswitch.org/pipermail/ovs-dev/2017-November/340657.html

I can rebase it on top of current master easily if needed.

First 2 patches are independent from the last one, sent together only
because they are based on the same patch-set pointed above.

Last patch fixes mempool creation failure in case of large MTU or
big number of queues/threads. Second patch adds debug appctl to
obtain mempool information from DPDK including names, numbers of
available mbufs, object sizes and memory pointers.
First patch introduces common place for 'netdev-dpdk' unixctl commands
documentation in man pages.

Version 2:
* Oficially added documentation patch.
* Documentation patch splitted to move 'get-mempool-info'-related
  docs to patch, where this appctl introduced.
* Patches reordered for consistency.
* I kept all the ACKs because there was no actual changes.
  Antonio, please, let me know if you don't like the re-splitting.

Ilya Maximets (3):
  vswitchd: Document netdev-dpdk commands.
  netdev-dpdk: Add debug appctl to get mempool information.
  netdev-dpdk: Fix mempool creation with large MTU.

 NEWS|  3 +++
 lib/automake.mk |  1 +
 lib/netdev-dpdk-unixctl.man | 13 +++
 lib/netdev-dpdk.c   | 57 -
 manpages.mk |  2 ++
 vswitchd/ovs-vswitchd.8.in  |  1 +
 6 files changed, 76 insertions(+), 1 deletion(-)
 create mode 100644 lib/netdev-dpdk-unixctl.man

-- 
2.7.4

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


[ovs-dev] [PATCH v2 3/3] netdev-dpdk: Fix mempool creation with large MTU.

2017-11-09 Thread Ilya Maximets
Currently mempool name size limited to 25 characters by
RTE_MEMPOOL_NAMESIZE. netdev-dpdk tries to create mempool with the
following name pattern: "ovs_%{hash}_%{socket}_%{mtu}_%{n_mbuf}".

We have 3 chars for "ovs" + 4 chars for delimiters + 8 chars for
hash (because it's the 32 bit integer printed in hex) + 1 char for
socket_id (mostly 1, but it could be 2 on some systems; larger?) = 16.

Only 25 - 16 = 9 characters remains for mtu + n_mbufs.
Minimum usual value for mtu is 1500 --> 2030 (4 chars) after
dpdk_buf_size conversion and the minimum value for n_mbufs is 16384
(5 chars). So, all the 9 characters are used.

If we'll try to create port with mtu = 9500, mempool creation will
fail, because FRAME_LEN_TO_MTU(dpdk_buf_size(9500)) = 10222 (5 chars)
and this value will overflow the RTE_MEMPOOL_NAMESIZE limit.

Same issue will happen if we'll try to create port with big enough
number of queues or will try to create big enough number of PMD
threads (number of tx queues will enlarge the mempool requirements).

Fix that by removing the delimiters. To keep the readability (at least
partial) of the mempool names exact field sizes with zero padding
are used.

Following limits should be suitable for now:
 - Hash length: 8 chars (uint32_t in hex)
 - Socket ID  : 2 chars (For systems with up to 10 sockets)
 - MTU: 5 chars (MTU (10^5 - 1) should be enough for now)
 - n_mbufs: 7 chars (Up to 10^7 of mbufs)

   Total  : 22 + 3 (for "ovs") = 25

CC: Antonio Fischetti 
CC: Robert Wojciechowicz 
Fixes: f06546a51dd8 ("Fix mempool names to reflect socket id.")
Fixes: d555d9bded5f ("netdev-dpdk: Create separate memory pool for each port.")
Signed-off-by: Ilya Maximets 
Acked-by: Antonio Fischetti 
---
 lib/netdev-dpdk.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 75856bc..dc210cc 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -510,7 +510,8 @@ dpdk_mp_create(struct netdev_dpdk *dev, int mtu)
 do {
 /* Full DPDK memory pool name must be unique and cannot be
  * longer than RTE_MEMPOOL_NAMESIZE. */
-int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE, "ovs_%x_%d_%d_%u",
+int ret = snprintf(mp_name, RTE_MEMPOOL_NAMESIZE,
+   "ovs%08x%02d%05d%07u",
hash, socket_id, mtu, n_mbufs);
 if (ret < 0 || ret >= RTE_MEMPOOL_NAMESIZE) {
 VLOG_DBG("snprintf returned %d. "
-- 
2.7.4

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


[ovs-dev] [PATCH v2 2/3] netdev-dpdk: Add debug appctl to get mempool information.

2017-11-09 Thread Ilya Maximets
New appctl 'netdev-dpdk/get-mempool-info' implemented to get result
of 'rte_mempool_list_dump()' function if no arguments passed and
'rte_mempool_dump()' if DPDK netdev passed as argument.

Could be used for debugging mbuf leaks and other mempool related
issues. Most useful in pair with `grep -v "cache_count.*=0"`.

Signed-off-by: Ilya Maximets 
Acked-by: Antonio Fischetti 
---
 NEWS|  1 +
 lib/netdev-dpdk-unixctl.man |  4 
 lib/netdev-dpdk.c   | 54 +
 3 files changed, 59 insertions(+)

diff --git a/NEWS b/NEWS
index ccd409f..0945d6e 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ Post-v2.8.0
- Linux kernel 4.13
  * Add support for compiling OVS with the latest Linux 4.13 kernel
- DPDK:
+ * New debug appctl command 'netdev-dpdk/get-mempool-info'.
  * All the netdev-dpdk appctl commands described in ovs-vswitchd man page.
 
 v2.8.0 - 31 Aug 2017
diff --git a/lib/netdev-dpdk-unixctl.man b/lib/netdev-dpdk-unixctl.man
index a4b7f60..73b2e10 100644
--- a/lib/netdev-dpdk-unixctl.man
+++ b/lib/netdev-dpdk-unixctl.man
@@ -7,3 +7,7 @@ to \fIstate\fR.  \fIstate\fR can be "up" or "down".
 Detaches device with corresponding \fIpci-address\fR from DPDK.  This command
 can be used to detach device if it wasn't detached automatically after port
 deletion. Refer to the documentation for details and instructions.
+.IP "\fBnetdev-dpdk/get-mempool-info\fR [\fIinterface\fR]"
+Prints the debug information about memory pool used by DPDK \fIinterface\fR.
+If called without arguments, information of all the available mempools will
+be printed.
diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c
index 9ceb109..75856bc 100644
--- a/lib/netdev-dpdk.c
+++ b/lib/netdev-dpdk.c
@@ -2559,6 +2559,56 @@ error:
 free(response);
 }
 
+static void
+netdev_dpdk_get_mempool_info(struct unixctl_conn *conn,
+ int argc, const char *argv[],
+ void *aux OVS_UNUSED)
+{
+size_t size;
+FILE *stream;
+char *response = NULL;
+struct netdev *netdev = NULL;
+
+if (argc == 2) {
+netdev = netdev_from_name(argv[1]);
+if (!netdev || !is_dpdk_class(netdev->netdev_class)) {
+unixctl_command_reply_error(conn, "Not a DPDK Interface");
+goto out;
+}
+}
+
+stream = open_memstream(, );
+if (!stream) {
+response = xasprintf("Unable to open memstream: %s.",
+ ovs_strerror(errno));
+unixctl_command_reply_error(conn, response);
+goto out;
+}
+
+if (netdev) {
+struct netdev_dpdk *dev = netdev_dpdk_cast(netdev);
+
+ovs_mutex_lock(>mutex);
+ovs_mutex_lock(_mp_mutex);
+
+rte_mempool_dump(stream, dev->mp);
+
+ovs_mutex_unlock(_mp_mutex);
+ovs_mutex_unlock(>mutex);
+} else {
+ovs_mutex_lock(_mp_mutex);
+rte_mempool_list_dump(stream);
+ovs_mutex_unlock(_mp_mutex);
+}
+
+fclose(stream);
+
+unixctl_command_reply(conn, response);
+out:
+free(response);
+netdev_close(netdev);
+}
+
 /*
  * Set virtqueue flags so that we do not receive interrupts.
  */
@@ -2815,6 +2865,10 @@ netdev_dpdk_class_init(void)
  "pci address of device", 1, 1,
  netdev_dpdk_detach, NULL);
 
+unixctl_command_register("netdev-dpdk/get-mempool-info",
+ "[netdev]", 0, 1,
+ netdev_dpdk_get_mempool_info, NULL);
+
 ovsthread_once_done();
 }
 
-- 
2.7.4

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


[ovs-dev] [PATCH v2 1/3] vswitchd: Document netdev-dpdk commands.

2017-11-09 Thread Ilya Maximets
Signed-off-by: Ilya Maximets 
Acked-by: Antonio Fischetti 
---
 NEWS| 2 ++
 lib/automake.mk | 1 +
 lib/netdev-dpdk-unixctl.man | 9 +
 manpages.mk | 2 ++
 vswitchd/ovs-vswitchd.8.in  | 1 +
 5 files changed, 15 insertions(+)
 create mode 100644 lib/netdev-dpdk-unixctl.man

diff --git a/NEWS b/NEWS
index a93237f..ccd409f 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,8 @@ Post-v2.8.0
  IPv6 packets.
- Linux kernel 4.13
  * Add support for compiling OVS with the latest Linux 4.13 kernel
+   - DPDK:
+ * All the netdev-dpdk appctl commands described in ovs-vswitchd man page.
 
 v2.8.0 - 31 Aug 2017
 
diff --git a/lib/automake.mk b/lib/automake.mk
index effe5b5..4b38a11 100644
--- a/lib/automake.mk
+++ b/lib/automake.mk
@@ -465,6 +465,7 @@ MAN_FRAGMENTS += \
lib/db-ctl-base.man \
lib/dpctl.man \
lib/memory-unixctl.man \
+   lib/netdev-dpdk-unixctl.man \
lib/ofp-version.man \
lib/ovs.tmac \
lib/service.man \
diff --git a/lib/netdev-dpdk-unixctl.man b/lib/netdev-dpdk-unixctl.man
new file mode 100644
index 000..a4b7f60
--- /dev/null
+++ b/lib/netdev-dpdk-unixctl.man
@@ -0,0 +1,9 @@
+.SS "NETDEV-DPDK COMMANDS"
+These commands manage DPDK related ports (\fItype=dpdk*\fR).
+.IP "\fBnetdev-dpdk/set-admin-state\fR [\fIinterface\fR] \fIstate\fR"
+Sets admin state for DPDK \fIinterface\fR (or all interfaces if none is given)
+to \fIstate\fR.  \fIstate\fR can be "up" or "down".
+.IP "\fBnetdev-dpdk/detach\fR \fIpci-address\fR"
+Detaches device with corresponding \fIpci-address\fR from DPDK.  This command
+can be used to detach device if it wasn't detached automatically after port
+deletion. Refer to the documentation for details and instructions.
diff --git a/manpages.mk b/manpages.mk
index d610d88..c89bc45 100644
--- a/manpages.mk
+++ b/manpages.mk
@@ -279,6 +279,7 @@ vswitchd/ovs-vswitchd.8: \
lib/daemon.man \
lib/dpctl.man \
lib/memory-unixctl.man \
+   lib/netdev-dpdk-unixctl.man \
lib/service.man \
lib/ssl-bootstrap.man \
lib/ssl.man \
@@ -296,6 +297,7 @@ lib/coverage-unixctl.man:
 lib/daemon.man:
 lib/dpctl.man:
 lib/memory-unixctl.man:
+lib/netdev-dpdk-unixctl.man:
 lib/service.man:
 lib/ssl-bootstrap.man:
 lib/ssl.man:
diff --git a/vswitchd/ovs-vswitchd.8.in b/vswitchd/ovs-vswitchd.8.in
index c18baf6..76ccfcb 100644
--- a/vswitchd/ovs-vswitchd.8.in
+++ b/vswitchd/ovs-vswitchd.8.in
@@ -283,6 +283,7 @@ port names, which this thread polls.
 .IP "\fBdpif-netdev/pmd-rxq-rebalance\fR [\fIdp\fR]"
 Reassigns rxqs to pmds in the datapath \fIdp\fR based on their current usage.
 .
+.so lib/netdev-dpdk-unixctl.man
 .so ofproto/ofproto-dpif-unixctl.man
 .so ofproto/ofproto-unixctl.man
 .so lib/vlog-unixctl.man
-- 
2.7.4

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