From patchwork Tue Jul 18 04:56:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Fastabend X-Patchwork-Id: 789862 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XTTnuTp1"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3xBSZ955d1z9sBR for ; Tue, 18 Jul 2017 14:57:05 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751357AbdGRE5D (ORCPT ); Tue, 18 Jul 2017 00:57:03 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33022 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750931AbdGRE5C (ORCPT ); Tue, 18 Jul 2017 00:57:02 -0400 Received: by mail-pf0-f194.google.com with SMTP id e199so1318233pfh.0 for ; Mon, 17 Jul 2017 21:57:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:user-agent:mime-version :content-transfer-encoding; bh=OaMyx9hTUIKXFOAsLZHD4tV36D8caFTMKNi++N+ZksA=; b=XTTnuTp1jywedAj6oQXEeuuK7wyknQuaLblYCCWSECaj/w6mSrdghfD02FcHdKfd/t CyMzUYU/BI7dz1MzwqZy57/R6k229xYkpypWKPCMeTyGY3vbm/t4n+erY7mf7qJ/XLL/ LZx0F/21mu+ypq6lP+8FqENol+sVRZ8v5HdZjWco2ks7TE4M/ZWuCbN2Jhkak03FyP+y 5F9dXX9/UDX28i28cTC7vzNSWAb4Hy717ZSvLfsjHa4JfLs0ikGnpORUYOlEPsvogQB7 8ke6etW2aoi+q2a+xsbeOvU34qdOUQnVr/GqJbGAGGdAIERVqXfYrmls0RZWq9305YJ0 0WEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:user-agent :mime-version:content-transfer-encoding; bh=OaMyx9hTUIKXFOAsLZHD4tV36D8caFTMKNi++N+ZksA=; b=pqg6AjX9Tn/Fgf+tsRSN9MKJjAeFFTXcjl7EvaNWflCqJIZY1dkoh4efpC0pV28cAK Fi+xKE0Y3shSGXk1QqUsGvgN784HGpHlRY/EygoiamUiXzfH0A2IJI9MclAAZXyrhpQu 78UOm+PqvUo7sp+BieHKd4iTUdC9cKQrJnRXeeSoItfgsY9X6G8cfANkNgZJJoUO2Ouw VO3zygEvhM/Tg/ec9Gbw6gv4CuvBLEt0CsrZI01GoZ8mUVBgKA6rmTv2U62LpaR91fKr KO2pcAmdAnV8riQyZgVFKHcDZr2n9p4xOH/2QiCL+T6gLfbCU+UyBZfLsvxY1reQUwwv QKdA== X-Gm-Message-State: AIVw1113sne0ydCTB+4bHtpx4Dmq7/6g4PnG+nT5hPfsGrVAAt3lA96j MZC47F54rjTKN8V8 X-Received: by 10.84.231.193 with SMTP id g1mr1209676pln.264.1500353821882; Mon, 17 Jul 2017 21:57:01 -0700 (PDT) Received: from [127.0.1.1] ([72.168.145.49]) by smtp.gmail.com with ESMTPSA id y14sm1566322pgr.1.2017.07.17.21.56.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Jul 2017 21:57:01 -0700 (PDT) Subject: [net-next PATCH] net: fix build error in devmap helper calls From: John Fastabend To: davem@davemloft.net Cc: netdev@vger.kernel.org, john.fastabend@gmail.com Date: Mon, 17 Jul 2017 21:56:48 -0700 Message-ID: <20170718045648.7398.68557.stgit@john-Precision-Tower-5810> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Initial patches missed case with CONFIG_BPF_SYSCALL not set. Fixes: 11393cc9b9be ("xdp: Add batching support to redirect map") Fixes: 97f91a7cf04f ("bpf: add bpf_redirect_map helper routine") Signed-off-by: John Fastabend --- include/linux/bpf.h | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 6850a76..6353c74 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -318,6 +318,12 @@ static inline void bpf_long_memcpy(void *dst, const void *src, u32 size) /* verify correctness of eBPF program */ int bpf_check(struct bpf_prog **fp, union bpf_attr *attr); + +/* Map specifics */ +struct net_device *__dev_map_lookup_elem(struct bpf_map *map, u32 key); +void __dev_map_insert_ctx(struct bpf_map *map, u32 index); +void __dev_map_flush(struct bpf_map *map); + #else static inline struct bpf_prog *bpf_prog_get(u32 ufd) { @@ -356,6 +362,20 @@ static inline int __bpf_prog_charge(struct user_struct *user, u32 pages) static inline void __bpf_prog_uncharge(struct user_struct *user, u32 pages) { } + +static inline struct net_device *__dev_map_lookup_elem(struct bpf_map *map, + u32 key) +{ + return NULL; +} + +static inline void __dev_map_insert_ctx(struct bpf_map *map, u32 index) +{ +} + +static inline void __dev_map_flush(struct bpf_map *map) +{ +} #endif /* CONFIG_BPF_SYSCALL */ /* verifier prototypes for helper functions called from eBPF programs */ @@ -379,9 +399,4 @@ static inline void __bpf_prog_uncharge(struct user_struct *user, u32 pages) void bpf_user_rnd_init_once(void); u64 bpf_user_rnd_u32(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5); -/* Map specifics */ -struct net_device *__dev_map_lookup_elem(struct bpf_map *map, u32 key); -void __dev_map_insert_ctx(struct bpf_map *map, u32 index); -void __dev_map_flush(struct bpf_map *map); - #endif /* _LINUX_BPF_H */