Re: [vpp-dev] MemIf interface selection for TX traffic

2019-07-01 Thread Damjan Marion via Lists.Fd.Io

> On 1 Jul 2019, at 12:40, Satya Murthy  wrote:
> 
> Hi ,
> 
> Have a question on the Memif TX interface selection.
> 
> I have VPP with 2 worker threads connecting to an external application.
> Have two memif interfaces, so that each thread can make use of one Memif 
> interface dedicately.
> 
> show memif
> 
> interface memif0/0
>   remote-name "remoteApp"
>   remote-interface "remoteIf"
>   socket-id 0 id 0 mode ip
>   flags admin-up connected
>   listener-fd 39 conn-fd 38
>   num-s2m-rings 1 num-m2s-rings 1 buffer-size 0 num-regions 2
>   region 0 size 65792 fd 43
>   region 1 size 264241152 fd 44
> master-to-slave ring 0:
>   region 0 offset 32896 ring-size 2048 int-fd 52
>   head 5303 tail 3255 flags 0x interrupts 1434
> slave-to-master ring 0:
>   region 0 offset 0 ring-size 2048 int-fd 48
>   head 6480 tail 6480 flags 0x0001 interrupts 0
> 
> interface memif0/1
>   remote-name "remoteApp"
>   remote-interface "remoteIf"
>   socket-id 0 id 1 mode ip
>   flags admin-up connected
>   listener-fd 39 conn-fd 40
>   num-s2m-rings 1 num-m2s-rings 1 buffer-size 0 num-regions 2
>   region 0 size 65792 fd 46
>   region 1 size 264241152 fd 50
> master-to-slave ring 0:
>   region 0 offset 32896 ring-size 2048 int-fd 57
>   head 2048 tail 0 flags 0x interrupts 0
> slave-to-master ring 0:
>   region 0 offset 0 ring-size 2048 int-fd 54
>   head 0 tail 0 flags 0x0001 interrupts 0
>  
> Added IP addresses on these two interfaces as below.
> 
> memif0/0 ==> 1.1.1.2
> memif0/1 ==> 2.2.2.2
> 
> Correspondingly, on the remote APP, I created IP endpoints like 1.1.1.1 and 
> 2.2.2.1
> 
> When I try to ping 1.1.1.1 from VPP, I expect that it will go memif0/0, but 
> it is going memif0/1
> 
> So, my question here is, what is the logic here for memif device selection 
> for TX traffic.
> 
> I see the code as below:
> VNET_DEVICE_CLASS_TX_FN (memif_device_class) (vlib_main_t * vm,
>   vlib_node_runtime_t * node,
>   vlib_frame_t * frame)
> {
>   memif_main_t *nm = &memif_main;
>   vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
>   memif_if_t *mif = pool_elt_at_index (nm->interfaces, rund->dev_instance);  
> > memif interface selection
> 
> I didnt quite understand the above logic and not sure if this will be helpful 
> to tie up a thread/IP interface to a particular memif interface or not.
> 
> Is there a way, where the TX traffic can be tied to a particular memif 
> Interface ?

Yes, as long as you sending traffic to the right interface it is tied to that 
interface.

you are probably doing something very wrong if you see packets going out on the 
wrong interface.

in your setup you have just one tx queue, and  that one is shared by both 
workers and main thread.
There is spinlock in the tx code which prevents workers from stepping on each 
other toes….





-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#13407): https://lists.fd.io/g/vpp-dev/message/13407
Mute This Topic: https://lists.fd.io/mt/32270034/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


[vpp-dev] MemIf interface selection for TX traffic

2019-07-01 Thread Satya Murthy
Hi ,

Have a question on the Memif TX interface selection.

I have VPP with 2 worker threads connecting to an external application.
Have two memif interfaces, so that each thread can make use of one Memif 
interface dedicately.

show memif

interface memif0/0
remote-name "remoteApp"
remote-interface "remoteIf"
socket-id 0 id 0 mode ip
flags admin-up connected
listener-fd 39 conn-fd 38
num-s2m-rings 1 num-m2s-rings 1 buffer-size 0 num-regions 2
region 0 size 65792 fd 43
region 1 size 264241152 fd 44
master-to-slave ring 0:
region 0 offset 32896 ring-size 2048 int-fd 52
head 5303 tail 3255 flags 0x interrupts 1434
slave-to-master ring 0:
region 0 offset 0 ring-size 2048 int-fd 48
head 6480 tail 6480 flags 0x0001 interrupts 0

interface memif0/1
remote-name "remoteApp"
remote-interface "remoteIf"
socket-id 0 id 1 mode ip
flags admin-up connected
listener-fd 39 conn-fd 40
num-s2m-rings 1 num-m2s-rings 1 buffer-size 0 num-regions 2
region 0 size 65792 fd 46
region 1 size 264241152 fd 50
master-to-slave ring 0:
region 0 offset 32896 ring-size 2048 int-fd 57
head 2048 tail 0 flags 0x interrupts 0
slave-to-master ring 0:
region 0 offset 0 ring-size 2048 int-fd 54
head 0 tail 0 flags 0x0001 interrupts 0

Added IP addresses on these two interfaces as below.

memif0/0 ==> 1.1.1.2
memif0/1 ==> 2.2.2.2

Correspondingly, on the remote APP, I created IP endpoints like 1.1.1.1 and 
2.2.2.1

When I try to ping 1.1.1.1 from VPP, I expect that it will go memif0/0, but it 
is going memif0/1

So, my question here is, what is the logic here for memif device selection for 
TX traffic.

I see the code as below:
VNET_DEVICE_CLASS_TX_FN (memif_device_class) (vlib_main_t * vm,
vlib_node_runtime_t * node,
vlib_frame_t * frame)
{
memif_main_t *nm = &memif_main;
vnet_interface_output_runtime_t *rund = (void *) node->runtime_data;
memif_if_t *mif = pool_elt_at_index (nm->interfaces, rund->dev_instance);  
> memif interface selection

I didnt quite understand the above logic and not sure if this will be helpful 
to tie up a thread/IP interface to a particular memif interface or not.

Is there a way, where the TX traffic can be tied to a particular memif 
Interface ?

--
Thanks & Regards,
Murthy
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#13406): https://lists.fd.io/g/vpp-dev/message/13406
Mute This Topic: https://lists.fd.io/mt/32270034/21656
Group Owner: vpp-dev+ow...@lists.fd.io
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-