DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Varghese, Vipin" <vipin.varghese@intel.com>
To: "Wiles, Keith" <keith.wiles@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Yigit, Ferruh" <ferruh.yigit@intel.com>,
	"ophirmu@mellanox.com" <ophirmu@mellanox.com>,
	"thomas@monjalon.net" <thomas@monjalon.net>,
	"olgas@mellanox.com" <olgas@mellanox.com>
Subject: Re: [dpdk-dev] [PATCH v3] net/tap: perform proto field update for tun only
Date: Wed, 23 May 2018 04:33:12 +0000	[thread overview]
Message-ID: <4C9E0AB70F954A408CC4ADDBF0F8FA7D4D1F87F3@BGSMSX101.gar.corp.intel.com> (raw)
In-Reply-To: <DDAF44F1-BBC3-412F-B185-9B595DDB28DB@intel.com>

HI Keith,

Thanks for pointing out, please find my answer and update below

<Snipped> 

> > +			/*
> > +			 * TUN and TAP are created with IFF_NO_PI disabled.
> > +			 * For TUN PMD this mandatory as fields are used by
> > +			 * Kernel tun.c to determine whether its IP or non IP
> > +			 * packets.
> > +			 *
> > +			 * The logic fetches the first byte of data from mbuf
> > +			 * then compares whether its v4 or v6. If first byte
> > +			 * is 4 or 6, then protocol field is updated.
> > +			 */
> > +			char *buff_data = rte_pktmbuf_mtod(seg, void *);
> > +			j = (*buff_data & 0xf0);
> > +			pi.proto = (j == 0x40) ? 0x0008 :
> > 				(j == 0x60) ? 0xdd86 : 0x00;
> 
> Warning Will Robinson: Magic numbers :-)
> 
> Can we use the correct values here ETHERTYPE_IPV6 and ETHERTYPE_IP and
> then use htons() on the values please.

Earlier I refrained from doing this assuming htnos comparison is done for each packet leading to extra cycles. So updated the comments with explanation for logic explanation and readability. 

But I am ok to in co-operate the idea of using MACRO with htnos. I have used ETHER_TYPE_IPv4 and ETHER_TYPE_IPv6 which does not require extra include. The changes are available in v4 version.

> 
> > +		}


<Snipped>


  reply	other threads:[~2018-05-23  4:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  4:53 [dpdk-dev] [PATCH] " Vipin Varghese
2018-05-14 22:27 ` Wiles, Keith
2018-05-15  9:08   ` Varghese, Vipin
2018-05-15 14:49 ` [dpdk-dev] [PATCH v2] " Vipin Varghese
2018-05-15 12:31   ` Wiles, Keith
2018-05-15 22:28   ` Ophir Munk
2018-05-22  6:33     ` Varghese, Vipin
2018-05-22 11:05       ` Varghese, Vipin
2018-05-22 13:55         ` Wiles, Keith
2018-05-22 10:47   ` [dpdk-dev] [PATCH v3] " Vipin Varghese
2018-05-22 13:53     ` Wiles, Keith
2018-05-23  4:33       ` Varghese, Vipin [this message]
2018-05-22 15:04     ` Ophir Munk
2018-05-23  4:37       ` Varghese, Vipin
2018-05-22 22:04     ` [dpdk-dev] [PATCH v4] " Ferruh Yigit
2018-05-22 22:06       ` Ferruh Yigit
2018-05-22 22:09       ` [dpdk-dev] [PATCH v5] net/tap: fix proto field for tun Ferruh Yigit
2018-05-22 22:19         ` Ferruh Yigit
2018-05-22 22:25           ` Ferruh Yigit

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=4C9E0AB70F954A408CC4ADDBF0F8FA7D4D1F87F3@BGSMSX101.gar.corp.intel.com \
    --to=vipin.varghese@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=keith.wiles@intel.com \
    --cc=olgas@mellanox.com \
    --cc=ophirmu@mellanox.com \
    --cc=thomas@monjalon.net \
    /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).