All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: Fady Bader <fady@mellanox.com>
Cc: dev@dpdk.org, thomas@monjalon.net, tbashar@mellanox.com,
	talshn@mellanox.com, yohadt@mellanox.com,
	dmitry.kozliuk@gmail.com, harini.ramakrishnan@microsoft.com,
	ocardona@microsoft.com, pallavi.kadam@intel.com,
	ranjit.menon@intel.com
Subject: Re: [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16
Date: Mon, 13 Jul 2020 16:38:39 +0200	[thread overview]
Message-ID: <20200713143839.GP5869@platinum> (raw)
In-Reply-To: <20200708082525.28504-3-fady@mellanox.com>

On Wed, Jul 08, 2020 at 11:25:24AM +0300, Fady Bader wrote:
> htons wasn't defined in Windows for the minGW compiler.
> htons was replaced with rte_cpu_to_be_16 in order to compile
> under Windows.
> 
> Signed-off-by: Fady Bader <fady@mellanox.com>
> ---
>  lib/librte_net/rte_arp.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/lib/librte_net/rte_arp.c b/lib/librte_net/rte_arp.c
> index 784b7f48fa..227a6396de 100644
> --- a/lib/librte_net/rte_arp.c
> +++ b/lib/librte_net/rte_arp.c
> @@ -2,9 +2,12 @@
>   * Copyright(c) 2018 Intel Corporation
>   */
>  
> +#ifndef RTE_EXEC_ENV_WINDOWS
>  #include <arpa/inet.h>
> +#endif

Is arpa/inet.h still needed if you remove htons?

>  
>  #include <rte_arp.h>
> +#include <rte_byteorder.h>
>  
>  #define RARP_PKT_SIZE	64
>  struct rte_mbuf *
> @@ -32,15 +35,15 @@ rte_net_make_rarp_packet(struct rte_mempool *mpool,
>  	/* Ethernet header. */
>  	memset(eth_hdr->d_addr.addr_bytes, 0xff, RTE_ETHER_ADDR_LEN);
>  	rte_ether_addr_copy(mac, &eth_hdr->s_addr);
> -	eth_hdr->ether_type = htons(RTE_ETHER_TYPE_RARP);
> +	eth_hdr->ether_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_RARP);
>  
>  	/* RARP header. */
>  	rarp = (struct rte_arp_hdr *)(eth_hdr + 1);
> -	rarp->arp_hardware = htons(RTE_ARP_HRD_ETHER);
> -	rarp->arp_protocol = htons(RTE_ETHER_TYPE_IPV4);
> +	rarp->arp_hardware = rte_cpu_to_be_16(RTE_ARP_HRD_ETHER);
> +	rarp->arp_protocol = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
>  	rarp->arp_hlen = RTE_ETHER_ADDR_LEN;
>  	rarp->arp_plen = 4;
> -	rarp->arp_opcode  = htons(RTE_ARP_OP_REVREQUEST);
> +	rarp->arp_opcode  = rte_cpu_to_be_16(RTE_ARP_OP_REVREQUEST);
>  
>  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_sha);
>  	rte_ether_addr_copy(mac, &rarp->arp_data.arp_tha);
> -- 
> 2.16.1.windows.4
> 

  parent reply	other threads:[~2020-07-13 14:38 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <'20200610112326.18576-1-fady@mellanox.com'>
2020-06-10 12:00 ` [dpdk-dev] [PATCH v2 0/3] compile librte_net for windows Fady Bader
2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 1/3] net: fix s_addr redefinition in Windows Fady Bader
2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 2/3] net: add htons to minGW for Windows Fady Bader
2020-06-10 12:33     ` Jerin Jacob
2020-06-10 12:00   ` [dpdk-dev] [PATCH v2 3/3] eal/windows: librte_net build on Windows Fady Bader
2020-06-16  9:04     ` Thomas Monjalon
2020-07-06  8:44       ` Fady Bader
2020-06-20 19:22     ` Dmitry Kozlyuk
2020-06-28  9:48       ` Fady Bader
2020-07-17 22:22         ` Narcisa Ana Maria Vasile
2020-07-20 12:54           ` Fady Bader
2020-07-20 16:26             ` Dmitry Kozlyuk
2020-07-22 10:20               ` Fady Bader
2020-07-22 10:30                 ` Bruce Richardson
2020-07-27  8:54                   ` Fady Bader
2020-07-27  8:53                 ` Fady Bader
2020-07-08  8:25   ` [dpdk-dev] [PATCH v3 0/3] compile librte_net for windows Fady Bader
2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows Fady Bader
2020-07-13 14:38       ` Olivier Matz
2020-07-15  6:26         ` Fady Bader
2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16 Fady Bader
2020-07-09 13:39       ` Morten Brørup
2020-07-13 14:38       ` Olivier Matz [this message]
2020-07-15  6:04         ` Fady Bader
2020-07-08  8:25     ` [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows Fady Bader
2020-07-08  9:10       ` Thomas Monjalon
2020-07-08 10:19         ` Fady Bader
2020-07-23  7:08   ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Fady Bader
2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 1/3] net: fix s_addr redefinition in Windows Fady Bader
2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 2/3] net: replace htons with RTE_BE16 Fady Bader
2020-07-23  7:08     ` [dpdk-dev] [PATCH v4 3/3] eal/windows: librte_net build on Windows Fady Bader
2020-09-08  8:14       ` Ophir Munk
2020-07-24  1:11     ` [dpdk-dev] [PATCH v4 0/3] compile librte_net for windows Ranjit Menon
2020-09-10 19:55       ` Thomas Monjalon
2020-07-24 15:52     ` Kadam, Pallavi

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=20200713143839.GP5869@platinum \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=dmitry.kozliuk@gmail.com \
    --cc=fady@mellanox.com \
    --cc=harini.ramakrishnan@microsoft.com \
    --cc=ocardona@microsoft.com \
    --cc=pallavi.kadam@intel.com \
    --cc=ranjit.menon@intel.com \
    --cc=talshn@mellanox.com \
    --cc=tbashar@mellanox.com \
    --cc=thomas@monjalon.net \
    --cc=yohadt@mellanox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.