From patchwork Wed Mar 20 12:53:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 10861543 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C2EB1575 for ; Wed, 20 Mar 2019 12:54:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80E9E28BBE for ; Wed, 20 Mar 2019 12:54:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7463728C22; Wed, 20 Mar 2019 12:54:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF37828BBE for ; Wed, 20 Mar 2019 12:54:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727028AbfCTMyL (ORCPT ); Wed, 20 Mar 2019 08:54:11 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:35648 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727663AbfCTMxv (ORCPT ); Wed, 20 Mar 2019 08:53:51 -0400 Received: by mail-pf1-f196.google.com with SMTP id t21so1125849pfe.2; Wed, 20 Mar 2019 05:53:51 -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:mime-version :content-transfer-encoding; bh=NPe7yqjMKa6Oo+8z7flxzvxuW217bRbP0r4e28VijkY=; b=qEzcFVEsU4JuWCQ0G+66AamOCpEIjynb2TYKRRQWTU96YscncfRreao45B8Ojy+PlT eYAMs8vgJQNkJ7QQ4H/OsDSsDeyyWoVNxRq8OLp6wiVJRKYugvUN/0LM445qhN3ZvBM+ i1HARaBgrSnBiCRGQn460FLLbGsnehkKC2x7FsLtaLUyWT4VKnptVtMjIRP0QrqrTPu8 98QTdteoC947DrJcr/6Xnq/pYy6IvbltOKmVsEAhnRhojhE/4xwL6j8Et5iG+h3dUm2F ikcbr/09JrrWGLXf/5zsYbr3lReFfRhTwPHrTFYljhmV2gxyUw8fPV0NYtvtCIn88hcS xrEw== 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:mime-version :content-transfer-encoding; bh=NPe7yqjMKa6Oo+8z7flxzvxuW217bRbP0r4e28VijkY=; b=UlmaXlJARY+Pxs32+WtxCEqUAlFNDtNNgTW8Did1+gcOR/foIJcoNMZTejpgdISFri zKfFZ5mJpRfsndRD1eSNGi8fS26OAVLw5TRRfskzxdHWGVR5a66Z+Ps7zMZNceE3Vo+A bU4kQu94LN37OWQgmHhPJVbn6s1YenAcPPgFjR2E2qaT2Vvsh5cBvzxIkLjVZrLqK6OZ ZD+1/Max6To7uuRbLda1hC33WpW4FIchdqWK6vD//g9Y5QLhuf7kht+GiYh+LvbO+UNc CxOc9l1deHxZ7otF+wFYJLyuTOo37SzOTtYvmV2YgrxtE70syXkkRoS5na3VEHr4HrV+ iMZQ== X-Gm-Message-State: APjAAAUdtb1gdUM5/NkNBG0FLZPThYbofvSUDas7GjaFMOZtcFNpvla0 LhTWIZRxWeIWIiy9MwVxuVg= X-Google-Smtp-Source: APXvYqyuTzN8bCsj7O5P1QCul5kCCFwcFAi5tsusLmTtB3usd7N8YEpJSIpOWUADQ1l6LqlvsHkcNg== X-Received: by 2002:a17:902:20e3:: with SMTP id v32mr7818234plg.213.1553086430488; Wed, 20 Mar 2019 05:53:50 -0700 (PDT) Received: from localhost.localdomain ([121.137.63.184]) by smtp.gmail.com with ESMTPSA id r8sm2707467pfd.8.2019.03.20.05.53.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 05:53:49 -0700 (PDT) From: Sergey Senozhatsky To: Shuah Khan , Alexei Starovoitov Cc: Stanislav Fomichev , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2 bpf-next 1/3] bpf, tests: tweak endianness selection Date: Wed, 20 Mar 2019 21:53:33 +0900 Message-Id: <20190320125335.19621-1-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Not all compilers have __builtin_bswap16() and __builtin_bswap32(), thus not all compilers are able to compile the following code: (__builtin_constant_p(x) ? \ ___constant_swab16(x) : __builtin_bswap16(x)) That's the reason why bpf_ntohl() doesn't work on GCC < 4.8, for instance: error: implicit declaration of function '__builtin_bswap16' We can use __builtin_bswap16() only if compiler has this built-in, that is, only if __HAVE_BUILTIN_BSWAP16__ is defined. Standard UAPI __swab16()/__swab32() take care of that, and, additionally, handle __builtin_constant_p() cases as well: #ifdef __HAVE_BUILTIN_BSWAP16__ #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) #else #define __swab16(x) \ (__builtin_constant_p((__u16)(x)) ? \ ___constant_swab16(x) : \ __fswab16(x)) #endif So we can tweak selftests/bpf/bpf_endian.h and use UAPI __swab16()/__swab32(). Signed-off-by: Sergey Senozhatsky --- v2: fixed build error, reshuffled patches (Stanislav Fomichev) tools/testing/selftests/bpf/bpf_endian.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/bpf_endian.h b/tools/testing/selftests/bpf/bpf_endian.h index b25595ea4a78..1ed268b2002b 100644 --- a/tools/testing/selftests/bpf/bpf_endian.h +++ b/tools/testing/selftests/bpf/bpf_endian.h @@ -20,12 +20,12 @@ * use different targets. */ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define __bpf_ntohs(x) __builtin_bswap16(x) -# define __bpf_htons(x) __builtin_bswap16(x) +# define __bpf_ntohs(x) __swab16(x) +# define __bpf_htons(x) __swab16(x) # define __bpf_constant_ntohs(x) ___constant_swab16(x) # define __bpf_constant_htons(x) ___constant_swab16(x) -# define __bpf_ntohl(x) __builtin_bswap32(x) -# define __bpf_htonl(x) __builtin_bswap32(x) +# define __bpf_ntohl(x) __swab32(x) +# define __bpf_htonl(x) __swab32(x) # define __bpf_constant_ntohl(x) ___constant_swab32(x) # define __bpf_constant_htonl(x) ___constant_swab32(x) #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ From patchwork Wed Mar 20 12:53:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 10861537 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 763F21575 for ; Wed, 20 Mar 2019 12:54:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C7CE28F85 for ; Wed, 20 Mar 2019 12:54:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A84B29BBB; Wed, 20 Mar 2019 12:54:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E945B29B57 for ; Wed, 20 Mar 2019 12:54:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727927AbfCTMx5 (ORCPT ); Wed, 20 Mar 2019 08:53:57 -0400 Received: from mail-pf1-f178.google.com ([209.85.210.178]:40514 "EHLO mail-pf1-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727415AbfCTMx4 (ORCPT ); Wed, 20 Mar 2019 08:53:56 -0400 Received: by mail-pf1-f178.google.com with SMTP id c207so1873728pfc.7; Wed, 20 Mar 2019 05:53:56 -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=ukIKVfInVk0vzQJMfehxG9303g8RS5J5ExpczTZNN+Q=; b=lbqsMLSiUTrERt4auZfNZGjK8kgDMeg1rfLiRflCBH1aVPDS+D4VC3unUfhCsMdyxY cDDrZ+jiaCXa3YiHc2qq9aXGKc+GP5CfBihzEKn9N3WKNfJ25sppsOp5OGBctg7tI6QA iCc3DnptFPwbunL6XQogVlobLE5uT11rRadC7nHDVLz5rILL8WU2cUefuYCrAAfkkJeq rR2uQIJna8nqt3i/8POhx0XuGxnxNEfOEnqCQQVkU3IqlGFZaEVR9GYVOOeWGwp+4yDQ B8HaVGM70T1FWnBStofWRO1pVBRXfwQPwNLnHEhqef02RsXInSEaNWmgAI8gMpl79LbL dMew== 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=ukIKVfInVk0vzQJMfehxG9303g8RS5J5ExpczTZNN+Q=; b=ZilT+c1P2re6AneIO6VHeKqWOI61WZCOVnWEXxZqksQDl0vugSgrFJeIpdptMw79Br NzWDO69pA5HrSUjKdh+M6UHvctIPAuVGZb9CNkNItkpmHjma4KLDvh0iI7S/4s+4INoj dHhDkEW9WQihc4zSq+pzmfaSRitO2l2HpN81G8jODBxEMfGkm+Hn9DwkHORpcpM3AhYi cmFtUzVGXNfcpGSNl6B7D9uaf2Un+ftXxVGWd4oFeql84f04YB5BAqvG0VeORx/tNABT UC5rH1BHHx8Ba6znv1wNizaCsTixnjbUYf2GAQWfS9qILAmihzf/dtxwbZsWOcNaRhj8 y20w== X-Gm-Message-State: APjAAAX41KuUdx6LSzHg0uBy/NmUZ9jqlxisWeV7QVIIKQbphSWOrTsp FiAeAKUNoFvCA/BYlsXwnA4= X-Google-Smtp-Source: APXvYqyxYzoAhjYzxiR+Zyg73++5Wn2Nj8P2oYyNjvPtFqBo3GQM36yjLXNuuol4spCJ1ySjKSCr6A== X-Received: by 2002:a17:902:1029:: with SMTP id b38mr7730072pla.204.1553086436089; Wed, 20 Mar 2019 05:53:56 -0700 (PDT) Received: from localhost.localdomain ([121.137.63.184]) by smtp.gmail.com with ESMTPSA id r8sm2707467pfd.8.2019.03.20.05.53.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 05:53:55 -0700 (PDT) From: Sergey Senozhatsky To: Shuah Khan , Alexei Starovoitov Cc: Stanislav Fomichev , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2 bpf-next 2/3] bpf, tests: drop unused __bpf_constant_foo defines Date: Wed, 20 Mar 2019 21:53:34 +0900 Message-Id: <20190320125335.19621-2-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320125335.19621-1-sergey.senozhatsky@gmail.com> References: <20190320125335.19621-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Additionally, simplify bpf_ntohs/bpf_ntohl/bpf_htons/bpf_htonl by switching to UAPI swab(). Signed-off-by: Sergey Senozhatsky --- tools/testing/selftests/bpf/bpf_endian.h | 37 +++++------------------- 1 file changed, 8 insertions(+), 29 deletions(-) diff --git a/tools/testing/selftests/bpf/bpf_endian.h b/tools/testing/selftests/bpf/bpf_endian.h index 1ed268b2002b..ba06222963d5 100644 --- a/tools/testing/selftests/bpf/bpf_endian.h +++ b/tools/testing/selftests/bpf/bpf_endian.h @@ -20,38 +20,17 @@ * use different targets. */ #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ -# define __bpf_ntohs(x) __swab16(x) -# define __bpf_htons(x) __swab16(x) -# define __bpf_constant_ntohs(x) ___constant_swab16(x) -# define __bpf_constant_htons(x) ___constant_swab16(x) -# define __bpf_ntohl(x) __swab32(x) -# define __bpf_htonl(x) __swab32(x) -# define __bpf_constant_ntohl(x) ___constant_swab32(x) -# define __bpf_constant_htonl(x) ___constant_swab32(x) +# define bpf_ntohs(x) __swab16(x) +# define bpf_htons(x) __swab16(x) +# define bpf_ntohl(x) __swab32(x) +# define bpf_htonl(x) __swab32(x) #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ -# define __bpf_ntohs(x) (x) -# define __bpf_htons(x) (x) -# define __bpf_constant_ntohs(x) (x) -# define __bpf_constant_htons(x) (x) -# define __bpf_ntohl(x) (x) -# define __bpf_htonl(x) (x) -# define __bpf_constant_ntohl(x) (x) -# define __bpf_constant_htonl(x) (x) +# define bpf_ntohs(x) (x) +# define bpf_htons(x) (x) +# define bpf_ntohl(x) (x) +# define bpf_htonl(x) (x) #else # error "Fix your compiler's __BYTE_ORDER__?!" #endif -#define bpf_htons(x) \ - (__builtin_constant_p(x) ? \ - __bpf_constant_htons(x) : __bpf_htons(x)) -#define bpf_ntohs(x) \ - (__builtin_constant_p(x) ? \ - __bpf_constant_ntohs(x) : __bpf_ntohs(x)) -#define bpf_htonl(x) \ - (__builtin_constant_p(x) ? \ - __bpf_constant_htonl(x) : __bpf_htonl(x)) -#define bpf_ntohl(x) \ - (__builtin_constant_p(x) ? \ - __bpf_constant_ntohl(x) : __bpf_ntohl(x)) - #endif /* __BPF_ENDIAN__ */ From patchwork Wed Mar 20 12:53:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergey Senozhatsky X-Patchwork-Id: 10861539 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 181441575 for ; Wed, 20 Mar 2019 12:54:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F36EE29A77 for ; Wed, 20 Mar 2019 12:54:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6D3929A6B; Wed, 20 Mar 2019 12:54:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7554729BB8 for ; Wed, 20 Mar 2019 12:54:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727946AbfCTMyC (ORCPT ); Wed, 20 Mar 2019 08:54:02 -0400 Received: from mail-pf1-f169.google.com ([209.85.210.169]:43574 "EHLO mail-pf1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727222AbfCTMyC (ORCPT ); Wed, 20 Mar 2019 08:54:02 -0400 Received: by mail-pf1-f169.google.com with SMTP id c8so1866848pfd.10; Wed, 20 Mar 2019 05:54:01 -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=8jgI/FmvlJaP2hZiIBCLGu9+1MttHd5oQtDar/JHNL0=; b=QfyAT6l/ehpmfensZOg2xO1+BtdOcKsQUCktz3qhcKlrL9JRZduPWk8ym8jRWVI2c5 9BQY/GrAOdZ7j+UiPASKTi+K+fGxg+FMMsAUrOUCCjBXkjW7SjHu00ns8Vyerqqw1W8K 0fQ6tl2IQA/Dz9a7qT/IPtMP5plQuxrOVJDgnmhfdY8m9/rbPDgkzW2q2dBPD9JjtE8J ZGbTjdd35IA2TgXc1sAImuit6sUojz4iQirN/UgHTMBbM9COBzweeIMBP3B6PMwWFA/g tL3lqmA5tbFk5F3e4pVKCs1shxLAh50QPGN/BnbfynRwRwx2cfERFkg9OWAqpE5B2YQL JmaA== 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=8jgI/FmvlJaP2hZiIBCLGu9+1MttHd5oQtDar/JHNL0=; b=GrPPNkiw8GNh/XQRRSn6sur3iZI8yiBVlr/CyRH7gvBZCUjcxayi3N85HTgkRrFZ+h zaQZ01a0t1nfAvYMQignIrKJHz9rWyNkpU4iI8n68ao5JgGfwxAGWCqUf+lmO+B3FXv0 CepsnNDXEMegqSMrmRrYvw7/pNJCoKJPIfddv47hLnN7+C6WJ0OpPcHx9igFUlvc2jyW +IAb8Y6N9NJubbLXInAHPAYHvgwn7XnkqU1+hxTqE6bP+BekqTBHcGhfhNDldfag0bDm hmpamjc4ILSOC//WDZHevNRJrpVXqAY+lNwlJmLog8Bo3A+VPL58+WK8CznQnVAbAbEX Dj/Q== X-Gm-Message-State: APjAAAWs5VFmx95uSoEU2j16il7XNElgf9NIezk6cIwMcEUvMxw3dh4w Y5VoCChJE9tK8tE4GQJC4pg= X-Google-Smtp-Source: APXvYqwsGL01PHBuOTrIp8z5ZnHZBR91MliDVBiPtLk5eY7aD215fyBwb1bbO62UeSc8ZiWwJwJ6wg== X-Received: by 2002:a17:902:1101:: with SMTP id d1mr7587631pla.19.1553086441317; Wed, 20 Mar 2019 05:54:01 -0700 (PDT) Received: from localhost.localdomain ([121.137.63.184]) by smtp.gmail.com with ESMTPSA id r8sm2707467pfd.8.2019.03.20.05.53.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Mar 2019 05:54:00 -0700 (PDT) From: Sergey Senozhatsky To: Shuah Khan , Alexei Starovoitov Cc: Stanislav Fomichev , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , linux-kselftest@vger.kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org, Sergey Senozhatsky Subject: [PATCHv2 bpf-next 3/3] bpf, tests: don't use __bpf_constant_htons() Date: Wed, 20 Mar 2019 21:53:35 +0900 Message-Id: <20190320125335.19621-3-sergey.senozhatsky@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190320125335.19621-1-sergey.senozhatsky@gmail.com> References: <20190320125335.19621-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Prefer bpf_htons() instead. Signed-off-by: Sergey Senozhatsky --- tools/testing/selftests/bpf/prog_tests/flow_dissector.c | 4 ++-- tools/testing/selftests/bpf/test_progs.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c index bcbd928c96ab..a194305f98d1 100644 --- a/tools/testing/selftests/bpf/prog_tests/flow_dissector.c +++ b/tools/testing/selftests/bpf/prog_tests/flow_dissector.c @@ -28,7 +28,7 @@ static struct bpf_flow_keys pkt_v4_flow_keys = { .thoff = sizeof(struct iphdr), .addr_proto = ETH_P_IP, .ip_proto = IPPROTO_TCP, - .n_proto = __bpf_constant_htons(ETH_P_IP), + .n_proto = bpf_htons(ETH_P_IP), }; static struct bpf_flow_keys pkt_v6_flow_keys = { @@ -36,7 +36,7 @@ static struct bpf_flow_keys pkt_v6_flow_keys = { .thoff = sizeof(struct ipv6hdr), .addr_proto = ETH_P_IPV6, .ip_proto = IPPROTO_TCP, - .n_proto = __bpf_constant_htons(ETH_P_IPV6), + .n_proto = bpf_htons(ETH_P_IPV6), }; void test_flow_dissector(void) diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 5d10aee9e277..909b339f97f4 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -11,18 +11,18 @@ int error_cnt, pass_cnt; bool jit_enabled; struct ipv4_packet pkt_v4 = { - .eth.h_proto = __bpf_constant_htons(ETH_P_IP), + .eth.h_proto = bpf_htons(ETH_P_IP), .iph.ihl = 5, .iph.protocol = IPPROTO_TCP, - .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES), + .iph.tot_len = bpf_htons(MAGIC_BYTES), .tcp.urg_ptr = 123, .tcp.doff = 5, }; struct ipv6_packet pkt_v6 = { - .eth.h_proto = __bpf_constant_htons(ETH_P_IPV6), + .eth.h_proto = bpf_htons(ETH_P_IPV6), .iph.nexthdr = IPPROTO_TCP, - .iph.payload_len = __bpf_constant_htons(MAGIC_BYTES), + .iph.payload_len = bpf_htons(MAGIC_BYTES), .tcp.urg_ptr = 123, .tcp.doff = 5, };