All of lore.kernel.org
 help / color / mirror / Atom feed
* How classification happens in scheduling ?
@ 2016-01-20 12:06 ravulakollu.kumar
  2016-01-20 14:32 ` Singh, Jasvinder
  0 siblings, 1 reply; 2+ messages in thread
From: ravulakollu.kumar @ 2016-01-20 12:06 UTC (permalink / raw)
  To: dev

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
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. www.wipro.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How classification happens in scheduling ?
  2016-01-20 12:06 How classification happens in scheduling ? ravulakollu.kumar
@ 2016-01-20 14:32 ` Singh, Jasvinder
  0 siblings, 0 replies; 2+ messages in thread
From: Singh, Jasvinder @ 2016-01-20 14:32 UTC (permalink / raw)
  To: ravulakollu.kumar, dev

Hi Uday,


> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of
> ravulakollu.kumar@wipro.com
> Sent: Wednesday, January 20, 2016 12:06 PM
> To: dev@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@dpdk.org.

Thanks,
Jasvinder

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-01-20 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 12:06 How classification happens in scheduling ? ravulakollu.kumar
2016-01-20 14:32 ` Singh, Jasvinder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.