From patchwork Fri Mar 22 18:32:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Willem de Bruijn X-Patchwork-Id: 1061513 X-Patchwork-Delegate: bpf@iogearbox.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="j56s22nw"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44Qsjg59qwz9sRY for ; Sat, 23 Mar 2019 05:33:27 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729262AbfCVSdU (ORCPT ); Fri, 22 Mar 2019 14:33:20 -0400 Received: from mail-qt1-f194.google.com ([209.85.160.194]:43473 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729182AbfCVSdS (ORCPT ); Fri, 22 Mar 2019 14:33:18 -0400 Received: by mail-qt1-f194.google.com with SMTP id v32so3598462qtc.10 for ; Fri, 22 Mar 2019 11:33:18 -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=Ix2OYdk9akDYpdqu5sL68XWfjPMMyFUkZJXIEXnYoMw=; b=j56s22nwCxDaYBb/3k9eNYbSMjLfg+/Wdd0RtmHBYMFsUQxP+ydPbgWE4TQgHPRbUM 7iqS0xqKbVPsXPCO23qKiYrDLknwRLrUGRN8XfwQgWamBcbfd7OCGVwpvGnxuA0VT5dj FFPsMuMMadpxWYypP1U1kZbd2MzlBpXQ98FWDvX+EAreBk8LuF96twDCiKCEROQKerVG 7bq7vc1R1d9nuHkDbteMtmCtHntQq5RQGZCh8pz5CiwQkmA4A+c5MG5PMHolbrm/ZKlz OuLtXgbrJ9l2laOAQlhjoD87Vq8kFM8GQ9lYh1FiXMQoucoTjNTDqLo8dcEonAssnT0r sC6A== 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=Ix2OYdk9akDYpdqu5sL68XWfjPMMyFUkZJXIEXnYoMw=; b=HJqnpHFz6kBOddACmLA6HJTMZV1QNZ4ggtfC5fmuygqujTCNtah9gO6KCKxlsK9BOx qTuelpiHIew/ibPLZ954YyInfZPogq0NiFCjtsQDo9aif90WqZmmeZb2dzvPK3cf4UOi Ejxic/igF42dg2GAdxX0esGXpxlT5aF77JgvrCxX0q2mISKf4uTWYz8b+nwx9zt10jev GH5aJfUcHiIlUsc18ccLVVCe4C2ClSoyFhcik/J+VjVQMkaLci+xmnCtWhoMc86A4Ze6 5/fiEiqbs61dQvzI9Njek8bEQXhhMhhXOj7ngEbaJAle5juZ7xiSCwHDL9k+vBUrh6Ka l/Qw== X-Gm-Message-State: APjAAAXSg4Ey8om3j99kFrUTveLpazTPJvPnHFSQtJuBR1/M/U1dV+2f 5dh1tZ/NVsgH+WuUGIXKMR+Z8rri X-Google-Smtp-Source: APXvYqxXoQRx6fH+U92oaofpf4pod7nqj4iftN2wq8plXmqGfCDK2GXE/Eb26quoJywTevKyGmmvvw== X-Received: by 2002:ac8:1244:: with SMTP id g4mr9507894qtj.304.1553279597380; Fri, 22 Mar 2019 11:33:17 -0700 (PDT) Received: from willemb1.nyc.corp.google.com ([2620:0:1003:315:3fa1:a34c:1128:1d39]) by smtp.gmail.com with ESMTPSA id t49sm5828331qte.86.2019.03.22.11.33.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 11:33:16 -0700 (PDT) From: Willem de Bruijn To: netdev@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, sdf@google.com, posk@google.com, Willem de Bruijn Subject: [PATCH bpf-next v3 10/13] bpf: Sync bpf.h to tools Date: Fri, 22 Mar 2019 14:32:57 -0400 Message-Id: <20190322183300.196277-11-willemdebruijn.kernel@gmail.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog In-Reply-To: <20190322183300.196277-1-willemdebruijn.kernel@gmail.com> References: <20190322183300.196277-1-willemdebruijn.kernel@gmail.com> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Willem de Bruijn Sync include/uapi/linux/bpf.h with tools/ Changes v1->v2: - BPF_F_ADJ_ROOM_MASK moved, no longer in this commit v2->v3: - BPF_F_ADJ_ROOM_ENCAP_L3_MASK moved, no longer in this commit Signed-off-by: Willem de Bruijn --- tools/include/uapi/linux/bpf.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h index 3c04410137d9..837024512baf 100644 --- a/tools/include/uapi/linux/bpf.h +++ b/tools/include/uapi/linux/bpf.h @@ -1478,13 +1478,27 @@ union bpf_attr { * Grow or shrink the room for data in the packet associated to * *skb* by *len_diff*, and according to the selected *mode*. * - * There is a single supported mode at this time: + * There are two supported modes at this time: + * + * * **BPF_ADJ_ROOM_MAC**: Adjust room at the mac layer + * (room space is added or removed below the layer 2 header). * * * **BPF_ADJ_ROOM_NET**: Adjust room at the network layer * (room space is added or removed below the layer 3 header). * - * All values for *flags* are reserved for future usage, and must - * be left at zero. + * The following flags are supported at this time: + * + * * **BPF_F_ADJ_ROOM_FIXED_GSO**: Do not adjust gso_size. + * Adjusting mss in this way is not allowed for datagrams. + * + * * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 **: + * * **BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 **: + * Any new space is reserved to hold a tunnel header. + * Configure skb offsets and other fields accordingly. + * + * * **BPF_F_ADJ_ROOM_ENCAP_L4_GRE **: + * * **BPF_F_ADJ_ROOM_ENCAP_L4_UDP **: + * Use with ENCAP_L3 flags to further specify the tunnel type. * * A call to this helper is susceptible to change the underlaying * packet buffer. Therefore, at load time, all checks on pointers @@ -2624,9 +2638,18 @@ enum bpf_func_id { /* Current network namespace */ #define BPF_F_CURRENT_NETNS (-1L) +/* BPF_FUNC_skb_adjust_room flags. */ +#define BPF_F_ADJ_ROOM_FIXED_GSO (1ULL << 0) + +#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV4 (1ULL << 1) +#define BPF_F_ADJ_ROOM_ENCAP_L3_IPV6 (1ULL << 2) +#define BPF_F_ADJ_ROOM_ENCAP_L4_GRE (1ULL << 3) +#define BPF_F_ADJ_ROOM_ENCAP_L4_UDP (1ULL << 4) + /* Mode for BPF_FUNC_skb_adjust_room helper. */ enum bpf_adj_room_mode { BPF_ADJ_ROOM_NET, + BPF_ADJ_ROOM_MAC, }; /* Mode for BPF_FUNC_skb_load_bytes_relative helper. */