DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Singh, Jasvinder" <jasvinder.singh@intel.com>
To: "ravulakollu.kumar@wipro.com" <ravulakollu.kumar@wipro.com>,
	"dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] How classification happens in scheduling ?
Date: Wed, 20 Jan 2016 14:32:50 +0000	[thread overview]
Message-ID: <54CBAA185211B4429112C315DA58FF6DDB0234@IRSMSX103.ger.corp.intel.com> (raw)
In-Reply-To: <HK2PR03MB1780698FB05DA00905ED2292E4C20@HK2PR03MB1780.apcprd03.prod.outlook.com>

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

      reply	other threads:[~2016-01-20 14:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-20 12:06 ravulakollu.kumar
2016-01-20 14:32 ` Singh, Jasvinder [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54CBAA185211B4429112C315DA58FF6DDB0234@IRSMSX103.ger.corp.intel.com \
    --to=jasvinder.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=ravulakollu.kumar@wipro.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).