From patchwork Mon Nov 2 12:48:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Breathitt Gray X-Patchwork-Id: 1392226 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CPt655stjz9sVN; Mon, 2 Nov 2020 23:49:33 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1kZZH7-0006E4-0N; Mon, 02 Nov 2020 12:49:29 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kZZGw-00066A-Vf for kernel-team@lists.ubuntu.com; Mon, 02 Nov 2020 12:49:19 +0000 Received: from mail-qv1-f71.google.com ([209.85.219.71]) by youngberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kZZGw-00045I-7W for kernel-team@lists.ubuntu.com; Mon, 02 Nov 2020 12:49:18 +0000 Received: by mail-qv1-f71.google.com with SMTP id w1so8146871qvv.0 for ; Mon, 02 Nov 2020 04:49:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6oRHOy62LOL8gkFxJiMjKgZBlF3dvrbryQtSJJJ7yws=; b=BevwLdLazwX2nKGtpDHyFGNh/dCTjFe11/A1XYD5eWGkjOrua942eeQL9+/eSa8CFq HlONdfWndyK0A1NiDZQXaKKRKSNMMpNOBVrc9xOueQiD6JRxkM+tXAjfpidN3YqhIuV9 X+uq2lg8B+YDAQ4VuLjyW4HFdap7+bhu0sW7JG2xpNzhrncJfrqmJHmuKoI2fNtDcelD gG4EEaKGzUDu9WbnTTMw+oYXIIbXnFSgRnySZGzvC5Qyo3ZDcO7qJydXeXUy1j1f55n9 Ow1w/LGyC60WKDtBXPDiPsvNIBD7gUbUb1KmzPGZ+ZRpOuRQAHHJ9r+J7zm1Z4m2TJTn /Q8w== X-Gm-Message-State: AOAM533mzLokAgwYvFLk+VdKAj5ui9ab2GosvIdR1Zpd1dKCGX3/ep2x kszRxfpX8fWSkWCiYM9UK2QLbGjY/M1duSMlrTyRwxsgt5ZXdoNRvnNiYXJx+axWiBRp/svTa+E kAG4h+QkFofYGCzZyKyVQ4X0/K1iAi49NSHankhrRJg== X-Received: by 2002:ac8:6b92:: with SMTP id z18mr2997070qts.30.1604321357060; Mon, 02 Nov 2020 04:49:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/02HdwkzJjt3hGC7+9Ha6AgEqHNbEGMR+czqY6B35DoC9RYCdBza2MmNOpJqLa9OX4mKPBw== X-Received: by 2002:ac8:6b92:: with SMTP id z18mr2997056qts.30.1604321356859; Mon, 02 Nov 2020 04:49:16 -0800 (PST) Received: from localhost.localdomain (072-189-064-225.res.spectrum.com. [72.189.64.225]) by smtp.gmail.com with ESMTPSA id q7sm7666201qtd.49.2020.11.02.04.49.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Nov 2020 04:49:15 -0800 (PST) From: William Breathitt Gray To: kernel-team@lists.ubuntu.com Subject: [SRU][B:linux-azure-4.15][PATCH 16/40] xdp: move struct xdp_buff from filter.h to xdp.h Date: Mon, 2 Nov 2020 07:48:32 -0500 Message-Id: <20201102124856.4659-17-william.gray@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201102124856.4659-1-william.gray@canonical.com> References: <20201102124856.4659-1-william.gray@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jesper Dangaard Brouer BugLink: https://bugs.launchpad.net/bugs/1877654 This is done to prepare for the next patch, and it is also nice to move this XDP related struct out of filter.h. Signed-off-by: Jesper Dangaard Brouer Signed-off-by: David S. Miller (backported from commit 106ca27f2922e8de820d1bd3d79b1cbdf2d78eea) [ vilhelmgray: context adjustment ] Signed-off-by: William Breathitt Gray --- include/linux/filter.h | 24 +----------------------- include/net/xdp.h | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index 449091818f43..ef3df706b417 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -29,6 +29,7 @@ struct sock; struct seccomp_data; struct bpf_prog_aux; struct xdp_rxq_info; +struct xdp_buff; /* ArgX, context and stack frame pointer register positions. Note, * Arg1, Arg2, Arg3, etc are used as argument mappings of function @@ -489,14 +490,6 @@ struct bpf_skb_data_end { void *data_end; }; -struct xdp_buff { - void *data; - void *data_end; - void *data_meta; - void *data_hard_start; - struct xdp_rxq_info *rxq; -}; - /* Compute the linear packet data range [data, data_end) which * will be accessed by various program types (cls_bpf, act_bpf, * lwt, ...). Subsystems allowing direct data access must (!) @@ -731,21 +724,6 @@ int xdp_do_redirect(struct net_device *dev, struct bpf_prog *prog); void xdp_do_flush_map(void); -/* Drivers not supporting XDP metadata can use this helper, which - * rejects any room expansion for metadata as a result. - */ -static __always_inline void -xdp_set_data_meta_invalid(struct xdp_buff *xdp) -{ - xdp->data_meta = xdp->data + 1; -} - -static __always_inline bool -xdp_data_meta_unsupported(const struct xdp_buff *xdp) -{ - return unlikely(xdp->data_meta > xdp->data); -} - void bpf_warn_invalid_xdp_action(u32 act); struct sock *do_sk_redirect_map(struct sk_buff *skb); diff --git a/include/net/xdp.h b/include/net/xdp.h index e4207699c410..15f8ade008b5 100644 --- a/include/net/xdp.h +++ b/include/net/xdp.h @@ -50,6 +50,13 @@ struct xdp_rxq_info { struct xdp_mem_info mem; } ____cacheline_aligned; /* perf critical, avoid false-sharing */ +struct xdp_buff { + void *data; + void *data_end; + void *data_meta; + void *data_hard_start; + struct xdp_rxq_info *rxq; +}; static inline void xdp_return_frame(void *data, struct xdp_mem_info *mem) @@ -72,4 +79,19 @@ bool xdp_rxq_info_is_reg(struct xdp_rxq_info *xdp_rxq); int xdp_rxq_info_reg_mem_model(struct xdp_rxq_info *xdp_rxq, enum xdp_mem_type type, void *allocator); +/* Drivers not supporting XDP metadata can use this helper, which + * rejects any room expansion for metadata as a result. + */ +static __always_inline void +xdp_set_data_meta_invalid(struct xdp_buff *xdp) +{ + xdp->data_meta = xdp->data + 1; +} + +static __always_inline bool +xdp_data_meta_unsupported(const struct xdp_buff *xdp) +{ + return unlikely(xdp->data_meta > xdp->data); +} + #endif /* __LINUX_NET_XDP_H__ */