DPDK patches and discussions
 help / color / mirror / Atom feed
From: Saleh Alsouqi <salehals@mellanox.com>
To: "ferruh.yigit@intel.com" <ferruh.yigit@intel.com>,
	"roszenrami@gmail.com" <roszenrami@gmail.com>
Cc: "wenzhuo.lu@intel.com" <wenzhuo.lu@intel.com>,
	"jingjing.wu@intel.com" <jingjing.wu@intel.com>,
	"bernard.iremonger@intel.com" <bernard.iremonger@intel.com>,
	"dev@dpdk.org" <dev@dpdk.org>, Ori Kam <orika@mellanox.com>,
	"stable@dpdk.org" <stable@dpdk.org>,
	"olivier.matz@6wind.com" <olivier.matz@6wind.com>,
	Saleh Alsouqi <salehals@mellanox.com>
Subject: [dpdk-dev] [PATCH v3 1/2] librte_net/rte_ip: define ipv4 ihl and vhl
Date: Thu, 4 Jul 2019 07:33:19 +0000	[thread overview]
Message-ID: <1562225578-5818-2-git-send-email-salehals@mellanox.com> (raw)
In-Reply-To: <1562225578-5818-1-git-send-email-salehals@mellanox.com>

Define IPv4 Minimum IHL and VHL according to rfc791 (see [1])

    "The Version field indicates the format of the
    internet header."

    "Internet Header Length (ihl) is the length of the
    internet header in 32 bit words, and thus points
    to the beginning of the data. Note that
    the minimum value for a correct header is 5."

[1] https://tools.ietf.org/html/rfc791

Signed-off-by: Saleh AlSouqi <salehals@mellanox.com>
---
 lib/librte_net/rte_ip.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h
index e69b863..26b089e 100644
--- a/lib/librte_net/rte_ip.h
+++ b/lib/librte_net/rte_ip.h
@@ -16,7 +16,9 @@
  */
 
 #include <stdint.h>
+#include <sys/types.h>
 #include <netinet/in.h>
+#include <netinet/ip.h>
 
 #include <rte_byteorder.h>
 #include <rte_mbuf.h>
@@ -96,6 +98,10 @@ struct rte_ipv4_hdr {
 	((x) >= RTE_IPV4_MIN_MCAST && (x) <= RTE_IPV4_MAX_MCAST)
 	/**< check if IPv4 address is multicast */
 
+/* IPv4 default fields values */
+#define RTE_IPV4_MIN_IHL    (0x5)
+#define RTE_IPV4_VHL_DEF    (IPVERSION | RTE_IPV4_MIN_IHL)
+
 /**
  * @internal Calculate a sum of all words in the buffer.
  * Helper routine for the rte_raw_cksum().
-- 
2.7.4


  reply	other threads:[~2019-07-04  7:33 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-18 12:36 [dpdk-dev] [PATCH] app/testpmd: fix mpls encap ipv4 version and ihl Saleh Alsouqi
2018-12-25 19:29 ` Rami Rosen
2019-01-08 14:38   ` Ferruh Yigit
2019-03-25 13:01 ` [dpdk-dev] [PATCH v2] " Saleh Alsouqi
2019-03-25 13:01   ` Saleh Alsouqi
2019-03-25 13:30   ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2019-03-25 13:30     ` Ferruh Yigit
2019-04-16  9:59     ` Ferruh Yigit
2019-04-16  9:59       ` Ferruh Yigit
2019-04-16 10:02       ` Ferruh Yigit
2019-04-16 10:02         ` Ferruh Yigit
2019-07-02 13:33         ` Yigit, Ferruh
2019-07-04  7:33 ` [dpdk-dev] [PATCH v3 0/2] define ipv4 ihl and vhl Saleh Alsouqi
2019-07-04  7:33   ` Saleh Alsouqi [this message]
2019-07-04  7:33   ` [dpdk-dev] [PATCH v3 2/2] app/testpmd: fix mpls ipv4 encap fields Saleh Alsouqi
2019-07-04 16:19   ` [dpdk-dev] [dpdk-stable] [PATCH v3 0/2] define ipv4 ihl and vhl 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=1562225578-5818-2-git-send-email-salehals@mellanox.com \
    --to=salehals@mellanox.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=olivier.matz@6wind.com \
    --cc=orika@mellanox.com \
    --cc=roszenrami@gmail.com \
    --cc=stable@dpdk.org \
    --cc=wenzhuo.lu@intel.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).