Re: [vpp-dev] Packet tx functions via DPDK

2018-05-14 Thread Prashant Upadhyaya
Thanks a bunch Nitin, your mail helps me connect the dots -- the thing
I was missing was the connection with ethernet_register_interface()
Cool browsing done by you !
Please do check my other mail too on the list (for frames) and it
would be great if we can drill down on that topic too.

Regards
-Prashant


On Fri, May 11, 2018 at 7:08 PM, Nitin Saxena  wrote:
> Hi Prashant,
>
> Hope you are doing fine.
>
> Regarding your question, I am not able to see macswap plugin in current
> master branch but I will try to explain wrt dpdk_plugin:
>
> With respect to low level device each VPP device driver registers for
>
> 1) INPUT_NODE (For Rx) VLIB_REGISTER_NODE (This you already figured out)
> 2) And Tx function via VNET_DEVICE_CLASS (), Device class like "dpdk"
> There are couple of more function pointers registered but let stick to Rx/Tx
> part.
>
> As part of startup low level plugin/driver calls
> ethernet_register_interface() which in turn calls vnet_register_interface().
>
> vnet_register_interface:
> For a particular interface like Intel 40G, init time interface node is
> created and the tx function of that node is copied from
> VNET_DEVICE_CLASS{.tx_function="}. node->tx and node->output functions
> are properly initialized and node is registered.
>
> VPP stack sends packet to this low level Tx node via sw_if_index. I am
> guessing sw_if_index is determined by IPv4 routing or L2 switching.
>
> I think vnet_set_interface_output_node() is called for those interface (Tx
> path) whose DEVICE_CLASS do not provide tx_functions but I am not sure.
>
> "show vlib graph" will tell you how nodes are arranged in vpp graph.
>
> To be specific for your question
>
>   next0 = hi0->output_node_next_index;
>
> output_node_next_index is the index of next node at which the current vector
> has to be copied. (Transition from one node to another along the graph)
>
> Note: All this I got through browsing code and if this information is not
> correct, I request VPP experts to correct it.
>
> Thanks,
> Nitin
>
>
> On Thursday 10 May 2018 02:19 PM, Prashant Upadhyaya wrote:
>>
>> Hi,
>>
>> I am trying to walk throught the code to see how the packet arrives
>> into the system at dpdk rx side and finally leaves it at the dpdk tx
>> side. I am using the context of the macswap sample plugin for this.
>>
>> It is clear to me that dpdk-input is a graph node and it is an 'input'
>> type graph node so it polls for the packets using dpdk functions. The
>> frame is then eventually passed to the sample plugin because the
>> sample plugin inserts itself at the right place. The sample plugin
>> queues the packets to the interface-output graph node.
>>
>> So now I check the interface-output graph node function.
>> I locate that in vpp/src/vnet/interface_output.c
>> So the dispatch function for the graph node is
>> vnet_per_buffer_interface_output
>> Here the interface-output node is queueing the packets to a next node
>> based on the following code --
>>
>>   hi0 =
>>  vnet_get_sup_hw_interface (vnm,
>> vnet_buffer (b0)->sw_if_index
>> [VLIB_TX]);
>>
>>next0 = hi0->output_node_next_index;
>>
>> Now I am a little lost, what is this output_node_next_index ? Which
>> graph node function is really called for really emitting the packet ?
>> Where exactly is this setup ?
>>
>> I do see that the actual dpdk tx burst function is called from
>> tx_burst_vector_internal, which itself is called from
>> dpdk_interface_tx (vpp/src/plugins/dpdk/device/device.c). But how the
>> code reaches the dpdk_interface_tx after the packets are queued from
>> interface-output graph node is not clear to me. If somebody could help
>> me connect the dots, that would be great.
>>
>> Regards
>> -Prashant
>>
>> 
>>
>

-=-=-=-=-=-=-=-=-=-=-=-
Links:

You receive all messages sent to this group.

View/Reply Online (#9275): https://lists.fd.io/g/vpp-dev/message/9275
View All Messages In Topic (3): https://lists.fd.io/g/vpp-dev/topic/19023164
Mute This Topic: https://lists.fd.io/mt/19023164/21656
New Topic: https://lists.fd.io/g/vpp-dev/post

Change Your Subscription: https://lists.fd.io/g/vpp-dev/editsub/21656
Group Home: https://lists.fd.io/g/vpp-dev
Contact Group Owner: vpp-dev+ow...@lists.fd.io
Terms of Service: https://lists.fd.io/static/tos
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub
-=-=-=-=-=-=-=-=-=-=-=-



Re: [vpp-dev] Packet tx functions via DPDK

2018-05-11 Thread Nitin Saxena

Hi Prashant,

Hope you are doing fine.

Regarding your question, I am not able to see macswap plugin in current 
master branch but I will try to explain wrt dpdk_plugin:


With respect to low level device each VPP device driver registers for

1) INPUT_NODE (For Rx) VLIB_REGISTER_NODE (This you already figured out)
2) And Tx function via VNET_DEVICE_CLASS (), Device class like "dpdk"
There are couple of more function pointers registered but let stick to 
Rx/Tx part.


As part of startup low level plugin/driver calls 
ethernet_register_interface() which in turn calls 
vnet_register_interface().


vnet_register_interface:
For a particular interface like Intel 40G, init time interface node is 
created and the tx function of that node is copied from 
VNET_DEVICE_CLASS{.tx_function="}. node->tx and node->output 
functions are properly initialized and node is registered.


VPP stack sends packet to this low level Tx node via sw_if_index. I am 
guessing sw_if_index is determined by IPv4 routing or L2 switching.


I think vnet_set_interface_output_node() is called for those interface 
(Tx path) whose DEVICE_CLASS do not provide tx_functions but I am not sure.


"show vlib graph" will tell you how nodes are arranged in vpp graph.

To be specific for your question

  next0 = hi0->output_node_next_index;

output_node_next_index is the index of next node at which the current 
vector has to be copied. (Transition from one node to another along the 
graph)


Note: All this I got through browsing code and if this information is 
not correct, I request VPP experts to correct it.


Thanks,
Nitin

On Thursday 10 May 2018 02:19 PM, Prashant Upadhyaya wrote:

Hi,

I am trying to walk throught the code to see how the packet arrives
into the system at dpdk rx side and finally leaves it at the dpdk tx
side. I am using the context of the macswap sample plugin for this.

It is clear to me that dpdk-input is a graph node and it is an 'input'
type graph node so it polls for the packets using dpdk functions. The
frame is then eventually passed to the sample plugin because the
sample plugin inserts itself at the right place. The sample plugin
queues the packets to the interface-output graph node.

So now I check the interface-output graph node function.
I locate that in vpp/src/vnet/interface_output.c
So the dispatch function for the graph node is vnet_per_buffer_interface_output
Here the interface-output node is queueing the packets to a next node
based on the following code --

  hi0 =
 vnet_get_sup_hw_interface (vnm,
vnet_buffer (b0)->sw_if_index
[VLIB_TX]);

   next0 = hi0->output_node_next_index;

Now I am a little lost, what is this output_node_next_index ? Which
graph node function is really called for really emitting the packet ?
Where exactly is this setup ?

I do see that the actual dpdk tx burst function is called from
tx_burst_vector_internal, which itself is called from
dpdk_interface_tx (vpp/src/plugins/dpdk/device/device.c). But how the
code reaches the dpdk_interface_tx after the packets are queued from
interface-output graph node is not clear to me. If somebody could help
me connect the dots, that would be great.

Regards
-Prashant





-=-=-=-=-=-=-=-=-=-=-=-
Links:

You receive all messages sent to this group.

View/Reply Online (#9260): https://lists.fd.io/g/vpp-dev/message/9260
View All Messages In Topic (2): https://lists.fd.io/g/vpp-dev/topic/19023164
Mute This Topic: https://lists.fd.io/mt/19023164/21656
New Topic: https://lists.fd.io/g/vpp-dev/post

Change Your Subscription: https://lists.fd.io/g/vpp-dev/editsub/21656
Group Home: https://lists.fd.io/g/vpp-dev
Contact Group Owner: vpp-dev+ow...@lists.fd.io
Terms of Service: https://lists.fd.io/static/tos
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub
-=-=-=-=-=-=-=-=-=-=-=-



[vpp-dev] Packet tx functions via DPDK

2018-05-10 Thread Prashant Upadhyaya
Hi,

I am trying to walk throught the code to see how the packet arrives
into the system at dpdk rx side and finally leaves it at the dpdk tx
side. I am using the context of the macswap sample plugin for this.

It is clear to me that dpdk-input is a graph node and it is an 'input'
type graph node so it polls for the packets using dpdk functions. The
frame is then eventually passed to the sample plugin because the
sample plugin inserts itself at the right place. The sample plugin
queues the packets to the interface-output graph node.

So now I check the interface-output graph node function.
I locate that in vpp/src/vnet/interface_output.c
So the dispatch function for the graph node is vnet_per_buffer_interface_output
Here the interface-output node is queueing the packets to a next node
based on the following code --

 hi0 =
vnet_get_sup_hw_interface (vnm,
   vnet_buffer (b0)->sw_if_index
   [VLIB_TX]);

  next0 = hi0->output_node_next_index;

Now I am a little lost, what is this output_node_next_index ? Which
graph node function is really called for really emitting the packet ?
Where exactly is this setup ?

I do see that the actual dpdk tx burst function is called from
tx_burst_vector_internal, which itself is called from
dpdk_interface_tx (vpp/src/plugins/dpdk/device/device.c). But how the
code reaches the dpdk_interface_tx after the packets are queued from
interface-output graph node is not clear to me. If somebody could help
me connect the dots, that would be great.

Regards
-Prashant

-=-=-=-=-=-=-=-=-=-=-=-
Links:

You receive all messages sent to this group.

View/Reply Online (#9244): https://lists.fd.io/g/vpp-dev/message/9244
View All Messages In Topic (1): https://lists.fd.io/g/vpp-dev/topic/19023164
Mute This Topic: https://lists.fd.io/mt/19023164/21656
New Topic: https://lists.fd.io/g/vpp-dev/post

Change Your Subscription: https://lists.fd.io/g/vpp-dev/editsub/21656
Group Home: https://lists.fd.io/g/vpp-dev
Contact Group Owner: vpp-dev+ow...@lists.fd.io
Terms of Service: https://lists.fd.io/static/tos
Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub
-=-=-=-=-=-=-=-=-=-=-=-