DPDK-dev Archive on lore.kernel.org
 help / color / Atom feed
* [dpdk-dev] [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF
@ 2019-11-08 10:02 Reshma Pattan
  2019-11-14 18:09 ` Ferruh Yigit
  2019-11-15 15:42 ` Ferruh Yigit
  0 siblings, 2 replies; 4+ messages in thread
From: Reshma Pattan @ 2019-11-08 10:02 UTC (permalink / raw)
  To: dev
  Cc: Reshma Pattan, xiaoyun.li, ferruh.yigit, Bernard Iremonger,
	John Daley, Hyong Youb Kim

Use new macro RTE_IPV4_VHL_DEF instead of IP_VHL_DEF
wherever applicable.

CC: xiaoyun.li@intel.com
CC: ferruh.yigit@intel.com
CC: Bernard Iremonger <bernard.iremonger@intel.com>
CC: John Daley <johndale@cisco.com>
CC: Hyong Youb Kim <hyonkim@cisco.com>

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 app/test-pmd/csumonly.c                | 3 ---
 app/test-pmd/flowgen.c                 | 5 +----
 app/test-pmd/txonly.c                  | 5 +----
 app/test/packet_burst_generator.c      | 8 +++-----
 drivers/net/enic/enic_fm_flow.c        | 5 +----
 examples/tep_termination/vxlan_setup.c | 5 +----
 6 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 5738128e6..25091de88 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -47,9 +47,6 @@
 #include "testpmd.h"
 
 #define IP_DEFTTL  64   /* from RFC 1340. */
-#define IP_VERSION 0x40
-#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
-#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
 #define GRE_CHECKSUM_PRESENT	0x8000
 #define GRE_KEY_PRESENT		0x2000
diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index ade6fe5da..03b72aaa5 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -82,9 +82,6 @@ static struct rte_ether_addr cfg_ether_dst =
 	{{ 0x00, 0x01, 0x02, 0x03, 0x04, 0x01 }};
 
 #define IP_DEFTTL  64   /* from RFC 1340. */
-#define IP_VERSION 0x40
-#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
-#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
 static inline uint16_t
 ip_sum(const unaligned_uint16_t *hdr, int hdr_len)
@@ -178,7 +175,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
 		/* Initialize IP header. */
 		ip_hdr = (struct rte_ipv4_hdr *)(eth_hdr + 1);
 		memset(ip_hdr, 0, sizeof(*ip_hdr));
-		ip_hdr->version_ihl	= IP_VHL_DEF;
+		ip_hdr->version_ihl	= RTE_IPV4_VHL_DEF;
 		ip_hdr->type_of_service	= 0;
 		ip_hdr->fragment_offset	= 0;
 		ip_hdr->time_to_live	= IP_DEFTTL;
diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 10d641a44..539043c34 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -49,9 +49,6 @@ uint32_t tx_ip_src_addr = (192U << 24) | (18 << 16) | (0 << 8) | 1;
 uint32_t tx_ip_dst_addr = (192U << 24) | (18 << 16) | (0 << 8) | 2;
 
 #define IP_DEFTTL  64   /* from RFC 1340. */
-#define IP_VERSION 0x40
-#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
-#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
 static struct rte_ipv4_hdr pkt_ip_hdr; /**< IP header of transmitted packets. */
 RTE_DEFINE_PER_LCORE(uint8_t, _ip_var); /**< IP address variation */
@@ -116,7 +113,7 @@ setup_pkt_udp_ip_headers(struct rte_ipv4_hdr *ip_hdr,
 	 * Initialize IP header.
 	 */
 	pkt_len = (uint16_t) (pkt_len + sizeof(struct rte_ipv4_hdr));
-	ip_hdr->version_ihl   = IP_VHL_DEF;
+	ip_hdr->version_ihl   = RTE_IPV4_VHL_DEF;
 	ip_hdr->type_of_service   = 0;
 	ip_hdr->fragment_offset = 0;
 	ip_hdr->time_to_live   = IP_DEFTTL;
diff --git a/app/test/packet_burst_generator.c b/app/test/packet_burst_generator.c
index 9776d583b..f203f9d09 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -4,6 +4,7 @@
 
 #include <rte_byteorder.h>
 #include <rte_mbuf.h>
+#include <rte_ip.h>
 
 #include "packet_burst_generator.h"
 
@@ -12,9 +13,6 @@
 
 
 #define IP_DEFTTL  64   /* from RFC 1340. */
-#define IP_VERSION 0x40
-#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
-#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
 static void
 copy_buf_to_pkt_segs(void *buf, unsigned len, struct rte_mbuf *pkt,
@@ -167,7 +165,7 @@ initialize_ipv4_header(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr,
 	 */
 	pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr));
 
-	ip_hdr->version_ihl   = IP_VHL_DEF;
+	ip_hdr->version_ihl   = RTE_IPV4_VHL_DEF;
 	ip_hdr->type_of_service   = 0;
 	ip_hdr->fragment_offset = 0;
 	ip_hdr->time_to_live   = IP_DEFTTL;
@@ -215,7 +213,7 @@ initialize_ipv4_header_proto(struct rte_ipv4_hdr *ip_hdr, uint32_t src_addr,
 	 */
 	pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_ipv4_hdr));
 
-	ip_hdr->version_ihl   = IP_VHL_DEF;
+	ip_hdr->version_ihl   = RTE_IPV4_VHL_DEF;
 	ip_hdr->type_of_service   = 0;
 	ip_hdr->fragment_offset = 0;
 	ip_hdr->time_to_live   = IP_DEFTTL;
diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
index a1598b822..e3e3d737b 100644
--- a/drivers/net/enic/enic_fm_flow.c
+++ b/drivers/net/enic/enic_fm_flow.c
@@ -17,9 +17,6 @@
 #include "vnic_nic.h"
 
 #define IP_DEFTTL  64   /* from RFC 1340. */
-#define IP_VERSION 0x40
-#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
-#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 #define IP6_VTC_FLOW 0x60000000
 
 /* Highest Item type supported by Flowman */
@@ -1000,7 +997,7 @@ enic_fm_copy_vxlan_encap(struct enic_flowman *fm,
 			sizeof(struct rte_vxlan_hdr);
 		append_template(&template, &off, item->spec,
 				sizeof(struct rte_ipv4_hdr));
-		ip4->version_ihl = IP_VHL_DEF;
+		ip4->version_ihl = RTE_IPV4_VHL_DEF;
 		if (ip4->time_to_live == 0)
 			ip4->time_to_live = IP_DEFTTL;
 		ip4->next_proto_id = IPPROTO_UDP;
diff --git a/examples/tep_termination/vxlan_setup.c b/examples/tep_termination/vxlan_setup.c
index f9f857c09..eca119a72 100644
--- a/examples/tep_termination/vxlan_setup.c
+++ b/examples/tep_termination/vxlan_setup.c
@@ -28,10 +28,7 @@
 #define UDP_HEADER_LEN  8
 #define VXLAN_HEADER_LEN 8
 
-#define IP_VERSION 0x40
-#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
 #define IP_DEFTTL  64   /* from RFC 1340. */
-#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
 
 #define IP_DN_FRAGMENT_FLAG 0x0040
 
@@ -323,7 +320,7 @@ vxlan_link(struct vhost_dev *vdev, struct rte_mbuf *m)
 	app_l2_hdr[portid].ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
 
 	ip = &app_ip_hdr[portid];
-	ip->version_ihl = IP_VHL_DEF;
+	ip->version_ihl = RTE_IPV4_VHL_DEF;
 	ip->type_of_service = 0;
 	ip->total_length = 0;
 	ip->packet_id = 0;
-- 
2.21.0


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

* Re: [dpdk-dev] [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF
  2019-11-08 10:02 [dpdk-dev] [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF Reshma Pattan
@ 2019-11-14 18:09 ` Ferruh Yigit
  2019-11-15  3:57   ` Hyong Youb Kim (hyonkim)
  2019-11-15 15:42 ` Ferruh Yigit
  1 sibling, 1 reply; 4+ messages in thread
From: Ferruh Yigit @ 2019-11-14 18:09 UTC (permalink / raw)
  To: John Daley, Hyong Youb Kim
  Cc: Reshma Pattan, dev, xiaoyun.li, Bernard Iremonger, David Harton

On 11/8/2019 10:02 AM, Reshma Pattan wrote:
> diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c
> index a1598b822..e3e3d737b 100644
> --- a/drivers/net/enic/enic_fm_flow.c
> +++ b/drivers/net/enic/enic_fm_flow.c
> @@ -17,9 +17,6 @@
>  #include "vnic_nic.h"
>  
>  #define IP_DEFTTL  64   /* from RFC 1340. */
> -#define IP_VERSION 0x40
> -#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words. */
> -#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
>  #define IP6_VTC_FLOW 0x60000000
>  
>  /* Highest Item type supported by Flowman */
> @@ -1000,7 +997,7 @@ enic_fm_copy_vxlan_encap(struct enic_flowman *fm,
>  			sizeof(struct rte_vxlan_hdr);
>  		append_template(&template, &off, item->spec,
>  				sizeof(struct rte_ipv4_hdr));
> -		ip4->version_ihl = IP_VHL_DEF;
> +		ip4->version_ihl = RTE_IPV4_VHL_DEF;
>  		if (ip4->time_to_live == 0)
>  			ip4->time_to_live = IP_DEFTTL;
>  		ip4->next_proto_id = IPPROTO_UDP;

+ David Harton, there was some comment from him in relevant issue

Hi John, Hyong Youb,

Are you OK with the changes in the PMD?

Thanks,
ferruh

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

* Re: [dpdk-dev] [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF
  2019-11-14 18:09 ` Ferruh Yigit
@ 2019-11-15  3:57   ` Hyong Youb Kim (hyonkim)
  0 siblings, 0 replies; 4+ messages in thread
From: Hyong Youb Kim (hyonkim) @ 2019-11-15  3:57 UTC (permalink / raw)
  To: Ferruh Yigit, John Daley (johndale)
  Cc: Reshma Pattan, dev, xiaoyun.li, Bernard Iremonger,
	David Harton (dharton)

> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@intel.com>
> Sent: Thursday, November 14, 2019 10:09 AM
> To: John Daley (johndale) <johndale@cisco.com>; Hyong Youb Kim (hyonkim)
> <hyonkim@cisco.com>
> Cc: Reshma Pattan <reshma.pattan@intel.com>; dev@dpdk.org;
> xiaoyun.li@intel.com; Bernard Iremonger <bernard.iremonger@intel.com>;
> David Harton (dharton) <dharton@cisco.com>
> Subject: Re: [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF
> 
> On 11/8/2019 10:02 AM, Reshma Pattan wrote:
> > diff --git a/drivers/net/enic/enic_fm_flow.c
> b/drivers/net/enic/enic_fm_flow.c
> > index a1598b822..e3e3d737b 100644
> > --- a/drivers/net/enic/enic_fm_flow.c
> > +++ b/drivers/net/enic/enic_fm_flow.c
> > @@ -17,9 +17,6 @@
> >  #include "vnic_nic.h"
> >
> >  #define IP_DEFTTL  64   /* from RFC 1340. */
> > -#define IP_VERSION 0x40
> > -#define IP_HDRLEN  0x05 /* default IP header length == five 32-bits words.
> */
> > -#define IP_VHL_DEF (IP_VERSION | IP_HDRLEN)
> >  #define IP6_VTC_FLOW 0x60000000
> >
> >  /* Highest Item type supported by Flowman */
> > @@ -1000,7 +997,7 @@ enic_fm_copy_vxlan_encap(struct enic_flowman
> *fm,
> >  			sizeof(struct rte_vxlan_hdr);
> >  		append_template(&template, &off, item->spec,
> >  				sizeof(struct rte_ipv4_hdr));
> > -		ip4->version_ihl = IP_VHL_DEF;
> > +		ip4->version_ihl = RTE_IPV4_VHL_DEF;
> >  		if (ip4->time_to_live == 0)
> >  			ip4->time_to_live = IP_DEFTTL;
> >  		ip4->next_proto_id = IPPROTO_UDP;
> 
> + David Harton, there was some comment from him in relevant issue
> 
> Hi John, Hyong Youb,
> 
> Are you OK with the changes in the PMD?
> 

Yes, looks good to me. Thanks for pinging us.

Acked-by: Hyong Youb Kim <hyonkim@cisco.com>

-Hyong


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

* Re: [dpdk-dev] [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF
  2019-11-08 10:02 [dpdk-dev] [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF Reshma Pattan
  2019-11-14 18:09 ` Ferruh Yigit
@ 2019-11-15 15:42 ` Ferruh Yigit
  1 sibling, 0 replies; 4+ messages in thread
From: Ferruh Yigit @ 2019-11-15 15:42 UTC (permalink / raw)
  To: Reshma Pattan, dev
  Cc: xiaoyun.li, Bernard Iremonger, John Daley, Hyong Youb Kim

On 11/8/2019 10:02 AM, Reshma Pattan wrote:
> Use new macro RTE_IPV4_VHL_DEF instead of IP_VHL_DEF
> wherever applicable.
> 
> CC: xiaoyun.li@intel.com
> CC: ferruh.yigit@intel.com
> CC: Bernard Iremonger <bernard.iremonger@intel.com>
> CC: John Daley <johndale@cisco.com>
> CC: Hyong Youb Kim <hyonkim@cisco.com>
> 
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.

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

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-08 10:02 [dpdk-dev] [PATCH] net: replace IP VHL DEF macro with RTE IPV4 VHL DEF Reshma Pattan
2019-11-14 18:09 ` Ferruh Yigit
2019-11-15  3:57   ` Hyong Youb Kim (hyonkim)
2019-11-15 15:42 ` Ferruh Yigit

DPDK-dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/dpdk-dev/0 dpdk-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dpdk-dev dpdk-dev/ https://lore.kernel.org/dpdk-dev \
		dev@dpdk.org
	public-inbox-index dpdk-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git