[dpdk-dev,v4,5/8] sample/vhost:remove ip_hdr structure defination

Message ID 1447224046-1169-6-git-send-email-jijiang.liu@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Jijiang Liu Nov. 11, 2015, 6:40 a.m. UTC
  Remove the ip_hdr structure defination.

Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
---
 examples/vhost/main.c |   15 +--------------
 1 files changed, 1 insertions(+), 14 deletions(-)
  

Comments

Yuanhan Liu Nov. 11, 2015, 8:34 a.m. UTC | #1
On Wed, Nov 11, 2015 at 02:40:43PM +0800, Jijiang Liu wrote:
> Remove the ip_hdr structure defination.

Even for such simple patch, you need state why. Stating that
"remove ip_hdr structure defination because we already have
that in rte_ip.h" will definitely let others to accept your
patch eaiser.

	--yliu
> 
> Signed-off-by: Jijiang Liu <jijiang.liu@intel.com>
> ---
>  examples/vhost/main.c |   15 +--------------
>  1 files changed, 1 insertions(+), 14 deletions(-)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index c081b18..044c680 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -50,6 +50,7 @@
>  #include <rte_string_fns.h>
>  #include <rte_malloc.h>
>  #include <rte_virtio_net.h>
> +#include <rte_ip.h>
>  
>  #include "main.h"
>  
> @@ -292,20 +293,6 @@ struct vlan_ethhdr {
>  	__be16          h_vlan_encapsulated_proto;
>  };
>  
> -/* IPv4 Header */
> -struct ipv4_hdr {
> -	uint8_t  version_ihl;		/**< version and header length */
> -	uint8_t  type_of_service;	/**< type of service */
> -	uint16_t total_length;		/**< length of packet */
> -	uint16_t packet_id;		/**< packet ID */
> -	uint16_t fragment_offset;	/**< fragmentation offset */
> -	uint8_t  time_to_live;		/**< time to live */
> -	uint8_t  next_proto_id;		/**< protocol ID */
> -	uint16_t hdr_checksum;		/**< header checksum */
> -	uint32_t src_addr;		/**< source address */
> -	uint32_t dst_addr;		/**< destination address */
> -} __attribute__((__packed__));
> -
>  /* Header lengths. */
>  #define VLAN_HLEN       4
>  #define VLAN_ETH_HLEN   18
> -- 
> 1.7.7.6
  
Thomas Monjalon Nov. 11, 2015, 10:05 a.m. UTC | #2
2015-11-11 16:34, Yuanhan Liu:
> On Wed, Nov 11, 2015 at 02:40:43PM +0800, Jijiang Liu wrote:
> > Remove the ip_hdr structure defination.
> 
> Even for such simple patch, you need state why. Stating that
> "remove ip_hdr structure defination because we already have
> that in rte_ip.h" will definitely let others to accept your
> patch eaiser.

Yes, thanks Yuanhan.
  

Patch

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index c081b18..044c680 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -50,6 +50,7 @@ 
 #include <rte_string_fns.h>
 #include <rte_malloc.h>
 #include <rte_virtio_net.h>
+#include <rte_ip.h>
 
 #include "main.h"
 
@@ -292,20 +293,6 @@  struct vlan_ethhdr {
 	__be16          h_vlan_encapsulated_proto;
 };
 
-/* IPv4 Header */
-struct ipv4_hdr {
-	uint8_t  version_ihl;		/**< version and header length */
-	uint8_t  type_of_service;	/**< type of service */
-	uint16_t total_length;		/**< length of packet */
-	uint16_t packet_id;		/**< packet ID */
-	uint16_t fragment_offset;	/**< fragmentation offset */
-	uint8_t  time_to_live;		/**< time to live */
-	uint8_t  next_proto_id;		/**< protocol ID */
-	uint16_t hdr_checksum;		/**< header checksum */
-	uint32_t src_addr;		/**< source address */
-	uint32_t dst_addr;		/**< destination address */
-} __attribute__((__packed__));
-
 /* Header lengths. */
 #define VLAN_HLEN       4
 #define VLAN_ETH_HLEN   18