Re: [ovs-dev] [PATCH 1/1] Encap & Decap actions for MPLS Packet Type.

2019-10-07 Thread 0-day Robot
Bleep bloop.  Greetings Martin Varghese, I am a robot and I have tried out your 
patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


checkpatch:
WARNING: Line is 84 characters long (recommended limit is 79)
#246 FILE: lib/odp-util.c:144:
case OVS_ACTION_ATTR_PTAP_PUSH_MPLS: return sizeof(struct 
ovs_action_push_mpls);

WARNING: Line is 81 characters long (recommended limit is 79)
#259 FILE: lib/odp-util.c:1216:
ds_put_format(ds, ",eth_type=0x%"PRIx16")", 
ntohs(mpls->mpls_ethertype));

WARNING: Line is 83 characters long (recommended limit is 79)
#269 FILE: lib/odp-util.c:1226:
ds_put_format(ds, "ptap_pop_mpls(eth_type=0x%"PRIx16")", 
ntohs(ethertype));

WARNING: Line is 84 characters long (recommended limit is 79)
#300 FILE: lib/odp-util.c:7731:
   nl_msg_put_be16(odp_actions, OVS_ACTION_ATTR_PTAP_POP_MPLS, 
dl_type);

Lines checked: 630, Warnings: 4, Errors: 0


build:
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include 
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare 
-Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter 
-Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition 
-Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wshadow 
-Werror -Werror -g -O2 -MT lib/dpctl.lo -MD -MP -MF lib/.deps/dpctl.Tpo -c 
lib/dpctl.c -o lib/dpctl.o
depbase=`echo lib/dp-packet.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. 
   -I ./include -I ./include -I ./lib -I ./lib-Wstrict-prototypes -Wall 
-Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security 
-Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align 
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes 
-Wmissing-field-initializers -fno-strict-aliasing -Wshadow -Werror -Werror   -g 
-O2 -MT lib/dp-packet.lo -MD -MP -MF $depbase.Tpo -c -o lib/dp-packet.lo 
lib/dp-packet.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include 
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare 
-Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter 
-Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition 
-Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wshadow 
-Werror -Werror -g -O2 -MT lib/dp-packet.lo -MD -MP -MF lib/.deps/dp-packet.Tpo 
-c lib/dp-packet.c -o lib/dp-packet.o
depbase=`echo lib/dpif-netdev-lookup-generic.lo | sed 
's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. 
   -I ./include -I ./include -I ./lib -I ./lib-Wstrict-prototypes -Wall 
-Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security 
-Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align 
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes 
-Wmissing-field-initializers -fno-strict-aliasing -Wshadow -Werror -Werror   -g 
-O2 -MT lib/dpif-netdev-lookup-generic.lo -MD -MP -MF $depbase.Tpo -c -o 
lib/dpif-netdev-lookup-generic.lo lib/dpif-netdev-lookup-generic.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include 
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare 
-Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter 
-Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition 
-Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wshadow 
-Werror -Werror -g -O2 -MT lib/dpif-netdev-lookup-generic.lo -MD -MP -MF 
lib/.deps/dpif-netdev-lookup-generic.Tpo -c lib/dpif-netdev-lookup-generic.c -o 
lib/dpif-netdev-lookup-generic.o
depbase=`echo lib/dpif-netdev.lo | sed 's|[^/]*$|.deps/&|;s|\.lo$||'`;\
/bin/sh ./libtool  --tag=CC   --mode=compile gcc -std=gnu99 -DHAVE_CONFIG_H -I. 
   -I ./include -I ./include -I ./lib -I ./lib-Wstrict-prototypes -Wall 
-Wextra -Wno-sign-compare -Wpointer-arith -Wformat -Wformat-security 
-Wswitch-enum -Wunused-parameter -Wbad-function-cast -Wcast-align 
-Wstrict-prototypes -Wold-style-definition -Wmissing-prototypes 
-Wmissing-field-initializers -fno-strict-aliasing -Wshadow -Werror -Werror   -g 
-O2 -MT lib/dpif-netdev.lo -MD -MP -MF $depbase.Tpo -c -o lib/dpif-netdev.lo 
lib/dpif-netdev.c &&\
mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I ./include -I ./include 
-I ./lib -I ./lib -Wstrict-prototypes -Wall -Wextra -Wno-sign-compare 
-Wpointer-arith -Wformat -Wformat-security -Wswitch-enum -Wunused-parameter 
-Wbad-function-cast -Wcast-align -Wstrict-prototypes -Wold-style-definition 
-Wmissing-prototypes -Wmissing-field-initializers -fno-strict-aliasing -Wshadow 
-Werror -Werror -g -O2 -MT lib/dpif-netdev.

[ovs-dev] [PATCH 1/1] Encap & Decap actions for MPLS Packet Type.

2019-10-07 Thread Martin Varghese
Encap & Decap actions are extended to support MPLS packet type.
The encap & decap adds and removes MPLS header at the start of
packet.

CLI syntax for Encap & Decap
- encap(mpls(ether_type=0x8847))
- decap(packet_type(ns=x,type=y))

Signed-off-by: Martin Varghese 
---
 datapath/actions.c| 57 ++
 datapath/flow_netlink.c   | 13 
 datapath/linux/compat/include/linux/openvswitch.h |  2 +
 include/openvswitch/ofp-ed-props.h| 18 +
 lib/dpif.c|  2 +
 lib/odp-execute.c |  2 +
 lib/odp-util.c| 46 +--
 lib/ofp-actions.c |  5 ++
 lib/ofp-ed-props.c| 93 ++-
 ofproto/ofproto-dpif-xlate.c  | 58 +-
 10 files changed, 288 insertions(+), 8 deletions(-)

diff --git a/datapath/actions.c b/datapath/actions.c
index a44e804..98559f4 100644
--- a/datapath/actions.c
+++ b/datapath/actions.c
@@ -184,6 +184,55 @@ static void update_ethertype(struct sk_buff *skb, struct 
ethhdr *hdr,
hdr->h_proto = ethertype;
 }
 
+static int push_ptap_mpls(struct sk_buff *skb, struct sw_flow_key *key,
+   const struct ovs_action_push_mpls *mpls)
+{
+
+   struct mpls_shim_hdr *lse;
+   int err;
+
+   if (unlikely(!eth_p_mpls(mpls->mpls_ethertype)))
+   return -EINVAL;
+
+   /* Networking stack does not allow simultaneous Tunnel and MPLS GSO. */
+   if (skb->encapsulation)
+   return -EINVAL;
+
+   err = skb_cow_head(skb, MPLS_HLEN);
+   if (unlikely(err))
+   return err;
+
+   if (!skb->inner_protocol) {
+   skb_set_inner_network_header(skb, skb->mac_len);
+   skb_set_inner_protocol(skb, skb->protocol);
+   }
+
+   skb_push(skb, MPLS_HLEN);
+   skb_reset_mac_header(skb);
+   skb_reset_network_header(skb);
+
+   lse = mpls_hdr(skb);
+   lse->label_stack_entry = mpls->mpls_lse;
+   skb_postpush_rcsum(skb, lse, MPLS_HLEN);
+   skb->protocol = mpls->mpls_ethertype;
+
+   invalidate_flow_key(key);
+   return 0;
+}
+
+static int ptap_pop_mpls(struct sk_buff *skb, struct sw_flow_key *key,
+   const __be16 ethertype)
+{
+   int err;
+
+   if(!ethertype)
+   key->mac_proto = MAC_PROTO_ETHERNET;
+
+   pop_mpls(skb, key, ethertype);
+   invalidate_flow_key(key);
+   return 0;
+}
+
 static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
 const struct ovs_action_push_mpls *mpls)
 {
@@ -1313,10 +1362,18 @@ static int do_execute_actions(struct datapath *dp, 
struct sk_buff *skb,
err = push_mpls(skb, key, nla_data(a));
break;
 
+   case OVS_ACTION_ATTR_PTAP_PUSH_MPLS:
+err = push_ptap_mpls(skb, key, nla_data(a));
+break;
+
case OVS_ACTION_ATTR_POP_MPLS:
err = pop_mpls(skb, key, nla_get_be16(a));
break;
 
+case OVS_ACTION_ATTR_PTAP_POP_MPLS:
+err = ptap_pop_mpls(skb, key, nla_get_be16(a));
+break;
+
case OVS_ACTION_ATTR_PUSH_VLAN:
err = push_vlan(skb, key, nla_data(a));
break;
diff --git a/datapath/flow_netlink.c b/datapath/flow_netlink.c
index 0f7ab53..b454536 100644
--- a/datapath/flow_netlink.c
+++ b/datapath/flow_netlink.c
@@ -83,10 +83,12 @@ static bool actions_may_change_flow(const struct nlattr 
*actions)
case OVS_ACTION_ATTR_HASH:
case OVS_ACTION_ATTR_POP_ETH:
case OVS_ACTION_ATTR_POP_MPLS:
+   case OVS_ACTION_ATTR_PTAP_POP_MPLS:
case OVS_ACTION_ATTR_POP_NSH:
case OVS_ACTION_ATTR_POP_VLAN:
case OVS_ACTION_ATTR_PUSH_ETH:
case OVS_ACTION_ATTR_PUSH_MPLS:
+   case OVS_ACTION_ATTR_PTAP_PUSH_MPLS:
case OVS_ACTION_ATTR_PUSH_NSH:
case OVS_ACTION_ATTR_PUSH_VLAN:
case OVS_ACTION_ATTR_SAMPLE:
@@ -2975,6 +2977,8 @@ static int __ovs_nla_copy_actions(struct net *net, const 
struct nlattr *attr,
[OVS_ACTION_ATTR_METER] = sizeof(u32),
[OVS_ACTION_ATTR_CLONE] = (u32)-1,
[OVS_ACTION_ATTR_CHECK_PKT_LEN] = (u32)-1,
+   [OVS_ACTION_ATTR_PTAP_PUSH_MPLS] = sizeof(struct 
ovs_action_push_mpls),
+   [OVS_ACTION_ATTR_PTAP_POP_MPLS] = sizeof(__be16),
};
const struct ovs_action_push_vlan *vlan;
int type = nla_type(a);
@@ -3042,6 +3046,14 @@ static int __ovs_nla_copy_actions(struct net *net, const 

[ovs-dev] [PATCH 0/1] Encap & Decap actions for MPLS Packet Type

2019-10-07 Thread Martin Varghese
The existing PUSH MPLS & POP MPLS actions inserts & removes MPLS header
between ethernet header and the IP header. Though this behaviour is fine
for L3 VPN where an IP packet is encapsulated inside a MPLS tunnel, it does
not suffice the L2 VPN requirements. In L2 VPN the ethernet packets must be
encapsulated inside MPLS tunnel.

In this change the encap & decap actions are extended to support MPLS packet
type. The encap & decap adds and removes MPLS header at the start of packet
as depicted below.

Encapsulation:

Actions - encap(mpls(ether_type=0x8847)),encap(ethernet)

Incoming packet -> | ETH | IP | Payload |

1 Actions -  encap(mpls(ether_type=0x8847)) [Kernel action - 
ptap_push_mpls:0x8847]

Outgoing packet -> | MPLS | ETH | Payload|

2 Actions - encap(ethernet) [ Kernel action - push_eth ]

Outgoing packet -> | ETH | MPLS | ETH | Payload|

Decapsulation:

Incoming packet -> | ETH | MPLS | ETH | IP | Payload |

Actions - decap(),decap(packet_type(ns=0,type=0)

1 Actions -  decap() [Kernel action - pop_eth)

Outgoing packet -> | MPLS | ETH | IP | Payload|

2 Actions - decap(packet_type(ns=0,type=0) [Kernel action - ptap_pop_mpls:0]

Outgoing packet -> | ETH  | IP | Payload|


Note to reviewers -

This is an early drop to gather feedback and hence incomplete.


Martin Varghese (1):
  Encap & Decap actions for MPLS Packet Type.

 datapath/actions.c| 57 ++
 datapath/flow_netlink.c   | 13 
 datapath/linux/compat/include/linux/openvswitch.h |  2 +
 include/openvswitch/ofp-ed-props.h| 18 +
 lib/dpif.c|  2 +
 lib/odp-execute.c |  2 +
 lib/odp-util.c| 46 +--
 lib/ofp-actions.c |  5 ++
 lib/ofp-ed-props.c| 93 ++-
 ofproto/ofproto-dpif-xlate.c  | 58 +-
 10 files changed, 288 insertions(+), 8 deletions(-)

-- 
1.8.3.1

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


Re: [ovs-dev] [PATCH net-next 0/9] optimize openvswitch flow looking up

2019-10-07 Thread Tonghao Zhang
On Fri, Oct 4, 2019 at 1:09 AM William Tu  wrote:
>
> Hi Tonghao,
>
> Thanks for the patch.
>
> > On 29 Sep 2019, at 19:09, xiangxia.m@gmail.com wrote:
> >
> > > From: Tonghao Zhang 
> > >
> > > This series patch optimize openvswitch.
> > >
> > > Patch 1, 2, 4: Port Pravin B Shelar patches to
> > > linux upstream with little changes.
> > >
>
> I thought the idea of adding another cache before the flow mask
> was rejected before, due to all the potential issue of caches, ex:
> cache is exploitable, and performance still suffers when your cache
> is full. See David's slides below:
> [1] http://vger.kernel.org/~davem/columbia2012.pdf
>
> Do you have a rough number about how many flows this flow mask
> cache can handle?
Now we can cache 256 flows on a CPU, so if there are 40 CPUs, 256*10
flows will be cached.
the value of flow-mask is defined using MC_HASH_ENTRIES macro define.
We can change the value
according to different use case and CPU L1d cache.

> > > Patch 5, 6, 7: Optimize the flow looking up and
> > > simplify the flow hash.
>
> I think this is great.
> I wonder what's the performance improvement when flow mask
> cache is full?
I will test the case, I think this feature should work well with RSS
and irq affinity.
> Thanks
> William
>
> > >
> > > Patch 8: is a bugfix.
> > >
> > > The performance test is on Intel Xeon E5-2630 v4.
> > > The test topology is show as below:
> > >
> > > +---+
> > > |   +---+   |
> > > |   | eth0   ovs-switcheth1 |   | Host0
> > > |   +---+   |
> > > +---+
> > >   ^   |
> > >   |   |
> > >   |   |
> > >   |   |
> > >   |   v
> > > +-++ ++-+
> > > | netperf  | Host1   | netserver| Host2
> > > +--+ +--+
> > >
> > > We use netperf send the 64B frame, and insert 255+ flow-mask:
> > > $ ovs-dpctl add-flow ovs-switch
> > > "in_port(1),eth(dst=00:01:00:00:00:00/ff:ff:ff:ff:ff:01),eth_type(0x0800),ipv4(frag=no)"
> > > 2
> > > ...
> > > $ ovs-dpctl add-flow ovs-switch
> > > "in_port(1),eth(dst=00:ff:00:00:00:00/ff:ff:ff:ff:ff:ff),eth_type(0x0800),ipv4(frag=no)"
> > > 2
> > > $ netperf -t UDP_STREAM -H 2.2.2.200 -l 40 -- -m 18
> > >
> > > * Without series patch, throughput 8.28Mbps
> > > * With series patch, throughput 46.05Mbps
> > >
> > > Tonghao Zhang (9):
> > >   net: openvswitch: add flow-mask cache for performance
> > >   net: openvswitch: convert mask list in mask array
> > >   net: openvswitch: shrink the mask array if necessary
> > >   net: openvswitch: optimize flow mask cache hash collision
> > >   net: openvswitch: optimize flow-mask looking up
> > >   net: openvswitch: simplify the flow_hash
> > >   net: openvswitch: add likely in flow_lookup
> > >   net: openvswitch: fix possible memleak on destroy flow table
> > >   net: openvswitch: simplify the ovs_dp_cmd_new
> > >
> > >  net/openvswitch/datapath.c   |  63 +
> > >  net/openvswitch/flow.h   |   1 -
> > >  net/openvswitch/flow_table.c | 318
> > > +--
> > >  net/openvswitch/flow_table.h |  19 ++-
> > >  4 files changed, 330 insertions(+), 71 deletions(-)
> > >
> > > --
> > > 1.8.3.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


Re: [ovs-dev] [PATCH 1/1] ovsdb-tool: fix memory leak while converting cluster into standalone database

2019-10-07 Thread Ben Pfaff
On Mon, Oct 07, 2019 at 10:10:34AM +0200, Damijan Skvarc wrote:
> memory leak is reported by valgrind while executing functional test
> "ovsdb-tool convert-to-standalone"
> 
> ==13842== 2,850 (280 direct, 2,570 indirect) bytes in 7 blocks are definitely 
> lost in loss record 20 of 20
> ==13842==at 0x4C2DB8F: malloc (in 
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==13842==by 0x45EE2E: xmalloc (util.c:138)
> ==13842==by 0x43E386: json_create (json.c:1451)
> ==13842==by 0x43BDD2: json_object_create (json.c:254)
> ==13842==by 0x43DEE3: json_parser_push_object (json.c:1273)
> ==13842==by 0x43E167: json_parser_input (json.c:1371)
> ==13842==by 0x43D6EA: json_lex_input (json.c:991)
> ==13842==by 0x43DAC1: json_parser_feed (json.c:1149)
> ==13842==by 0x40D108: parse_body (log.c:411)
> ==13842==by 0x40D386: ovsdb_log_read (log.c:476)
> ==13842==by 0x406A0B: do_convert_to_standalone (ovsdb-tool.c:1571)
> ==13842==by 0x406A0B: do_cluster_standalone (ovsdb-tool.c:1606)
> ==13842==by 0x438670: ovs_cmdl_run_command__ (command-line.c:223)
> ==13842==by 0x438720: ovs_cmdl_run_command (command-line.c:254)
> ==13842==by 0x405A4C: main (ovsdb-tool.c:79)
> 
> The problem was in do_convert_to_standalone() function which while reading 
> log file
> allocate json object which was not deallocated at the end.
> 
> Signed-off-by: Damijan Skvarc 

Applied to master, thanks.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 1/1] ovsdb-tool: fix memory leak while running "db-is-standalone" command

2019-10-07 Thread Ben Pfaff
On Mon, Oct 07, 2019 at 10:30:07AM +0200, Damijan Skvarc wrote:
> problem is reported by valgrind while running functional tests:
> 
> ==21043== 160 (88 direct, 72 indirect) bytes in 1 blocks are definitely lost 
> in loss record 7 of 8
> ==21043==at 0x4C2DB8F: malloc (in 
> /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> ==21043==by 0x45EE2E: xmalloc (util.c:138)
> ==21043==by 0x40CB81: ovsdb_log_open (log.c:270)
> ==21043==by 0x406B4F: do_db_has_magic.isra.9 (ovsdb-tool.c:563)
> ==21043==by 0x438670: ovs_cmdl_run_command__ (command-line.c:223)
> ==21043==by 0x438720: ovs_cmdl_run_command (command-line.c:254)
> ==21043==by 0x405A4C: main (ovsdb-tool.c:79)
> 
> problem was in do_db_has_magic() which opens log file which is never closed.
> 
> Signed-off-by: Damijan Skvarc 

Applied to master, thanks.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH v1] ofproto: fix a typo for ttl in dpif_sflow_actions

2019-10-07 Thread Ben Pfaff
On Mon, Oct 07, 2019 at 12:34:55AM -0400, martinbj2...@gmail.com wrote:
> From: Martin Zhang 
> 
> Signed-off-by: Martin Zhang 

Thanks.  I applied this to master and backported it as far as
branch-2.5.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] backtrace: Fix 32-bit libunwind build.

2019-10-07 Thread Ilya Maximets

On 07.10.2019 18:11, Ilya Maximets wrote:

On 07.10.2019 18:07, William Tu wrote:

On Mon, Oct 7, 2019 at 5:06 AM Ilya Maximets  wrote:


On 04.10.2019 23:21, William Tu wrote:

The libunwind unw_word_t type is defined as uint32_t for 32-bit
system and uint64_t for 64-bit system.  The patch fixes the
compile error using PRIxPTR to print this value.

Fixes: e2ed6fbeb18c ("fatal-signal: Catch SIGSEGV and print backtrace.")
Signed-off-by: William Tu 
Acked-by: Ilya Maximets 
---


Thanks! I applied both patches to master, but in the reverse order.

Best regards, Ilya Maximets.


Hi Ilya,

Thanks...
Now the cirrus CI and appveyor seem to be failing. I will work on it.


Not sure about appveyor, but cirrus is failing because of this:
https://mail.openvswitch.org/pipermail/ovs-dev/2019-October/363182.html

It's not related to current patch, freebsd just updated to use gcc > 9.
And it's not possible to build OVS with -Werror and gcc 9 right now.


And this somehow FreeBSD specific. netinet/icmp6.h from glibc development
package doesn't mark the structure as 'packed' on linux.

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] backtrace: Fix 32-bit libunwind build.

2019-10-07 Thread Ilya Maximets

On 07.10.2019 18:07, William Tu wrote:

On Mon, Oct 7, 2019 at 5:06 AM Ilya Maximets  wrote:


On 04.10.2019 23:21, William Tu wrote:

The libunwind unw_word_t type is defined as uint32_t for 32-bit
system and uint64_t for 64-bit system.  The patch fixes the
compile error using PRIxPTR to print this value.

Fixes: e2ed6fbeb18c ("fatal-signal: Catch SIGSEGV and print backtrace.")
Signed-off-by: William Tu 
Acked-by: Ilya Maximets 
---


Thanks! I applied both patches to master, but in the reverse order.

Best regards, Ilya Maximets.


Hi Ilya,

Thanks...
Now the cirrus CI and appveyor seem to be failing. I will work on it.


Not sure about appveyor, but cirrus is failing because of this:
https://mail.openvswitch.org/pipermail/ovs-dev/2019-October/363182.html

It's not related to current patch, freebsd just updated to use gcc > 9.
And it's not possible to build OVS with -Werror and gcc 9 right now.

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


Re: [ovs-dev] [PATCH 2/2] backtrace: Fix 32-bit libunwind build.

2019-10-07 Thread William Tu
On Mon, Oct 7, 2019 at 5:06 AM Ilya Maximets  wrote:
>
> On 04.10.2019 23:21, William Tu wrote:
> > The libunwind unw_word_t type is defined as uint32_t for 32-bit
> > system and uint64_t for 64-bit system.  The patch fixes the
> > compile error using PRIxPTR to print this value.
> >
> > Fixes: e2ed6fbeb18c ("fatal-signal: Catch SIGSEGV and print backtrace.")
> > Signed-off-by: William Tu 
> > Acked-by: Ilya Maximets 
> > ---
>
> Thanks! I applied both patches to master, but in the reverse order.
>
> Best regards, Ilya Maximets.

Hi Ilya,

Thanks...
Now the cirrus CI and appveyor seem to be failing. I will work on it.

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


Re: [ovs-dev] [PATCH ovn] Partially revert "Exclude inport and outport symbol tables from conjunction."

2019-10-07 Thread Numan Siddique
On Wed, Oct 2, 2019 at 2:54 AM Han Zhou  wrote:

>
>
> On Mon, Sep 30, 2019 at 6:51 AM  wrote:
> >
> > From: Numan Siddique 
> >
> > This partially revers the commit -
> 298701dbc99645700be41680a43d049cb061847a
> > as the commit [1] disables the conjunction.
> >
> > We still need the changes to the tests/ovn.at file.
> >
> > CC: Han Zhou 
> > Signed-off-by: Numan Siddique 
> > ---
> >  lib/expr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/lib/expr.c b/lib/expr.c
> > index 64ea0aafa..9b9b6bcca 100644
> > --- a/lib/expr.c
> > +++ b/lib/expr.c
> > @@ -1517,7 +1517,7 @@ expr_symtab_add_string(struct shash *symtab, const
> char *name,
> >  const struct mf_field *field = mf_from_id(id);
> >  struct expr_symbol *symbol;
> >
> > -symbol = add_symbol(symtab, name, 0, prereqs, EXPR_L_NOMINAL, true,
> > +symbol = add_symbol(symtab, name, 0, prereqs, EXPR_L_NOMINAL, false,
> >  field->writable);
> >  symbol->field = field;
> >  return symbol;
> > --
> > 2.21.0
> >
> > ___
> > dev mailing list
> > d...@openvswitch.org
> > https://mail.openvswitch.org/mailman/listinfo/ovs-dev
>
> Thanks Numan.
> Acked-by: Han Zhou 
>

Thanks. I applied this to master.

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


Re: [ovs-dev] [PATCH 2/2] backtrace: Fix 32-bit libunwind build.

2019-10-07 Thread Ilya Maximets

On 04.10.2019 23:21, William Tu wrote:

The libunwind unw_word_t type is defined as uint32_t for 32-bit
system and uint64_t for 64-bit system.  The patch fixes the
compile error using PRIxPTR to print this value.

Fixes: e2ed6fbeb18c ("fatal-signal: Catch SIGSEGV and print backtrace.")
Signed-off-by: William Tu 
Acked-by: Ilya Maximets 
---


Thanks! I applied both patches to master, but in the reverse order.

Best regards, Ilya Maximets.
___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v1] ofproto: fix a typo for ttl in dpif_sflow_actions

2019-10-07 Thread martinbj2008
From: Martin Zhang 

Signed-off-by: Martin Zhang 
---
 ofproto/ofproto-dpif-sflow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/ofproto-dpif-sflow.c b/ofproto/ofproto-dpif-sflow.c
index 03bd763..9abaab6 100644
--- a/ofproto/ofproto-dpif-sflow.c
+++ b/ofproto/ofproto-dpif-sflow.c
@@ -1026,7 +1026,7 @@ sflow_read_set_action(const struct nlattr *attr,
 sflow_actions->tunnel.ip_tos = key->ipv4_tos;
 }
 if (key->ipv4_ttl) {
-sflow_actions->tunnel.ip_tos = key->ipv4_ttl;
+sflow_actions->tunnel.ip_ttl = key->ipv4_ttl;
 }
 }
 break;
-- 
1.8.3.1

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


[ovs-dev] [PATCH 1/1] ovsdb-tool: fix memory leak while running "db-is-standalone" command

2019-10-07 Thread Damijan Skvarc
problem is reported by valgrind while running functional tests:

==21043== 160 (88 direct, 72 indirect) bytes in 1 blocks are definitely lost in 
loss record 7 of 8
==21043==at 0x4C2DB8F: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==21043==by 0x45EE2E: xmalloc (util.c:138)
==21043==by 0x40CB81: ovsdb_log_open (log.c:270)
==21043==by 0x406B4F: do_db_has_magic.isra.9 (ovsdb-tool.c:563)
==21043==by 0x438670: ovs_cmdl_run_command__ (command-line.c:223)
==21043==by 0x438720: ovs_cmdl_run_command (command-line.c:254)
==21043==by 0x405A4C: main (ovsdb-tool.c:79)

problem was in do_db_has_magic() which opens log file which is never closed.

Signed-off-by: Damijan Skvarc 
---
 ovsdb/ovsdb-tool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index a8f3135..91662ca 100644
--- a/ovsdb/ovsdb-tool.c
+++ b/ovsdb/ovsdb-tool.c
@@ -562,7 +562,9 @@ do_db_has_magic(struct ovs_cmdl_context *ctx, const char 
*magic)
 
 check_ovsdb_error(ovsdb_log_open(filename, OVSDB_MAGIC"|"RAFT_MAGIC,
  OVSDB_LOG_READ_ONLY, -1, &log));
-if (strcmp(ovsdb_log_get_magic(log), magic)) {
+int cmp = strcmp(ovsdb_log_get_magic(log), magic);
+ovsdb_log_close(log);
+if (cmp) {
 exit(2);
 }
 }
-- 
2.7.4

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


[ovs-dev] [PATCH 1/1] ovsdb-tool: fix memory leak while converting cluster into standalone database

2019-10-07 Thread Damijan Skvarc
memory leak is reported by valgrind while executing functional test
"ovsdb-tool convert-to-standalone"

==13842== 2,850 (280 direct, 2,570 indirect) bytes in 7 blocks are definitely 
lost in loss record 20 of 20
==13842==at 0x4C2DB8F: malloc (in 
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==13842==by 0x45EE2E: xmalloc (util.c:138)
==13842==by 0x43E386: json_create (json.c:1451)
==13842==by 0x43BDD2: json_object_create (json.c:254)
==13842==by 0x43DEE3: json_parser_push_object (json.c:1273)
==13842==by 0x43E167: json_parser_input (json.c:1371)
==13842==by 0x43D6EA: json_lex_input (json.c:991)
==13842==by 0x43DAC1: json_parser_feed (json.c:1149)
==13842==by 0x40D108: parse_body (log.c:411)
==13842==by 0x40D386: ovsdb_log_read (log.c:476)
==13842==by 0x406A0B: do_convert_to_standalone (ovsdb-tool.c:1571)
==13842==by 0x406A0B: do_cluster_standalone (ovsdb-tool.c:1606)
==13842==by 0x438670: ovs_cmdl_run_command__ (command-line.c:223)
==13842==by 0x438720: ovs_cmdl_run_command (command-line.c:254)
==13842==by 0x405A4C: main (ovsdb-tool.c:79)

The problem was in do_convert_to_standalone() function which while reading log 
file
allocate json object which was not deallocated at the end.

Signed-off-by: Damijan Skvarc 
---
 ovsdb/ovsdb-tool.c | 37 +
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/ovsdb/ovsdb-tool.c b/ovsdb/ovsdb-tool.c
index 3bbf4c8..a8f3135 100644
--- a/ovsdb/ovsdb-tool.c
+++ b/ovsdb/ovsdb-tool.c
@@ -951,26 +951,30 @@ raft_header_to_standalone_log(const struct raft_header *h,
 {
 if (h->snap_index) {
 if (!h->snap.data || json_array(h->snap.data)->n != 2) {
-ovs_fatal(0, "Incorrect raft header data array length");
+ovs_fatal(0, "Incorrect raft header data array length");
 }
 
-struct json *schema_json = json_array(h->snap.data)->elems[0];
+struct json_array *pa = json_array(h->snap.data);
+struct json *schema_json = pa->elems[0];
+struct ovsdb_error *error = NULL;
+
 if (schema_json->type != JSON_NULL) {
 struct ovsdb_schema *schema;
 check_ovsdb_error(ovsdb_schema_from_json(schema_json, &schema));
 ovsdb_schema_destroy(schema);
-check_ovsdb_error(ovsdb_log_write_and_free(db_log_data,
-   schema_json));
+error = ovsdb_log_write(db_log_data, schema_json);
 }
 
-struct json *data_json = json_array(h->snap.data)->elems[1];
-if (!data_json || data_json->type != JSON_OBJECT) {
-ovs_fatal(0, "Invalid raft header data");
-}
-if (data_json->type != JSON_NULL) {
-check_ovsdb_error(ovsdb_log_write_and_free(db_log_data,
-   data_json));
+if (!error) {
+struct json *data_json = pa->elems[1];
+if (!data_json || data_json->type != JSON_OBJECT) {
+ovs_fatal(0, "Invalid raft header data");
+}
+if (data_json->type != JSON_NULL) {
+error = ovsdb_log_write(db_log_data, data_json);
+}
 }
+check_ovsdb_error(error);
 }
 }
 
@@ -982,14 +986,14 @@ raft_record_to_standalone_log(const struct raft_record *r,
 if (!r->entry.data) {
 return;
 }
-if (json_array(r->entry.data)->n != 2) {
+struct json_array *pa = json_array(r->entry.data);
+
+if (pa->n != 2) {
 ovs_fatal(0, "Incorrect raft record array length");
 }
-
-struct json *data_json = json_array(r->entry.data)->elems[1];
+struct json *data_json = pa->elems[1];
 if (data_json->type != JSON_NULL) {
-check_ovsdb_error(ovsdb_log_write_and_free(db_log_data,
-   data_json));
+check_ovsdb_error(ovsdb_log_write(db_log_data, data_json));
 }
 }
 }
@@ -1584,6 +1588,7 @@ do_convert_to_standalone(struct ovsdb_log *log, struct 
ovsdb_log *db_log_data)
 raft_record_to_standalone_log(&r, db_log_data);
 raft_record_uninit(&r);
 }
+json_destroy(json);
 }
 }
 
-- 
2.7.4

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