From patchwork Wed Jul 8 08:25:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fady Bader X-Patchwork-Id: 73515 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 8767CA00BE; Wed, 8 Jul 2020 10:25:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 81B7C1DC34; Wed, 8 Jul 2020 10:25:43 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id E0A471DC30 for ; Wed, 8 Jul 2020 10:25:41 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from fady@mellanox.com) with SMTP; 8 Jul 2020 11:25:36 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0688PamI026821; Wed, 8 Jul 2020 11:25:36 +0300 From: Fady Bader To: dev@dpdk.org Cc: 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, olivier.matz@6wind.com Date: Wed, 8 Jul 2020 11:25:23 +0300 Message-Id: <20200708082525.28504-2-fady@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20200708082525.28504-1-fady@mellanox.com> References: <20200610120040.17968-1-fady@mellanox.com> <20200708082525.28504-1-fady@mellanox.com> Subject: [dpdk-dev] [PATCH v3 1/3] net: fix s_addr redefinition in Windows 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" s_addr in Windows is defined in windows.h so its undefined in order to be defined as part of rte_ether_hdr. Signed-off-by: Fady Bader --- lib/librte_net/rte_ether.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib/librte_net/rte_ether.h b/lib/librte_net/rte_ether.h index 0ae4e75b6c..f6e37d9e5e 100644 --- a/lib/librte_net/rte_ether.h +++ b/lib/librte_net/rte_ether.h @@ -23,6 +23,15 @@ extern "C" { #include #include +/* + * s_addr in windows is defined in windows.h + * it is undefined here to be defined as part of rte_ether_hdr + */ +#ifdef RTE_EXEC_ENV_WINDOWS +#undef s_addr +#endif + + #define RTE_ETHER_ADDR_LEN 6 /**< Length of Ethernet address. */ #define RTE_ETHER_TYPE_LEN 2 /**< Length of Ethernet type field. */ #define RTE_ETHER_CRC_LEN 4 /**< Length of Ethernet CRC. */ From patchwork Wed Jul 8 08:25:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fady Bader X-Patchwork-Id: 73517 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 46DDDA00BE; Wed, 8 Jul 2020 10:25:59 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 50A0F1DC74; Wed, 8 Jul 2020 10:25:46 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id EF2C11DC35 for ; Wed, 8 Jul 2020 10:25:41 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from fady@mellanox.com) with SMTP; 8 Jul 2020 11:25:36 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0688PamJ026821; Wed, 8 Jul 2020 11:25:36 +0300 From: Fady Bader To: dev@dpdk.org Cc: 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, olivier.matz@6wind.com Date: Wed, 8 Jul 2020 11:25:24 +0300 Message-Id: <20200708082525.28504-3-fady@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20200708082525.28504-1-fady@mellanox.com> References: <20200610120040.17968-1-fady@mellanox.com> <20200708082525.28504-1-fady@mellanox.com> Subject: [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" 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 #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); From patchwork Wed Jul 8 08:25:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fady Bader X-Patchwork-Id: 73516 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 664D1A00BE; Wed, 8 Jul 2020 10:25:51 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EA1541DC53; Wed, 8 Jul 2020 10:25:44 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id EBCEF1DC34 for ; Wed, 8 Jul 2020 10:25:41 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE1 (envelope-from fady@mellanox.com) with SMTP; 8 Jul 2020 11:25:36 +0300 Received: from l-wincomp04-vm.labs.mlnx (l-wincomp04-vm.mtl.labs.mlnx [10.237.1.5]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 0688PamK026821; Wed, 8 Jul 2020 11:25:36 +0300 From: Fady Bader To: dev@dpdk.org Cc: 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, olivier.matz@6wind.com Date: Wed, 8 Jul 2020 11:25:25 +0300 Message-Id: <20200708082525.28504-4-fady@mellanox.com> X-Mailer: git-send-email 2.16.1.windows.4 In-Reply-To: <20200708082525.28504-1-fady@mellanox.com> References: <20200610120040.17968-1-fady@mellanox.com> <20200708082525.28504-1-fady@mellanox.com> Subject: [dpdk-dev] [PATCH v3 3/3] eal/windows: librte_net build on Windows 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" librte_net wasn't compiling under Windows. To solve this, needed exports and files were added for Windows. Signed-off-by: Fady Bader --- lib/librte_eal/common/meson.build | 1 + lib/librte_eal/rte_eal_exports.def | 1 + lib/librte_eal/windows/include/netinet/in.h | 25 +++++++++++++++++++++++++ lib/librte_eal/windows/include/netinet/ip.h | 12 ++++++++++++ lib/meson.build | 2 +- 5 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 lib/librte_eal/windows/include/netinet/in.h create mode 100644 lib/librte_eal/windows/include/netinet/ip.h diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index c1d9f21488..f7a2f798e3 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -31,6 +31,7 @@ if is_windows 'malloc_heap.c', 'rte_malloc.c', 'eal_common_timer.c', + 'rte_random.c', ) subdir_done() endif diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def index 69204a92c6..cb53f2427b 100644 --- a/lib/librte_eal/rte_eal_exports.def +++ b/lib/librte_eal/rte_eal_exports.def @@ -145,3 +145,4 @@ EXPORTS rte_mem_map rte_mem_page_size rte_mem_unmap + rte_rand diff --git a/lib/librte_eal/windows/include/netinet/in.h b/lib/librte_eal/windows/include/netinet/in.h new file mode 100644 index 0000000000..489b587c39 --- /dev/null +++ b/lib/librte_eal/windows/include/netinet/in.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#ifndef _IN_H_ +#define _IN_H_ + +#define IPPROTO_IP 0 +#define IPPROTO_HOPOPTS 0 +#define IPPROTO_IPV4 4 /* IPv4 encapsulation */ +#define IPPROTO_IPIP IPPROTO_IPV4 /* for compatibility */ +#define IPPROTO_TCP 6 +#define IPPROTO_UDP 17 +#define IPPROTO_IPV6 41 /* IP6 header */ +#define IPPROTO_ROUTING 43 /* IP6 routing header */ +#define IPPROTO_FRAGMENT 44 /* IP6 fragmentation header */ +#define IPPROTO_GRE 47 /* General Routing Encap. */ +#define IPPROTO_ESP 50 /* IP6 Encap Sec. Payload */ +#define IPPROTO_AH 51 /* IP6 Auth Header */ +#define IPPROTO_NONE 59 /* IPv6 no next header */ +#define IPPROTO_DSTOPTS 60 /* IP6 destination option */ +#define IPPROTO_SCTP 132 /* Stream Control Transmission Protocol */ + + +#endif diff --git a/lib/librte_eal/windows/include/netinet/ip.h b/lib/librte_eal/windows/include/netinet/ip.h new file mode 100644 index 0000000000..4f212961ff --- /dev/null +++ b/lib/librte_eal/windows/include/netinet/ip.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + * this needs to be changed waiting for Microsoft team to respond + */ + +#ifndef _IP_H_ +#define _IP_H_ + +#define IPVERSION 4 + + +#endif diff --git a/lib/meson.build b/lib/meson.build index 3852c01564..6bbaf242a9 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -40,7 +40,7 @@ if is_windows 'kvargs', 'eal', 'ring', - 'mempool', 'mbuf', 'pci', + 'mempool', 'mbuf', 'pci', 'net', ] # only supported libraries for windows endif