Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2719020imj; Mon, 11 Feb 2019 07:28:01 -0800 (PST) X-Google-Smtp-Source: AHgI3IYjzGyLhlJUoPr5UdOPcqEjlk6qjlfWxhgdB5dCSqEy0QhXyVVNBYalnmExuSm322O29/ue X-Received: by 2002:a17:902:be10:: with SMTP id r16mr38179748pls.304.1549898881134; Mon, 11 Feb 2019 07:28:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898881; cv=none; d=google.com; s=arc-20160816; b=acolzalukobaWPawzvcH3z4PLtYJhI5YCtQbz5QlNpoa2LSonKlXyGwk1LsN+uHqMq J/oMjgr25BQx0TzMeDQQUvR4xjJn1jxrrgYPWq69DH7xmWd5vCpbXf8qHO7XnrfhDISq fHLJqPdrraLCpcJOQnglKOAi8rYXR1aVyqqSSnj4ieXviRymZfH4ofaBbsykts/SnXjF H1P5PJp5NuSzCIWgcQq5ucEbClzvruRn/m8DnfFC1dOj5ASJAT9cd3HPVPQ/7d9mBQzk tPZOd8kiajjG1+WURZPiZhYBn7CUEwpD3FE84MzbTJBRRaU/MK5pA96s93YKmo9ooGml lZhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=b6sZ35khGrnOXuw9huDXymFKHPYpEePVQgqtwSBxPtA=; b=BGF1UtG0kfAE4K7O/JwtUmhPSaB/wcoxPPUoyUae4GOkhgX5//OH2ZHgE7doYIxRB6 syTft3pP3qPB0FSvtERmzv5eRzdvUL2ytl50uVLQXZJCbiliSEm3aOhui1nhnKInMYor Ym+I2AlO58uYHFanr6ztexy2as0vBheEU12f1VVIq0KwMUX0kZIypvY0pLznS1Stm3/i /i7aBWefdQZrb7OW814A7kWCEOE6AduiewDCFAhv7PYAVHneRgF2c3HRNh/NR/oxFPgk GkD5xpaFql3f8gFmAeRTHr8ZcqppDJuzROVwFB8nM2LuwnYI0/G/MZKSQkd6s1h8x9XV F0HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y2rxCMec; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33si8453262plk.183.2019.02.11.07.27.44; Mon, 11 Feb 2019 07:28:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Y2rxCMec; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389876AbfBKO7u (ORCPT + 99 others); Mon, 11 Feb 2019 09:59:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:47594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727099AbfBKO7r (ORCPT ); Mon, 11 Feb 2019 09:59:47 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id ADEAB222A4; Mon, 11 Feb 2019 14:59:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897187; bh=V5F8ieFbdH9YxOR5YZO2EISp4eaDMAb7lIQ0MexPzsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2rxCMecxS7tZolsbqFl+3IORXhYT2ROq/JyjgvXaXG1FZHniJbJZ51sH5S2kEZcQ qtz4Naxv1JVxdSD65R0Ce2C+1VcAHK9x5jE269DqW/QyLfgI7dvk2/i7I4BgLw+xax O/YCPrmGBJ2wcdNc/QgiAWJRIt/cODlqc26+obqY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stanislav Fomichev , Daniel Borkmann , Alexei Starovoitov , Sasha Levin Subject: [PATCH 4.14 090/205] selftests/bpf: use __bpf_constant_htons in test_prog.c Date: Mon, 11 Feb 2019 15:18:08 +0100 Message-Id: <20190211141834.542968866@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit a0517a0f7ef23550b4484c37e2b9c2d32abebf64 ] For some reason, my older GCC (< 4.8) isn't smart enough to optimize the !__builtin_constant_p() branch in bpf_htons, I see: error: implicit declaration of function '__builtin_bswap16' Let's use __bpf_constant_htons as suggested by Daniel Borkmann. I tried to use simple htons, but it produces the following: test_progs.c:54:17: error: braced-group within expression allowed only inside a function .eth.h_proto = htons(ETH_P_IP), Signed-off-by: Stanislav Fomichev Signed-off-by: Daniel Borkmann Signed-off-by: Alexei Starovoitov Signed-off-by: Sasha Levin --- tools/testing/selftests/bpf/test_progs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/testing/selftests/bpf/test_progs.c b/tools/testing/selftests/bpf/test_progs.c index 11ee25cea227..1903fb4f45d8 100644 --- a/tools/testing/selftests/bpf/test_progs.c +++ b/tools/testing/selftests/bpf/test_progs.c @@ -43,10 +43,10 @@ static struct { struct iphdr iph; struct tcphdr tcp; } __packed pkt_v4 = { - .eth.h_proto = bpf_htons(ETH_P_IP), + .eth.h_proto = __bpf_constant_htons(ETH_P_IP), .iph.ihl = 5, .iph.protocol = 6, - .iph.tot_len = bpf_htons(MAGIC_BYTES), + .iph.tot_len = __bpf_constant_htons(MAGIC_BYTES), .tcp.urg_ptr = 123, }; @@ -56,9 +56,9 @@ static struct { struct ipv6hdr iph; struct tcphdr tcp; } __packed pkt_v6 = { - .eth.h_proto = bpf_htons(ETH_P_IPV6), + .eth.h_proto = __bpf_constant_htons(ETH_P_IPV6), .iph.nexthdr = 6, - .iph.payload_len = bpf_htons(MAGIC_BYTES), + .iph.payload_len = __bpf_constant_htons(MAGIC_BYTES), .tcp.urg_ptr = 123, }; -- 2.19.1