From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id D3428A0540; Mon, 13 Jul 2020 16:38:42 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0B3901D739; Mon, 13 Jul 2020 16:38:42 +0200 (CEST) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by dpdk.org (Postfix) with ESMTP id 8D9461D734 for ; Mon, 13 Jul 2020 16:38:40 +0200 (CEST) Received: by mail-wm1-f66.google.com with SMTP id g75so13540760wme.5 for ; Mon, 13 Jul 2020 07:38:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=jit6ZgfEJ32UXPVl04mdCh5HeT0vMA6yAzi1d9qr3dE=; b=elqixb8q8HBHB7d2deN7YoIjcDImkI9jmcIilSBXJqr4lqrndZG0/24awA16hTlfYC tlepxooCYM2zNZeuXgn8lJRupM/mzjEWEN6i2dnLOPrf+StER/T8gLLGwbDPBk7eOWpj qanNdDN4C5Qlh/LzpqdjDsGMHPxNA2+/sj+0mHTgDKuo0vMJrYozW8KVbcxrwGlJCT97 xJkGNGvixRbOIfkYmew2EYPvVU3qoILm3f7v+dQXdaTdw02c82K/7+MhEyO1RsAgTFfa VHIx8LZtpPkKfefY57fGyG2FLRtWWoBxF0w865pzE8F1XWdMuy3KJKowzpwOkh1hoB5U Z0MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=jit6ZgfEJ32UXPVl04mdCh5HeT0vMA6yAzi1d9qr3dE=; b=NFVFLKI4IeR+yPz7fmfUHUBDvEYRNv6yk6Wtszg92pvVjTn0xdd/A7fnTSWcKCkzGS lsUbM5XLMdaBefaGVFJIydLrl57F2PWq1aN+dPNVbceK8fLWBZUL8AfkRvqdVKznkVW/ eJcl4cMDLYs9EtiXsVf9n8IGOO8DItDaFnF/3GKHXvy8LBcwWdwyHJXaBMh0j64wmBz9 zt2Q/DLQXQo2o38GfFZ77qAjuYiLNBHB7iM1NsmmbEWM2Ua/ndIZQC9UoQyejTUEXqm+ d95cg8jPB6gRhvt/LqnLu7U3ZnhSdUFI05TLS5bE+/YpbnRQWtuUwyut2WF/rOYlR5Hs 6DrQ== X-Gm-Message-State: AOAM533DnEKsGbrDFgS9HFP0WkwS3PKUgBHs0CwhVfh0622ns1StGU1U kZRUcJm+37M32X5/DpQEoa+75Q== X-Google-Smtp-Source: ABdhPJxWRMi++ARVzJ9Zl83/f5fGpkMFefBT7QNjli3SG8en95vVJ3jj4c5nuyUQ2gMg1hKOYa9Zjw== X-Received: by 2002:a1c:98c1:: with SMTP id a184mr277017wme.116.1594651120219; Mon, 13 Jul 2020 07:38:40 -0700 (PDT) Received: from 6wind.com (2a01cb0c0005a600345636f7e65ed1a0.ipv6.abo.wanadoo.fr. [2a01:cb0c:5:a600:3456:36f7:e65e:d1a0]) by smtp.gmail.com with ESMTPSA id u17sm23337052wrp.70.2020.07.13.07.38.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jul 2020 07:38:39 -0700 (PDT) Date: Mon, 13 Jul 2020 16:38:39 +0200 From: Olivier Matz To: Fady Bader 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 Message-ID: <20200713143839.GP5869@platinum> References: <20200610120040.17968-1-fady@mellanox.com> <20200708082525.28504-1-fady@mellanox.com> <20200708082525.28504-3-fady@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200708082525.28504-3-fady@mellanox.com> User-Agent: Mutt/1.10.1 (2018-07-13) Subject: Re: [dpdk-dev] [PATCH v3 2/3] net: replace htons with rte_cpu_to_be_16 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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 > +#endif Is arpa/inet.h still needed if you remove htons? > > #include > +#include > > #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, ð_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 >