Re: [vpp-dev] Buffer chains and pre-data area

2021-07-19 Thread Benoit Ganne (bganne) via lists.fd.io
> I guess I should also modify the value of "DPDK RTE_PKTMBUF_HEADROOM" but
> I don't know how I can do it ? Indeed, I can't find where this variable is
> defined.

You should be able to change it here: 
https://git.fd.io/vpp/tree/build/external/packages/dpdk.mk#n14

Best
ben

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19827): https://lists.fd.io/g/vpp-dev/message/19827
Mute This Topic: https://lists.fd.io/mt/84230132/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] Buffer chains and pre-data area

2021-07-18 Thread Andrew Yourtchenko
Ah indeed, I missed that, sorry! Thanks! :-)

--a

> On 18 Jul 2021, at 16:59, Damjan Marion  wrote:
> 
> 
> 
> That was already suggested to Jerome, see his first email in this thread.
> 
> — 
> Damjan
> 
> 
>>> On 18.07.2021., at 16:05, Andrew Yourtchenko  wrote:
>>> 
>> Naive question: if someone needs a lot of space to prepend in front of the 
>> buffer, would it make sense to allocate an entire new buffer and place it as 
>> the very first one in the chain ? That would save a recompile and also me 
>> more generic and extensible (you can get 2,3,4,… buffers in the same fashion 
>> then?) I don’t know if we have the easy facility to do this in VPP, though.
>> 
>> This would avoid a recompile and would work on the wider range of setups, if 
>> it were possible…
>> 
>> --a
>> 
 On 17 Jul 2021, at 16:58, jerome.bay...@student.uliege.be wrote:
 
>>> 
>>> Hello Benoit,
>>> 
>>> Thank you for your answer about buffer allocation in batches, my solution 
>>> is way more efficient now.
>>> 
>>> However, I still want to try to change the value of the "PRE_DATA_SIZE" 
>>> cmake variable to see how it behaves with a greater value (i.e 256 instead 
>>> of 128). To do so, I followed the method given in the documentation at the 
>>> following url : 
>>> https://fd.io/docs/vpp/master/gettingstarted/developers/buildsystem/cmakeandninja.html#tinkering-with-build-options-ccmake.
>>> The issue is that once I've changed the value of the "PRE_DATA_SIZE" 
>>> variable, I press "c" to regenerate files that need to be regenerated and 
>>> then I get this error in cmake output :
>>> 
>>> CMake Error at cmake/misc.cmake:27 (_message):
>>>[1;31mDPDK RTE_PKTMBUF_HEADROOM (128) ;must be equal to PRE_DATA_SIZE
>>>(256)[m
>>>  Call Stack (most recent call first):
>>>plugins/dpdk/CMakeLists.txt:65 (message)
>>> 
>>> I guess I should also modify the value of "DPDK RTE_PKTMBUF_HEADROOM" but I 
>>> don't know how I can do it ? Indeed, I can't find where this variable is 
>>> defined.
>>> 
>>> Jérôme
>>> 
>>> De: "Benoit Ganne (bganne)" 
>>> À: "jerome bayaux" , vpp-dev@lists.fd.io
>>> Cc: "Justin Iurman" 
>>> Envoyé: Jeudi 15 Juillet 2021 19:16:32
>>> Objet: RE: Buffer chains and pre-data area
>>> 
>>> Hi Jerome,
>>> 
>>> > However, when I tried to perform some performance tests I was quite
>>> > disappointed by the results : the buffer allocation for each packet is not
>>> > efficient at all. My question is then : Is there any way to increase the
>>> > performances ? To allocate buffers, I use the function "vlib_buffer_alloc"
>>> > defined in "buffer_funcs.h" but is it the right function to use ?
>>> 
>>> Do you allocate buffers in batch? Let's say you want to encapsulate a batch 
>>> of packets, instead of doing:
>>> 
>>>   while (n_left)
>>> u32 bi
>>> vlib_buffer_t *b
>>> vlib_buffer_alloc(vm, &bi, 1)
>>> b = vlib_get_buffer (vm, bi)
>>> add b to the chain
>>> ...
>>> 
>>> You should do something like (allocation error checking etc. is left as an 
>>> exercise):
>>> 
>>>   u32 bi[VLIB_FRAME_SIZE]
>>>   vlib_buffer_t *bufs[VLIB_FRAME_SIZE]
>>>   vlib_buffer_alloc (vm, bi, n_left)
>>>   vlib_get_buffers (vm, bi, bufs, n_left)
>>> 
>>>   while (n_left)
>>> add bufs[i] to the chain
>>> ...
>>> 
>>> > In my case, the best option would be to have more space available in the
>>> > buffer's pre-data area but VPP does not seem to be built in a way that
>>> > allows easy modifications of the "PRE_DATA_SIZE" value. Am I right or is
>>> > there any "clean" method to change this value ?
>>> 
>>> It is define as a cmake variable and can be customize through eg. cmake-gui.
>>> 
>>> ben
>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19825): https://lists.fd.io/g/vpp-dev/message/19825
Mute This Topic: https://lists.fd.io/mt/84230132/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] Buffer chains and pre-data area

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

That was already suggested to Jerome, see his first email in this thread.

— 
Damjan


> On 18.07.2021., at 16:05, Andrew Yourtchenko  wrote:
> 
> Naive question: if someone needs a lot of space to prepend in front of the 
> buffer, would it make sense to allocate an entire new buffer and place it as 
> the very first one in the chain ? That would save a recompile and also me 
> more generic and extensible (you can get 2,3,4,… buffers in the same fashion 
> then?) I don’t know if we have the easy facility to do this in VPP, though.
> 
> This would avoid a recompile and would work on the wider range of setups, if 
> it were possible…
> 
> --a
> 
>>> On 17 Jul 2021, at 16:58, jerome.bay...@student.uliege.be wrote:
>>> 
>> 
>> Hello Benoit,
>> 
>> Thank you for your answer about buffer allocation in batches, my solution is 
>> way more efficient now.
>> 
>> However, I still want to try to change the value of the "PRE_DATA_SIZE" 
>> cmake variable to see how it behaves with a greater value (i.e 256 instead 
>> of 128). To do so, I followed the method given in the documentation at the 
>> following url : 
>> https://fd.io/docs/vpp/master/gettingstarted/developers/buildsystem/cmakeandninja.html#tinkering-with-build-options-ccmake.
>> The issue is that once I've changed the value of the "PRE_DATA_SIZE" 
>> variable, I press "c" to regenerate files that need to be regenerated and 
>> then I get this error in cmake output :
>> 
>> CMake Error at cmake/misc.cmake:27 (_message):
>>[1;31mDPDK RTE_PKTMBUF_HEADROOM (128) ;must be equal to PRE_DATA_SIZE
>>(256)[m
>>  Call Stack (most recent call first):
>>plugins/dpdk/CMakeLists.txt:65 (message)
>> 
>> I guess I should also modify the value of "DPDK RTE_PKTMBUF_HEADROOM" but I 
>> don't know how I can do it ? Indeed, I can't find where this variable is 
>> defined.
>> 
>> Jérôme
>> 
>> De: "Benoit Ganne (bganne)" 
>> À: "jerome bayaux" , vpp-dev@lists.fd.io
>> Cc: "Justin Iurman" 
>> Envoyé: Jeudi 15 Juillet 2021 19:16:32
>> Objet: RE: Buffer chains and pre-data area
>> 
>> Hi Jerome,
>> 
>> > However, when I tried to perform some performance tests I was quite
>> > disappointed by the results : the buffer allocation for each packet is not
>> > efficient at all. My question is then : Is there any way to increase the
>> > performances ? To allocate buffers, I use the function "vlib_buffer_alloc"
>> > defined in "buffer_funcs.h" but is it the right function to use ?
>> 
>> Do you allocate buffers in batch? Let's say you want to encapsulate a batch 
>> of packets, instead of doing:
>> 
>>   while (n_left)
>> u32 bi
>> vlib_buffer_t *b
>> vlib_buffer_alloc(vm, &bi, 1)
>> b = vlib_get_buffer (vm, bi)
>> add b to the chain
>> ...
>> 
>> You should do something like (allocation error checking etc. is left as an 
>> exercise):
>> 
>>   u32 bi[VLIB_FRAME_SIZE]
>>   vlib_buffer_t *bufs[VLIB_FRAME_SIZE]
>>   vlib_buffer_alloc (vm, bi, n_left)
>>   vlib_get_buffers (vm, bi, bufs, n_left)
>> 
>>   while (n_left)
>> add bufs[i] to the chain
>> ...
>> 
>> > In my case, the best option would be to have more space available in the
>> > buffer's pre-data area but VPP does not seem to be built in a way that
>> > allows easy modifications of the "PRE_DATA_SIZE" value. Am I right or is
>> > there any "clean" method to change this value ?
>> 
>> It is define as a cmake variable and can be customize through eg. cmake-gui.
>> 
>> ben
>> 
>> 
>> 
>> 
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19824): https://lists.fd.io/g/vpp-dev/message/19824
Mute This Topic: https://lists.fd.io/mt/84230132/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] Buffer chains and pre-data area

2021-07-18 Thread Andrew Yourtchenko
Naive question: if someone needs a lot of space to prepend in front of the 
buffer, would it make sense to allocate an entire new buffer and place it as 
the very first one in the chain ? That would save a recompile and also me more 
generic and extensible (you can get 2,3,4,… buffers in the same fashion then?) 
I don’t know if we have the easy facility to do this in VPP, though.

This would avoid a recompile and would work on the wider range of setups, if it 
were possible…

--a

> On 17 Jul 2021, at 16:58, jerome.bay...@student.uliege.be wrote:
> 
> 
> Hello Benoit,
> 
> Thank you for your answer about buffer allocation in batches, my solution is 
> way more efficient now.
> 
> However, I still want to try to change the value of the "PRE_DATA_SIZE" cmake 
> variable to see how it behaves with a greater value (i.e 256 instead of 128). 
> To do so, I followed the method given in the documentation at the following 
> url : 
> https://fd.io/docs/vpp/master/gettingstarted/developers/buildsystem/cmakeandninja.html#tinkering-with-build-options-ccmake.
> The issue is that once I've changed the value of the "PRE_DATA_SIZE" 
> variable, I press "c" to regenerate files that need to be regenerated and 
> then I get this error in cmake output :
> 
> CMake Error at cmake/misc.cmake:27 (_message):
>[1;31mDPDK RTE_PKTMBUF_HEADROOM (128) ;must be equal to PRE_DATA_SIZE
>(256)[m
>  Call Stack (most recent call first):
>plugins/dpdk/CMakeLists.txt:65 (message)
> 
> I guess I should also modify the value of "DPDK RTE_PKTMBUF_HEADROOM" but I 
> don't know how I can do it ? Indeed, I can't find where this variable is 
> defined.
> 
> Jérôme
> 
> De: "Benoit Ganne (bganne)" 
> À: "jerome bayaux" , vpp-dev@lists.fd.io
> Cc: "Justin Iurman" 
> Envoyé: Jeudi 15 Juillet 2021 19:16:32
> Objet: RE: Buffer chains and pre-data area
> 
> Hi Jerome,
> 
> > However, when I tried to perform some performance tests I was quite
> > disappointed by the results : the buffer allocation for each packet is not
> > efficient at all. My question is then : Is there any way to increase the
> > performances ? To allocate buffers, I use the function "vlib_buffer_alloc"
> > defined in "buffer_funcs.h" but is it the right function to use ?
> 
> Do you allocate buffers in batch? Let's say you want to encapsulate a batch 
> of packets, instead of doing:
> 
>   while (n_left)
> u32 bi
> vlib_buffer_t *b
> vlib_buffer_alloc(vm, &bi, 1)
> b = vlib_get_buffer (vm, bi)
> add b to the chain
> ...
> 
> You should do something like (allocation error checking etc. is left as an 
> exercise):
> 
>   u32 bi[VLIB_FRAME_SIZE]
>   vlib_buffer_t *bufs[VLIB_FRAME_SIZE]
>   vlib_buffer_alloc (vm, bi, n_left)
>   vlib_get_buffers (vm, bi, bufs, n_left)
> 
>   while (n_left)
> add bufs[i] to the chain
> ...
> 
> > In my case, the best option would be to have more space available in the
> > buffer's pre-data area but VPP does not seem to be built in a way that
> > allows easy modifications of the "PRE_DATA_SIZE" value. Am I right or is
> > there any "clean" method to change this value ?
> 
> It is define as a cmake variable and can be customize through eg. cmake-gui.
> 
> ben
> 
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19823): https://lists.fd.io/g/vpp-dev/message/19823
Mute This Topic: https://lists.fd.io/mt/84230132/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] Buffer chains and pre-data area

2021-07-17 Thread jerome . bayaux
Hello Benoit, 

Thank you for your answer about buffer allocation in batches, my solution is 
way more efficient now. 

However, I still want to try to change the value of the " PRE_DATA_SIZE " cmake 
variable to see how it behaves with a greater value (i.e 256 instead of 128). 
To do so, I followed the method given in the documentation at the following url 
: [ 
https://fd.io/docs/vpp/master/gettingstarted/developers/buildsystem/cmakeandninja.html#tinkering-with-build-options-ccmake
 | 
https://fd.io/docs/vpp/master/gettingstarted/developers/buildsystem/cmakeandninja.html#tinkering-with-build-options-ccmake
 ] . 
The issue is that once I've changed the value of the " PRE_DATA_SIZE " 
variable, I press "c" to regenerate files that need to be regenerated and then 
I get this error in cmake output : 

CMake Error at cmake/misc.cmake:27 (_message): 
[1;31mDPDK RTE_PKTMBUF_HEADROOM (128) ;must be equal to PRE_DATA_SIZE 
(256)[m 
Call Stack (most recent call first): 
plugins/dpdk/CMakeLists.txt:65 (message) 

I guess I should also modify the value of " DPDK RTE_PKTMBUF_HEADROOM" but I 
don't know how I can do it ? Indeed, I can't find where this variable is 
defined. 

Jérôme 


De: "Benoit Ganne (bganne)"  
À: "jerome bayaux" , vpp-dev@lists.fd.io 
Cc: "Justin Iurman"  
Envoyé: Jeudi 15 Juillet 2021 19:16:32 
Objet: RE: Buffer chains and pre-data area 

Hi Jerome, 

> However, when I tried to perform some performance tests I was quite 
> disappointed by the results : the buffer allocation for each packet is not 
> efficient at all. My question is then : Is there any way to increase the 
> performances ? To allocate buffers, I use the function "vlib_buffer_alloc" 
> defined in "buffer_funcs.h" but is it the right function to use ? 

Do you allocate buffers in batch? Let's say you want to encapsulate a batch of 
packets, instead of doing: 

while (n_left) 
u32 bi 
vlib_buffer_t *b 
vlib_buffer_alloc(vm, &bi, 1) 
b = vlib_get_buffer (vm, bi) 
add b to the chain 
... 

You should do something like (allocation error checking etc. is left as an 
exercise): 

u32 bi[VLIB_FRAME_SIZE] 
vlib_buffer_t *bufs[VLIB_FRAME_SIZE] 
vlib_buffer_alloc (vm, bi, n_left) 
vlib_get_buffers (vm, bi, bufs, n_left) 

while (n_left) 
add bufs[i] to the chain 
... 

> In my case, the best option would be to have more space available in the 
> buffer's pre-data area but VPP does not seem to be built in a way that 
> allows easy modifications of the "PRE_DATA_SIZE" value. Am I right or is 
> there any "clean" method to change this value ? 

It is define as a cmake variable and can be customize through eg. cmake-gui. 

ben 


-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19821): https://lists.fd.io/g/vpp-dev/message/19821
Mute This Topic: https://lists.fd.io/mt/84230132/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] Buffer chains and pre-data area

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


> On 15.07.2021., at 18:53, jerome.bay...@student.uliege.be wrote:
> 
> Dear vpp-dev,
> 
> I'm trying to do some IPv6 in IPv6 encapsulation with no tunnel configuration.
> 
> The objective is to encapsulate the received packet in an other IPv6 packet 
> that will also "contain" a Hop-by-hop extension header. In summary, the 
> structure of the final packet will look like this : Outer-IP6-Header -> 
> Hop-by-hop-extension-header -> Original packet.
> 
> The main concern here is that the size of the outer IP6 header + the size of 
> the extension header > 128 bytes sometimes. When it arrives, I cannot write 
> my data inside the buffer pre-data area because it has a size of 128 bytes. I 
> already asked for solutions previously and I was adviced to either increase 
> the size of the pre-data area by recompiling VPP or create a new buffer for 
> my data and then chain it to the original one. I was able to create a buffer 
> chain that seemed to work perfectly fine.
> 
> However, when I tried to perform some performance tests I was quite 
> disappointed by the results : the buffer allocation for each packet is not 
> efficient at all. My question is then : Is there any way to increase the 
> performances ? To allocate buffers, I use the function "vlib_buffer_alloc" 
> defined in "buffer_funcs.h" but is it the right function to use ?

I’m quite sure vlib_buffer_alloc() can allocate buffers very fast. hopefully 
you are not calling that function for one buffer at a time...

> 
> In my case, the best option would be to have more space available in the 
> buffer's pre-data area but VPP does not seem to be built in a way that allows 
> easy modifications of the "PRE_DATA_SIZE" value. Am I right or is there any 
> "clean" method to change this value ?

PRE_DATA_SIZE is compile time constant for a good reason. making it 
configurable will decrease performance of almost every dataplane component.

— 
Damjan
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#19792): https://lists.fd.io/g/vpp-dev/message/19792
Mute This Topic: https://lists.fd.io/mt/84230132/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] Buffer chains and pre-data area

2021-07-15 Thread Benoit Ganne (bganne) via lists.fd.io
Hi Jerome,

> However, when I tried to perform some performance tests I was quite
> disappointed by the results : the buffer allocation for each packet is not
> efficient at all. My question is then : Is there any way to increase the
> performances ? To allocate buffers, I use the function "vlib_buffer_alloc"
> defined in "buffer_funcs.h" but is it the right function to use ?

Do you allocate buffers in batch? Let's say you want to encapsulate a batch of 
packets, instead of doing:

  while (n_left)
u32 bi
vlib_buffer_t *b
vlib_buffer_alloc(vm, &bi, 1)
b = vlib_get_buffer (vm, bi)
add b to the chain
...

You should do something like (allocation error checking etc. is left as an 
exercise):

  u32 bi[VLIB_FRAME_SIZE]
  vlib_buffer_t *bufs[VLIB_FRAME_SIZE]
  vlib_buffer_alloc (vm, bi, n_left)
  vlib_get_buffers (vm, bi, bufs, n_left)

  while (n_left)
add bufs[i] to the chain
...

> In my case, the best option would be to have more space available in the
> buffer's pre-data area but VPP does not seem to be built in a way that
> allows easy modifications of the "PRE_DATA_SIZE" value. Am I right or is
> there any "clean" method to change this value ?

It is define as a cmake variable and can be customize through eg. cmake-gui.

ben

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



[vpp-dev] Buffer chains and pre-data area

2021-07-15 Thread jerome . bayaux
Dear vpp-dev, 

I'm trying to do some IPv6 in IPv6 encapsulation with no tunnel configuration. 

The objective is to encapsulate the received packet in an other IPv6 packet 
that will also "contain" a Hop-by-hop extension header. In summary, the 
structure of the final packet will look like this : Outer-IP6-Header -> 
Hop-by-hop-extension-header -> Original packet. 

The main concern here is that the size of the outer IP6 header + the size of 
the extension header > 128 bytes sometimes. When it arrives, I cannot write my 
data inside the buffer pre-data area because it has a size of 128 bytes. I 
already asked for solutions previously and I was adviced to either increase the 
size of the pre-data area by recompiling VPP or create a new buffer for my data 
and then chain it to the original one. I was able to create a buffer chain that 
seemed to work perfectly fine. 

However, when I tried to perform some performance tests I was quite 
disappointed by the results : the buffer allocation for each packet is not 
efficient at all. My question is then : Is there any way to increase the 
performances ? To allocate buffers, I use the function " vlib_buffer_alloc " 
defined in " buffer_funcs.h " but is it the right function to use ? 

In my case, the best option would be to have more space available in the 
buffer's pre-data area but VPP does not seem to be built in a way that allows 
easy modifications of the " PRE_DATA_SIZE" value. Am I right or is there any 
"clean" method to change this value ? 

Thank you all already for your help, 

Jérôme 

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