Hi,

See comments inline

Liron
-----Original Message-----
From: Bala Manoharan [mailto:bala.manoha...@linaro.org] 
Sent: Friday, November 10, 2017 13:07
To: Liron Himi <lir...@marvell.com>
Cc: Savolainen, Petri (Nokia - FI/Espoo) <petri.savolai...@nokia.com>; 
lng-odp@lists.linaro.org
Subject: Re: [EXT] Re: [lng-odp] classifier with pktio in ODP_PKTIN_MODE_QUEUE

On 10 November 2017 at 15:52, Liron Himi <lir...@marvell.com> wrote:
> Hi,
>
> I understand what you are saying, but I don't understand (probably I 
> miss something here) how classifier is working in PKTIO in a 
> ODP_PKTIN_MODE_QUEUE mode.
> Application create its own queues, associate them to the cos and connect them 
> to the classifier.
> In order to receive packets, application will call ' odp_queue_deq()'. But 
> how the packets will be enqueued to this queue?
> Who will call ' odp_pktin_recv' to receive the packets, as in the schedule 
> mode case?

The classifier is efficient only when the platform has an HW classifier engine 
(using either a BCAM or TCAM). So when a platform has HW classifier support the 
packet is classified by the HW classification engine and is enqueued into the 
queue belonging to different CoS by the HW based on the classification rule.

The packets are received by the application by either calling
odp_queue_deq() or odp_schedule() depending upon the queue type either POLL or 
SCHEDULE which was linked to the CoS. odp_pktin_recv() function is only called 
for "odp_pktin_queue_t" type queues and this function odp_pktin_recv() is not 
called when classifier is enabled.

>
> Consider the following scenario and let me know if it is acceptable:
> Application wants to configure classifier but doesn't want to use the 
> odp-schedule. So,
> - PKTIO is configure with ' ODP_PKTIN_MODE_QUEUE' mode and classifier enable.
> - application will call ' odp_pktin_event_queue' to get all pktio's event 
> queues.
> - application will associate those queues in the desired cos and configure 
> the classifier with them.
> - application will call ' odp_queue_deq()' and as a result the ' 
> odp_pktin_recv' will be triggered (as it is a PKTIO's event queue).
>         Implementation should not set the 'dst_queue' in this mode and as a 
> result the packet will be return to originated queue.

The following example will have to be configured as follows Application wants 
to configure classifier but doesn't want to use odp-schedule
 - PKTIO is configured with "classifier_enable" set
- The application creates odp_queue_t of type POLL and links them as 
'dst_queue' to CoS Lets say CoS1.
- Application configures CoS to pktio based on classification rules - eg create 
a CoS1 with DST IP addr 10.10.x.x and link to queue1.
- When the packet is received by HW classification engine the engine will 
classify the packets and deliver to respective CoS and their associated 
dst_queues.
[L.H.] how this stage is triggered in this case? i.e. which component is 
calling the receive function of the PKTIO?
I don't see in the linux-generic code how this happened.
Maybe it is expected to set the ' dequeue_multi' of the queue once it's cos was 
somehow assigned to PKTIO. If so, does it means a queue can only be attached to 
one PKTIO?
- Since the application knows the queues which it has created and linked to 
CoS, the application will have to call 'odp_queue_deq()' on the odp_queue_t 
which was created by the application to receive the packets from different CoS.
- Based on the above configuration Lets s the pktio receives a packet with DST 
ip addr 10.10.x.x it will be delivered to queue1 (CoS1) and the application 
will have to call odp_queue_deq(queue1) to receive this packet.

Regards,
Bala

>
> Liron
>
> -----Original Message-----
> From: Bala Manoharan [mailto:bala.manoha...@linaro.org]
> Sent: Friday, November 10, 2017 11:27
> To: Liron Himi <lir...@marvell.com>
> Cc: lng-odp@lists.linaro.org
> Subject: Re: [EXT] Re: [lng-odp] classifier with pktio in 
> ODP_PKTIN_MODE_QUEUE
>
> Comments inline...
>
> On 10 November 2017 at 12:01, Liron Himi <lir...@marvell.com> wrote:
>> Hi Bala,
>>
>> According to the documentation, classifier can be operate with 
>> PKTIN_QUEUE_MODE.
>>         /** Enable classifier
>>           *
>>           * * 0: Classifier is disabled (default)
>>           * * 1: Classifier is enabled. Use classifier to direct incoming
>>           *      packets into pktin event queues. Classifier can be enabled
>>           *      only in ODP_PKTIN_MODE_SCHED and ODP_PKTIN_MODE_QUEUE modes.
>>           *      Both classifier and hashing cannot be enabled simultaneously
>>           *      ('hash_enable' must be 0). */
>>         odp_bool_t classifier_enable;
>>
>> So, Is there a mistake in the documentation or this combination should be 
>> supported?
>
> odp_pktin_event_queue() can only be used when hashing is enabled since when 
> you connect more than one queue to pktio you need some mechanism to spread 
> the traffic. This configuration is given using odp_pktin_hash_proto_t which 
> is valid only when hashing is enabled.
>
> Since classifier and hashing are orthogonal you cannot use classification and 
> get packets using event queues configured using odp_pktin_event_queue().
> Packets delivered after classification can be received by application either 
> using odp_queue_deq() or odp_schedule() function depending upon the dst_queue 
> configured with CoS.
>
> Regards,
> Bala
>
>>
>> Liron
>>
>> -----Original Message-----
>> From: Bala Manoharan [mailto:bala.manoha...@linaro.org]
>> Sent: Friday, November 10, 2017 07:18
>> To: Liron Himi <lir...@marvell.com>
>> Cc: lng-odp@lists.linaro.org
>> Subject: [EXT] Re: [lng-odp] classifier with pktio in 
>> ODP_PKTIN_MODE_QUEUE
>>
>> External Email
>>
>> ---------------------------------------------------------------------
>> -
>> Hi,
>>
>> Both these modes cannot co-exist.
>>
>> There is a parameter 'classifier_enable' and 'hash_enable' as part of 
>> odp_pktin_queue_param_t which is used to identify whether classifier or 
>> hashing is enabled for a particular pktio interface.
>> Both classifier and hash configuration are orthogonal and only one of the 
>> two can be enabled at any time. When you configure classification on the 
>> pktio interface then the packets will be routed only through classifier 
>> 'dst_queue' and not through event queues configured with the pktio interface 
>> and vice versa for 'hash_enable'.
>>
>> odp_pktin_event_queue() API is useful only for platforms which do not 
>> support classifier system. This is mainly targetted for HWs which only have 
>> RSS configured on the pktio and does not support flow-based classification. 
>> The same is documented in odp_pktin_queue_param_t structure pls check the 
>> documentation and let us know if you find any discrepancy.
>>
>> Hope this clarifies,
>> Bala
>>
>>
>> On 9 November 2017 at 23:04, Liron Himi <lir...@marvell.com> wrote:
>>> Hi,
>>>
>>> I'm trying to understand how odp-classifier can work with PKTIO in 
>>> ODP_PKTIN_MODE_QUEUE mode, as this combination is allow in the API.
>>> When configuring PKTIO in ODP_PKTIN_MODE_QUEUE then application should call 
>>> 'odp_pktin_event_queue' to retrieve the odp-queues.
>>> When application create a cos, to be used for classification, does it needs 
>>> to create new odp-queue or used the pktio's ones?
>>> When application wants to receive packets from this PKTIO, it needs to call 
>>> 'odp_queue_deq_multi' on one of the PKTIO's queues,right?
>>> As a result of a received packet, the matched cos is being selected and 
>>> it's queue is being set as the dst_queue of the packet.
>>> Then the 'pktin_recv_buf' function will enqueuer this packet to the 
>>> 'dst_queue' if it was set.
>>> So finally the packet will be located at the cos's queue and not at 
>>> the PKTIO's queue and the application will get zero packets from 
>>> 'odp_queue_deq_multi'.
>>> So, either this mode isn't supported with classifier or if this mode is set 
>>> then the 'dst_queue' shouldn't be set and the packets will be located at 
>>> the PKTIO's queue.
>>>
>>> Regards,
>>> Liron
>>>

Reply via email to