Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC662C43381 for ; Fri, 22 Mar 2019 18:33:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C094E2175B for ; Fri, 22 Mar 2019 18:33:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="tJE3lcHg" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728454AbfCVSdF (ORCPT ); Fri, 22 Mar 2019 14:33:05 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:45184 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727050AbfCVSdF (ORCPT ); Fri, 22 Mar 2019 14:33:05 -0400 Received: by mail-qk1-f194.google.com with SMTP id z76so1784481qkb.12 for ; Fri, 22 Mar 2019 11:33:04 -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=Bo2SpRzxpUgwZn06ZB12MjX4VmmvvXTOA17rYa+yKNw=; b=tJE3lcHguwPotHRij0xbL3T+TkSjHxQYuOUcipkLyQ8lHNfaLng9MpiCxtYt1xsyeL bT6Z5u9S9E2mBVDOx+hafQN6N+kTBtYXyib1nCdoV+2gSXTkzvNPz3bzPOWPXZ6QCscz yzIMJiDz3bT2/FhNveFK1+wGs1Z6jI/lJJ9WdrvOJlIX703F2JhMY6AjsAJiHFodXjuU g3pA107RvC9MHAShvJLc4AFFyjz5drkjmMtIhV/QTZMAdlU44t2lCqcXtVDB8PEOrR9A pRYqpH1YCAcKrINmC/5Tx8HkKMzYLoG/6Rkfo09OmJ9RllJ6TQCxCctF/nH44MzendXB XK/Q== 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=Bo2SpRzxpUgwZn06ZB12MjX4VmmvvXTOA17rYa+yKNw=; b=IAYmcq2ksjKLv/mw8lOEg/uFC2FI7/gTemFU431D4wRjX/LFqj0UdwRIM4itP+hRFh u/MfVtdRf5IbS6OytepjlEXz5b0V8+RkJTXkUgb3AaVfR6+bsG+MnrxgfTgf+kr/iPgY +pFfL2a4Dz0pxHAxart4/sGUlmZWeoKepaymLyqbg85KY9qUIGSBrFSTZLcQ0Uc8tU8g CollCVWrl3oe412xzS3XSiFhKULkEYvqCrPmNHYRkmUFrv6pBZI5nXfvtewxuBlknue+ FEmIARiWpIpxSwuck3aFdu3Uu5KHMYkLIMo5GPnoZphPwqu4VCTCC3A0nWRZAE0R0Nkp um4A== X-Gm-Message-State: APjAAAV+ED/KFQNo5AnK4pw3fA7yJuApn+6MeqkloufJWuYMNfz6TKH4 hZhwcyQ4eh0ieVcrryWRLgoIb5yX X-Google-Smtp-Source: APXvYqy8h8SlKzRes6eTi0S1gRDLHvmppwx+aUNNTwgRI+s1ParmirKzQk6TBrc8PVpM77d503Tvqw== X-Received: by 2002:a05:620a:1428:: with SMTP id k8mr8418553qkj.185.1553279583746; Fri, 22 Mar 2019 11:33:03 -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.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 11:33:02 -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 00/13] bpf tc tunneling Date: Fri, 22 Mar 2019 14:32:47 -0400 Message-Id: <20190322183300.196277-1-willemdebruijn.kernel@gmail.com> X-Mailer: git-send-email 2.21.0.392.gf8f6787159e-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Willem de Bruijn BPF allows for dynamic tunneling, choosing the tunnel destination and features on-demand. Extend bpf_skb_adjust_room to allow for efficient tunneling at the TC hooks. Most features are required for large packets with GSO, as these will be modified after this patch. Patch 1 is a performance optimization, avoiding an unnecessary unclone for the TCP hot path. Patches 2..6 introduce a regression test. These can be squashed, but the code is arguably more readable when gradually expanding the feature set. Patch 7 is a performance optimization, avoid copying network headers that are going to be overwritten. This also simplifies the bpf program. Patch 8 reenables bpf_skb_adjust_room for UDP packets. Patch 9 configures skb tunneling metadata analogous to tunnel devices. Patches 10..13 expand the regression test to make use of the new features and enable the GSO testcases. Changes v1->v2 - move BPF_F_ADJ_ROOM_MASK out of uapi as it can be expanded - document new flags - in tests replace netcat -q flag with coreutils timeout: the -q flag is not supported in all netcat versions v2->v3 - move BPF_F_ADJ_ROOM_ENCAP_L3_MASK out of uapi as it has no use in userspace Willem de Bruijn (13): bpf: in bpf_skb_adjust_room avoid copy in tx fast path selftests/bpf: bpf tunnel encap test selftests/bpf: expand bpf tunnel test with decap selftests/bpf: expand bpf tunnel test to ipv6 selftests/bpf: extend bpf tunnel test with gre selftests/bpf: extend bpf tunnel test with tso bpf: add bpf_skb_adjust_room mode BPF_ADJ_ROOM_MAC bpf: add bpf_skb_adjust_room flag BPF_F_ADJ_ROOM_FIXED_GSO bpf: add bpf_skb_adjust_room encap flags bpf: Sync bpf.h to tools selftests/bpf: convert bpf tunnel test to BPF_ADJ_ROOM_MAC selftests/bpf: convert bpf tunnel test to BPF_F_ADJ_ROOM_FIXED_GSO selftests/bpf: convert bpf tunnel test to encap modes include/uapi/linux/bpf.h | 29 +- net/core/filter.c | 132 +++++++-- tools/include/uapi/linux/bpf.h | 29 +- tools/testing/selftests/bpf/Makefile | 3 +- tools/testing/selftests/bpf/config | 2 + .../selftests/bpf/progs/test_tc_tunnel.c | 261 ++++++++++++++++++ tools/testing/selftests/bpf/test_tc_tunnel.sh | 178 ++++++++++++ 7 files changed, 598 insertions(+), 36 deletions(-) create mode 100644 tools/testing/selftests/bpf/progs/test_tc_tunnel.c create mode 100755 tools/testing/selftests/bpf/test_tc_tunnel.sh -- 2.21.0.392.gf8f6787159e-goog