From patchwork Mon Sep 28 21:50:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Kozlyuk X-Patchwork-Id: 79063 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 52A8DA04C0; Mon, 28 Sep 2020 23:53:08 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 2517C1BED1; Mon, 28 Sep 2020 23:51:47 +0200 (CEST) Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by dpdk.org (Postfix) with ESMTP id 9CD551D6E3 for ; Mon, 28 Sep 2020 23:51:38 +0200 (CEST) Received: by mail-lj1-f195.google.com with SMTP id s205so2281671lja.7 for ; Mon, 28 Sep 2020 14:51:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kqY2ax0QRVQUWIsVEaWJ0WJgbyhvRR00tqHtVbS6VTk=; b=T0lT5pFDjaTlusR2iXCsBwA25492pjfzDk9TUUyaxLavSHQJcoOoaCtwyxkl9RlJAU gy4bxB48HLHvRAcdDWxazkb79Ug0e3Gn4DK9gMACRoxE/zQYV0CxlK74IJs3kXBsOnFm 6RK7+yqsBeJXBM4gns6Z/GWE4U6YaDRlnWVC+hZyOAmVaQcvkSq/1ie79nR/PJUv2j0u IyfIH+DxHDXvNg+A7E8ZO8gb+8moxgnKoI+LgyCz3U0lBnehvPAFDfYY9IvnJsHn3Woc mYKm1h/ISqDEOHS4ByJ6v2Snd8Tok6hChg3LU06LYHfMvg0mdgmLnlBfxzJtUxHz6928 EQYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kqY2ax0QRVQUWIsVEaWJ0WJgbyhvRR00tqHtVbS6VTk=; b=FTE1kApl1EXz0dUF6WWTJR+yYO1zXpc4790Twg5NLEbS5Y7YuXgFlkSpyp5JvD4GAV nulAAG88O7aHwEFtzVWKx6bsunu/0r1yQSW/bzKi4ojjmOGIGE9wcaMRtOlsiPy1wC6s 5R4nPeroYH4i1JRRpmVmj9MYyymKcJyAaxGzvDX2O6Aomvl+ncm9WfPsTdBje7OqQ377 kgJ1aRy0JDaC2qWs19j+6qOaDdEI2YjesoAy1GTHl07cmolp33GR5iSS1pFiw8ow3whA Olp2otMdBnd5sRT4iTRtYPXlyeN6/g+mL5fgFWJL9S27Z+e1MRFy8sPsl4CtVUTlP7Qt Mz3Q== X-Gm-Message-State: AOAM532Xjd+98KyofiQfvO8Kc9fRSZD8HQ1HtbmtRzeAD09Eg/2qo+BU 395UAaSMsBwfJcSiGsunSF86KDzyfKcc06Zf X-Google-Smtp-Source: ABdhPJybV0ssUy7FRBjWDWX1Py+bta88T4leEKO/FjkqMT6tem7ScpvdWUl8be0PNwPSdjsj+wOuDw== X-Received: by 2002:a2e:9784:: with SMTP id y4mr172052lji.247.1601329896887; Mon, 28 Sep 2020 14:51:36 -0700 (PDT) Received: from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id l11sm2954893lfk.113.2020.09.28.14.51.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Sep 2020 14:51:36 -0700 (PDT) From: Dmitry Kozlyuk To: dev@dpdk.org Cc: "Kinsella, Ray" , Khoa To , Stephen Hemminger , Ferruh Yigit , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam Date: Tue, 29 Sep 2020 00:50:50 +0300 Message-Id: <20200928215052.23627-6-dmitry.kozliuk@gmail.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200928215052.23627-1-dmitry.kozliuk@gmail.com> References: <20200730210652.14568-1-dmitry.kozliuk@gmail.com> <20200928215052.23627-1-dmitry.kozliuk@gmail.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v3 5/7] eal/windows: improve compatibility networking headers 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" Extend compatibility header system to support librte_cmdline. pthread.h has to include windows.h, which exposes struct in_addr, etc. conflicting with compatibility headers. WIN32_LEAN_AND_MEAN macro is required to disable this behavior. Use rte_windows.h to define WIN32_LEAN_AND_MEAN for pthread library. Signed-off-by: Dmitry Kozlyuk --- lib/librte_eal/windows/include/arpa/inet.h | 30 +++++++++++++++++++++ lib/librte_eal/windows/include/netinet/in.h | 12 +++++++++ lib/librte_eal/windows/include/sys/socket.h | 24 +++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 lib/librte_eal/windows/include/arpa/inet.h create mode 100644 lib/librte_eal/windows/include/sys/socket.h diff --git a/lib/librte_eal/windows/include/arpa/inet.h b/lib/librte_eal/windows/include/arpa/inet.h new file mode 100644 index 000000000..96b698438 --- /dev/null +++ b/lib/librte_eal/windows/include/arpa/inet.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020 Dmitry Kozlyuk + */ + +#ifndef _ARPA_INET_H_ +#define _ARPA_INET_H_ + +/** + * @file + * + * Compatibility header + * + * Although symbols declared here are present on Windows, + * including would expose too much macros breaking common code. + */ + +#include +#include + +/* defined in ws2_32.dll */ +__attribute__((stdcall)) +int +inet_pton(int af, const char *src, void *dst); + +/* defined in ws2_32.dll */ +__attribute__((stdcall)) +const char * +inet_ntop(int af, const void *src, char *dst, socklen_t size); + +#endif /* _ARPA_INET_H_ */ diff --git a/lib/librte_eal/windows/include/netinet/in.h b/lib/librte_eal/windows/include/netinet/in.h index 534a2d99a..be1469ec1 100644 --- a/lib/librte_eal/windows/include/netinet/in.h +++ b/lib/librte_eal/windows/include/netinet/in.h @@ -5,6 +5,8 @@ #ifndef _IN_H_ #define _IN_H_ +#include + #define IPPROTO_IP 0 #define IPPROTO_HOPOPTS 0 #define IPPROTO_ICMP 1 @@ -22,4 +24,14 @@ #define IPPROTO_DSTOPTS 60 #define IPPROTO_SCTP 132 +#define INET6_ADDRSTRLEN 46 + +struct in_addr { + uint32_t s_addr; +}; + +struct in6_addr { + uint8_t s6_addr[16]; +}; + #endif diff --git a/lib/librte_eal/windows/include/sys/socket.h b/lib/librte_eal/windows/include/sys/socket.h new file mode 100644 index 000000000..9536cf8e6 --- /dev/null +++ b/lib/librte_eal/windows/include/sys/socket.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright (c) 2020 Dmitry Kozlyuk + */ + +#ifndef _SYS_SOCKET_H_ +#define _SYS_SOCKET_H_ + +/** + * @file + * + * Compatibility header + * + * Although symbols declared here are present on Windows, + * including would expose too much macros breaking common code. + */ + +#include + +#define AF_INET 2 +#define AF_INET6 23 + +typedef size_t socklen_t; + +#endif /* _SYS_SOCKET_H_ */