[vpp-dev] vapi message length error with variable length string type

2021-07-13 Thread jiangxiaoming
Hi guys,
Currently vapi message length is determined by sizeof(vapi_msg_) when 
alloced by vapi_msg_alloc. But if the vapi message has a variable length string 
type *string xxx[]* , the message real length can be changed, this will make 
vapi message length check error.

For example, cli_inband message in src/vpp/api/vpe.api

> 
> 
> 
> define cli_inband
> {
> 
> 
> 
> u32 client_index;
> 
> 
> 
> u32 context;
> 
> 
> 
> string cmd[];
> 
> 
> 
> };
> 
> 

in vpp-api/vapi/vpe.api.vapi.h, the message length is calculated to 
sizeof(vapi_msg_cli_inband),

* typedef struct __attribute__ ((__packed__)) {
* vl_api_string_t cmd;
* } vapi_payload_cli_inband;
* 
* typedef struct __attribute__ ((__packed__)) {
* vapi_type_msg_header2_t header;
* vapi_payload_cli_inband payload;
* } vapi_msg_cli_inband;
* 
* static inline vapi_msg_cli_inband* vapi_alloc_cli_inband(struct vapi_ctx_s 
*ctx)
* {
* vapi_msg_cli_inband *msg = NULL;
* const size_t size = sizeof(vapi_msg_cli_inband);
* /* cast here required to play nicely with C++ world ... */
* msg = (vapi_msg_cli_inband*)vapi_msg_alloc(ctx, size);
* if (!msg) {
* return NULL;
* }
* msg->header.client_index = vapi_get_client_index(ctx);
* msg->header.context = 0;
* msg->header._vl_msg_id = vapi_lookup_vl_msg_id(ctx, vapi_msg_id_cli_inband);
* return msg;
* }
* 
* static void
* vl_api_cli_inband_t_handler (vl_api_cli_inband_t * mp)
* {
* vl_api_cli_inband_reply_t *rmp;
* int rv = 0;
* vlib_main_t *vm = vlib_get_main ();
* unformat_input_t input;
* u8 *out_vec = 0;
* u8 *cmd_vec = 0;
* 
* if (vl_msg_api_get_msg_length (mp) <
* vl_api_string_len (>cmd) + sizeof (*mp))
* {
* rv = -1;
* goto error;
* }
* 
* cmd_vec = vl_api_from_api_to_new_vec (mp, >cmd);
* .
* }

After setting cmd field,  the message real length will more then 
sizeof(vapi_msg_cli_inband), This will make vl_api_cli_inband_t_handler and 
vl_api_from_api_to_new_vec failed.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19762): https://lists.fd.io/g/vpp-dev/message/19762
Mute This Topic: https://lists.fd.io/mt/84195057/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [EXTERNAL] [vpp-dev] Multi-threading locks and synchronization

2021-07-13 Thread Damjan Marion via lists.fd.io


> On 13.07.2021., at 18:41, satish amara  wrote:
> 
> Sync is needed. It's a question about the design of packet flow in  VPP. 
> Locks can be avoided if the packets in a flow are processed by the same 
> thread.  

You can use the handoff to make sure all packets belonging to specific flow or 
session end up on the same thread.

You can use bihash to store both thread_index and per-thread flow/session index 
in hash result. Bihash have per-bucket locks so it is safe to use single hash 
table from different workers.

After lookup you can simply compare lookup result thread_index with current 
thread index. if they are different you simply handoff packet to other thread, 
if they are the same you continue processing packets on the same thread.

After that you can build all your data structures as per-thread and avoid 
locking or atomics.

— 
Damjan



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19761): https://lists.fd.io/g/vpp-dev/message/19761
Mute This Topic: https://lists.fd.io/mt/84186832/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev] VPP on different Linux Platforms

2021-07-13 Thread Damjan Marion via lists.fd.io


> On 13.07.2021., at 19:40, satish amara  wrote:
> 
> Hi,
>   Currently, the VPP code can be compiled only on RedHat, CentOS, and Ubuntu. 
> Can I compile the VPP code on other OS Linux flavors, I see it's hardcoded in 
> the makefile. I am trying to understand by changing the Makefile VPP code can 
> be compiled on other Linux platforms or is there any specific Linux flavors 
> dependency.

Assuming that you have all dependencies installed on your system, you should be 
able to compile vpp. Worst case you can invoke cmake directly or just use 
experimental ./configure script

— 
Damjan


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19760): https://lists.fd.io/g/vpp-dev/message/19760
Mute This Topic: https://lists.fd.io/mt/84184116/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[vpp-dev] VPP on different Linux Platforms

2021-07-13 Thread satish amara
Hi,
  Currently, the VPP code can be compiled only on RedHat, CentOS, and
Ubuntu. Can I compile the VPP code on other OS Linux flavors, I see it's
hardcoded in the makefile. I am trying to understand by changing
the Makefile VPP code can be compiled on other Linux platforms or is there
any specific Linux flavors dependency.

Thanks,
Satish Amara.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19759): https://lists.fd.io/g/vpp-dev/message/19759
Mute This Topic: https://lists.fd.io/mt/84184116/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[vpp-dev] Need help on IPSEC tunnel

2021-07-13 Thread nikhil subhedar
 Greetings of the day...
I am facing a problem in ip-node lookup.  Here is the sequence.

1) decrypting the  esp packet at *esp4-decrypt-tun.*
2) packet is reaching to* ip4-input-no-checksum *which is nothing but
the *ip4-lookup
.*
3)From *ip4-input-no-checksum *ideally it should  reach to
* ip-4lookup/ip4-lookup.*

But in my case from  *ip4-input-no-checksum* it is going to
*ip4-not-enabled*

*Can you please help me in this regard?*

*Thanks in advance.*
*Nikhil*

*Here is the trace.*






























*  IPSEC_ESP: 20.20.147.217 -> 20.20.147.220tos 0x00, ttl 64, length
120, checksum 0xea76 dscp CS0 ecn NON_ECNfragment id 0x, flags
DONT_FRAGMENT00:03:11:387399: ip4-localIPSEC_ESP: 20.20.147.217 ->
20.20.147.220  tos 0x00, ttl 64, length 120, checksum 0xea76 dscp CS0
ecn NON_ECN  fragment id 0x, flags DONT_FRAGMENT00:03:11:387402:
ipsec4-tun-input  IPSec: remote:20.20.147.217 spi:12347 (0x303b) seq 1
sa 100:03:11:387413: esp4-decrypt-tun  esp: crypto aes-cbc-256 integrity
sha1-96 pkt-seq 1 sa-seq 1 sa-seq-hi 000:03:11:387471:
ip4-input-no-checksum  TCP: 10.10.10.10 -> 30.30.30.30tos 0x00, ttl 64,
length 60, checksum 0x4eb7 dscp CS0 ecn NON_ECNfragment id 0x9bb5,
flags DONT_FRAGMENT  TCP: 3268 -> 1234seq. 0xe5076078 ack 0x
flags 0x02 SYN, tcp header: 40 byteswindow 64240, checksum
0xca5800:03:11:387473: ip4-not-enabledTCP: 10.10.10.10 -> 30.30.30.30
tos 0x00, ttl 64, length 60, checksum 0x4eb7 dscp CS0 ecn NON_ECN
fragment id 0x9bb5, flags DONT_FRAGMENTTCP: 3268 -> 1234  seq.
0xe5076078 ack 0x  flags 0x02 SYN, tcp header: 40 bytes
window 64240, checksum 0xca5800:03:11:387479: error-drop
rx:ipip000:03:11:387481: drop  ip4-local: unknown ip protocol*



-- 
Regards,
Nikhil

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19758): https://lists.fd.io/g/vpp-dev/message/19758
Mute This Topic: https://lists.fd.io/mt/84182906/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [EXTERNAL] Re: [vpp-dev] Multi-threading locks and synchronization

2021-07-13 Thread satish amara
Sync is needed. It's a question about the design of packet flow in  VPP. Locks 
can be avoided if the packets in a flow are processed by the same thread.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19757): https://lists.fd.io/g/vpp-dev/message/19757
Mute This Topic: https://lists.fd.io/mt/84165477/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev] having problem pinging gtpu_tunnel0 interface, says Failed: no source address for egress interface

2021-07-13 Thread Neale Ranns
Hi Venu,


vagrant@ ~/vpp (master) $ grep -A1 -B1 gtpu  MAINTAINERS

Plugin - GTPU

I:gtpu

M:Hongjun Ni <>

F:src/plugins/gtpu/


But the problem of ping on GTPU interfaces is not specific to GTPU, it’s a 
problem on all P2P interfaces. It’s something I need to fix.

/neale


From: Venumadhav Josyula 
Date: Tuesday, 13 July 2021 at 11:53
To: Neale Ranns 
Cc: bga...@cisco.com , vpp-dev 
Subject: Re: [vpp-dev] having problem pinging gtpu_tunnel0 interface, says 
Failed: no source address for egress interface
Hi Neale,

Sorry for the late reply, the below patch worked for me. Can you let me know 
who is the gtpu mainrainer ?

Thanks,
Regards,
Venu

On Thu, 8 Jul 2021 at 19:15, Neale Ranns 
mailto:ne...@graphiant.com>> wrote:

Try this one:
  https://gerrit.fd.io/r/c/vpp/+/32801

/neale

From: vpp-dev@lists.fd.io 
mailto:vpp-dev@lists.fd.io>> on behalf of Benoit Ganne 
(bganne) via lists.fd.io 
mailto:cisco@lists.fd.io>>
Date: Thursday, 8 July 2021 at 15:08
To: Venumadhav Josyula mailto:vjosy...@gmail.com>>
Cc: vpp-dev mailto:vpp-dev@lists.fd.io>>
Subject: Re: [vpp-dev] having problem pinging gtpu_tunnel0 interface, says 
Failed: no source address for egress interface
> Can this be issue
> https://gerrit.fd.io/r/c/vpp/+/31315

Unfortunately not, because it is already present in 21.06.

ben

> I am using
>Branch details
>[root@hng4 vpp]# git log
>commit fc83f8cc67e65c734df3c47518f724c1617e1a5c
>Author: Andrew Yourtchenko 
> mailto:ayour...@gmail.com>
> 
>    
>  > >
>Date:   Wed May 26 14:52:41 2021 +
>
>misc: 21.06 Release Notes
>
>Change-Id: Iedd1263a971e50aceb2d579982484dd8873814dc
>Type: docs
>Signed-off-by: Andrew Yourtchenko 
> mailto:ayour...@gmail.com>
> 
>    
>  > >
>Signed-off-by: Dave Wallace 
> mailto:dwallac...@gmail.com>
> 
>    
>  > >
>
>commit 3001c0344e4fce34b824df988ced2c8ccbee82e3
>Author: Florin Coras mailto:fco...@cisco.com> 
> 
>   > 
> >
>Date:   Tue Jun 29 13:27:45 2021 -0700
>
>session: free ctrl event data on connect rpc
>
>Type: fix
>
>Signed-off-by: Florin Coras 
> mailto:fco...@cisco.com>
> 
>     
> > >
>Change-Id: I56c4682aef59ed0e69073f9001341c425e65bd48
>(cherry picked from commit
>   595724a49072b30356e365ce78a3cc815980d342)
>
>commit f68dcb720cfbbfb0eee7084219af45b35bd0615f
>Author: wanghanlin 
> mailto:wanghan...@corp.netease.com>
> 
>    
> 
> > >
>Date:   Tue Jun 29 16:01:55 2021 +0800
>
>vcl: Don't use app_socket_api to notify VPP in parent when
> child
>   exited
>
>Type: fix
>
>Signed-off-by: wanghanlin 
> mailto:wanghan...@corp.netease.com>
> 
>    
> 
> > >
>Change-Id: Icd2fc3cc2d0a0a6060abfb262044cf9e09ab4ba2
>(cherry picked from commit
>   b940fd4d5a16b62a5aa09b924140a135fd06c6bb)
>
>commit 803ac6389dbd3f3c124542c1a5ad40c575537ccc
>[root@hng4 vpp]# git branch
>  master
>* stable/2106
>[root@hng4 vpp]#
>
>We have built vpp out of stabe/2106 branch fdio repo
> [root@hng4 vpp]# git branch
>   master
> * stable/2106
> [root@hng4 vpp]#
>
> Thanks,
> Regards,
> Venu
>
> On Thu, 8 Jul 2021 at 17:33, Venumadhav Josyula via 
> lists.fd.io
>   
> mailto:gmail@lists.fd.io>
>  > wrote:
>
>
>Hi Benoit,
>
>Small correction vpp2 interface ip is should read as 
> 10.21.58.140/16
>    I had those correct ip
>
>
>Though the problem is not solved.
>
>Thanks,
>Regards,
>Venu
>
>
>On Thu, 8 Jul 2021 at 17:27, Venumadhav Josyula via 
> lists.fd.io
>   
> mailto:gmail@lists.fd.io>
>  > wrote:
>
>
>Hi Benoit,
>
>We tried
>vpp# ping ?
>  ping  ping { | ipv4  | ipv6
> } [ipv4  | ipv6 ] 

Re: [vpp-dev] View IPv6 default route

2021-07-13 Thread Neale Ranns


DBGvpp# sh ip6 fib ::/0

ipv6-VRF:0, fib_index:0, flow hash:[src dst sport dport proto flowlabel ] 
epoch:0 flags:none locks:[default-route:1, ]

::/0 fib:0 index:5 locks:2

  default-route refs:1 entry-flags:drop, src-flags:added,contributing,active,

path-list:[7] locks:2 flags:drop, uPRF-list:5 len:0 itfs:[]

  path:[7] pl-index:7 ip6 weight=1 pref=0 special:  cfg-flags:drop,

[@0]: dpo-drop ip6



 forwarding:   unicast-ip6-chain

  [@0]: dpo-load-balance: [proto:ip6 index:6 buckets:1 uRPF:5 to:[0:0]]

[0] [@0]: dpo-drop ip6


/neale


From: vpp-dev@lists.fd.io  on behalf of Chinmaya Aggarwal 
via lists.fd.io 
Date: Tuesday, 13 July 2021 at 14:08
To: vpp-dev@lists.fd.io 
Subject: [vpp-dev] View IPv6 default route
Hi,

How can we get IPv6 default routes using vpp cli?

Thanks and Regards,
Chinmaya Agarwal.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19755): https://lists.fd.io/g/vpp-dev/message/19755
Mute This Topic: https://lists.fd.io/mt/84176732/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [EXTERNAL] Re: [vpp-dev] Multi-threading locks and synchronization

2021-07-13 Thread Chris Luke via lists.fd.io
Really depends on what you need it to do, which I may have missed. Why do you 
need any synchronization at all?

Chris


From: vpp-dev@lists.fd.io  on behalf of satish amara 

Date: Monday, July 12, 2021 at 23:59
To: vpp-dev@lists.fd.io 
Subject: Re: [EXTERNAL] Re: [vpp-dev] Multi-threading locks and synchronization
Thank you for your explanation.  What is recommended way if a custom plugin is 
working on multiple threads. Direct the packet in the same flow to the same 
thread or use spinlocks for synchronization. It looks like for IPSEC VPP code 
is trying the process the packets on the same flow on the same thread.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19754): https://lists.fd.io/g/vpp-dev/message/19754
Mute This Topic: https://lists.fd.io/mt/84165477/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[vpp-dev] View IPv6 default route

2021-07-13 Thread Chinmaya Aggarwal
Hi,

How can we get IPv6 default routes using vpp cli?

Thanks and Regards,
Chinmaya Agarwal.

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19753): https://lists.fd.io/g/vpp-dev/message/19753
Mute This Topic: https://lists.fd.io/mt/84176732/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev] having problem pinging gtpu_tunnel0 interface, says Failed: no source address for egress interface

2021-07-13 Thread Venumadhav Josyula
Hi Neale,

Sorry for the late reply, the below patch worked for me. Can you let me
know who is the gtpu mainrainer ?

Thanks,
Regards,
Venu

On Thu, 8 Jul 2021 at 19:15, Neale Ranns  wrote:

>
>
> Try this one:
>
>   https://gerrit.fd.io/r/c/vpp/+/32801
>
>
>
> /neale
>
>
>
> *From: *vpp-dev@lists.fd.io  on behalf of Benoit
> Ganne (bganne) via lists.fd.io 
> *Date: *Thursday, 8 July 2021 at 15:08
> *To: *Venumadhav Josyula 
> *Cc: *vpp-dev 
> *Subject: *Re: [vpp-dev] having problem pinging gtpu_tunnel0 interface,
> says Failed: no source address for egress interface
>
> > Can this be issue
> > https://gerrit.fd.io/r/c/vpp/+/31315
>
> Unfortunately not, because it is already present in 21.06.
>
> ben
>
> > I am using
> >Branch details
> >[root@hng4 vpp]# git log
> >commit fc83f8cc67e65c734df3c47518f724c1617e1a5c
> >Author: Andrew Yourtchenko  > 
> >    > > >
> >Date:   Wed May 26 14:52:41 2021 +
> >
> >misc: 21.06 Release Notes
> >
> >Change-Id: Iedd1263a971e50aceb2d579982484dd8873814dc
> >Type: docs
> >Signed-off-by: Andrew Yourtchenko  > 
> >    > > >
> >Signed-off-by: Dave Wallace  > 
> >    > > >
> >
> >commit 3001c0344e4fce34b824df988ced2c8ccbee82e3
> >Author: Florin Coras mailto:fco...@cisco.com
> >
> >  >
> >
> >Date:   Tue Jun 29 13:27:45 2021 -0700
> >
> >session: free ctrl event data on connect rpc
> >
> >Type: fix
> >
> >Signed-off-by: Florin Coras  > 
> >   
> > >
> >Change-Id: I56c4682aef59ed0e69073f9001341c425e65bd48
> >(cherry picked from commit
> >   595724a49072b30356e365ce78a3cc815980d342)
> >
> >commit f68dcb720cfbbfb0eee7084219af45b35bd0615f
> >Author: wanghanlin  > 
> >    mailto:wanghan...@corp.netease.com >
> > > >
> >Date:   Tue Jun 29 16:01:55 2021 +0800
> >
> >vcl: Don't use app_socket_api to notify VPP in parent when
> > child
> >   exited
> >
> >Type: fix
> >
> >Signed-off-by: wanghanlin  > 
> >    mailto:wanghan...@corp.netease.com >
> > > >
> >Change-Id: Icd2fc3cc2d0a0a6060abfb262044cf9e09ab4ba2
> >(cherry picked from commit
> >   b940fd4d5a16b62a5aa09b924140a135fd06c6bb)
> >
> >commit 803ac6389dbd3f3c124542c1a5ad40c575537ccc
> >[root@hng4 vpp]# git branch
> >  master
> >* stable/2106
> >[root@hng4 vpp]#
> >
> >We have built vpp out of stabe/2106 branch fdio repo
> > [root@hng4 vpp]# git branch
> >   master
> > * stable/2106
> > [root@hng4 vpp]#
> >
> > Thanks,
> > Regards,
> > Venu
> >
> > On Thu, 8 Jul 2021 at 17:33, Venumadhav Josyula via lists.fd.io
> >    >  > wrote:
> >
> >
> >Hi Benoit,
> >
> >Small correction vpp2 interface ip is should read as
> 10.21.58.140/16
> >    I had those correct ip
> >
> >
> >Though the problem is not solved.
> >
> >Thanks,
> >Regards,
> >Venu
> >
> >
> >On Thu, 8 Jul 2021 at 17:27, Venumadhav Josyula via lists.fd.io
> >    >  > wrote:
> >
> >
> >Hi Benoit,
> >
> >We tried
> >vpp# ping ?
> >  ping  ping { | ipv4  |
> ipv6
> > } [ipv4  | ipv6 ] [source ]
> [size
> > ] [interval ] [repeat ] [table-id ]
> [burst
> > ] [verbose]
> >vpp# ping 50.50.50.1 source gtpu_tunnel0 repeat 1
> >Failed: no source address for egress interface
> >
> >Statistics: 0 sent, 0 received, 0% packet loss
> >vpp#
> >
> >It is not working
> >
> >Thanks,
> >Regards,
> >Venu
> >
> >
> >
> >On Thu, 8 Jul, 2021, 5:19 pm Benoit Ganne (bganne),
> > mailto:bga...@cisco.com > > wrote:
> >
> >
> >Hi,
> >
> >This looks like an issue with source address
> selection.
> > Does "ping 50.50.50.1 source gtpu_tunnel0" work?
> >
> >ben
> >
> >> -Original Message-
> >> From: vpp-dev@lists.fd.io <
> mailto:vpp-dev@lists.fd.io >
> > mailto:vpp-dev@lists.fd.io >
> > On Behalf Of
> > Venumadhav
> >> Josyula
>