Hi Uday,
> -----Original Message-----
> From: dev [mailto:dev-bounces at dpdk.org] On Behalf Of
> ravulakollu.kumar at wipro.com
> Sent: Wednesday, January 20, 2016 12:06 PM
> To: dev at dpdk.org
> Subject: [dpdk-dev] How classification happens in scheduling ?
> 
> Hi all,
> 
> Could someone explain me how this code snippet determining
> subport,pipe,traffic_class,queue,color.
> 
>         uint16_t *pdata = rte_pktmbuf_mtod(m, uint16_t *); //points to the
> start of the data in the mbuf
> 
>         *subport = (rte_be_to_cpu_16(pdata[SUBPORT_OFFSET]) & 0x0FFF)
> &(port_params.n_subports_per_port - 1); /* Outer VLAN ID*/
>         *pipe = (rte_be_to_cpu_16(pdata[PIPE_OFFSET]) & 0x0FFF) &
> (port_params.n_pipes_per_subport - 1); /* Inner VLAN ID */
>         *traffic_class = (pdata[QUEUE_OFFSET] & 0x0F) &
> (RTE_SCHED_TRAFFIC_CLASSES_PER_PIPE - 1); /* Destination IP */
>         *queue = ((pdata[QUEUE_OFFSET] >> 8) & 0x0F) &
> (RTE_SCHED_QUEUES_PER_TRAFFIC_CLASS - 1) ; /* Destination IP */
>         *color = pdata[COLOR_OFFSET] & 0x03;    /* Destination IP */
> 
> Thanks & Regards,
> Uday

To understand this, please refer to explanation (23.4) at 
http://dpdk.org/doc/guides/sample_app_ug/qos_scheduler.html 

The above code snippet is about  classifying the incoming traffic packets based 
on their QinQ double VLAN tags and the IP destination address.  
The subport ID and pipe ID  are determined by reading 12 bits svlan field at  
SUBPORT_OFFSET and 12 bits cvlan field at PIPE_OFFSET from the packet header. 
Traffic Class, pipe queue and color are determined by reading specific fields 
at offset  QUEUE_OFFSET  (Destination IP),  QUEUE_OFFSET  (Destination IP) and 
COLOR_OFFSET  (Destination IP) from the packet's header.
To read all these values from the packet header, first packet header fields 
need to be converted from big endian to CPU order.  Since these values should 
not exceed their maximum values determined from configuration file, therefore, 
"&" operation with parameters such as port_params.n_subports_per_port, 
port_params.n_pipes_per_subport etc is performed to upper limit them.   

For these kind of queries, please use users at dpdk.org.

Thanks,
Jasvinder

Reply via email to