From patchwork Thu Apr 26 21:01:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: William Tu X-Patchwork-Id: 905375 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="ah8RNGbR"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40X8dc4p4Yz9rvt for ; Fri, 27 Apr 2018 07:02:12 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752769AbeDZVCH (ORCPT ); Thu, 26 Apr 2018 17:02:07 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:37985 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751496AbeDZVCF (ORCPT ); Thu, 26 Apr 2018 17:02:05 -0400 Received: by mail-pg0-f66.google.com with SMTP id n9so4060815pgq.5 for ; Thu, 26 Apr 2018 14:02:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=N/Qtg2F9xovqm5KfnxxSjX3n1OtSDpOp+1e9YsJdVEc=; b=ah8RNGbRmCjnNBCce1r+fUqQGS7RfhJ5iPmodtuFFbAeKWtLyES7QHUAeR/DYAGqsF U3b8MqmQZkw/p2gdeyjtRupv+iho/LOtz+F4ywOrJ0TlhwZF9o5+tChbJZL/MpgN0X++ yYtQ0mcJxk7WzsBfveGif0F1UpNq9Plpf5Uf2zhjFEKA5gWnqfzk7RXNDG9rhz4UB3Xh VkZJIhGuy9pBLenCh8LUcF8YNswNpjEJkxd4NAhsVOOcQKtbYCJh6SPfXngAOuzd+qDh G6nR+PcL1tQxp4xucdyHCCU+stSsttgHPkovBanWiCCieT2SLVfW/9oBzTaymnOlE+l2 JPpQ== 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; bh=N/Qtg2F9xovqm5KfnxxSjX3n1OtSDpOp+1e9YsJdVEc=; b=Cz+ZRCkWl8F5a9b0OUXi2UrHEWB5ODPVm1BlEUhmVT9qk6uKwBLifDX35b41guNfcG oio9HZBotcozVxdCXCe93s5GgmzyuVk/QT9xdy4amw9VwdGtq4SANjJ152QPuYirrpHo OYPVq0hhi6Stz5AoQ0wPGucT/3+ddS5R2dbfY74sX1PJo54NbB9RtRRm3H/0X0XIpkRn skdVnhoWrtDcqtqsITHwtjFzEW6HNXsnAiNKTb0XdZxnfTXsfX8HVQGqkDTvSa6aKHkl SlO8qXZxttmeMQCkdHuIfBCHLoH4rgNa/MOnxZa0wEmcFx0m5us+lIL2EuSCclcch3q5 IbBg== X-Gm-Message-State: ALQs6tD9tJR5MU0JzWYXLhvo8bQZ8j5iUC3AGnTn2KZjWzJ9WCkJMdeG OTheZB9fSLs8pZyXjVtlOgqEp8Rw X-Google-Smtp-Source: AB8JxZq1LXb/y2PKyuymvuoLzkzBPZzCphdZuhTK8vVykRci/piHkfev89h26zWltLTKTjPNBxHJHQ== X-Received: by 2002:a17:902:b788:: with SMTP id e8-v6mr12054061pls.263.1524776525189; Thu, 26 Apr 2018 14:02:05 -0700 (PDT) Received: from sc9-mailhost3.vmware.com ([66.170.99.2]) by smtp.gmail.com with ESMTPSA id r68sm36974944pfi.174.2018.04.26.14.02.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 26 Apr 2018 14:02:03 -0700 (PDT) From: William Tu To: netdev@vger.kernel.org Subject: [PATCHv2 bpf-next 0/2] BPF tunnel testsuite Date: Thu, 26 Apr 2018 14:01:38 -0700 Message-Id: <1524776500-27030-1-git-send-email-u9012063@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The patch series provide end-to-end eBPF tunnel testsute. A common topology is created below for all types of tunnels: Topology: --------- root namespace | at_ns0 namespace | ----------- | ----------- | tnl dev | | | tnl dev | (overlay network) ----------- | ----------- metadata-mode | native-mode with bpf | | ---------- | ---------- | veth1 | --------- | veth0 | (underlay network) ---------- peer ---------- Device Configuration -------------------- Root namespace with metadata-mode tunnel + BPF Device names and addresses: veth1 IP: 172.16.1.200, IPv6: 00::22 (underlay) tunnel dev 11, ex: gre11, IPv4: 10.1.1.200 (overlay) Namespace at_ns0 with native tunnel Device names and addresses: veth0 IPv4: 172.16.1.100, IPv6: 00::11 (underlay) tunnel dev 00, ex: gre00, IPv4: 10.1.1.100 (overlay) End-to-end ping packet flow --------------------------- Most of the tests start by namespace creation, device configuration, then ping the underlay and overlay network. When doing 'ping 10.1.1.100' from root namespace, the following operations happen: 1) Route lookup shows 10.1.1.100/24 belongs to tnl dev, fwd to tnl dev. 2) Tnl device's egress BPF program is triggered and set the tunnel metadata, with remote_ip=172.16.1.200 and others. 3) Outer tunnel header is prepended and route the packet to veth1's egress 4) veth0's ingress queue receive the tunneled packet at namespace at_ns0 5) Tunnel protocol handler, ex: vxlan_rcv, decap the packet 6) Forward the packet to the overlay tnl dev Test Cases ----------------------------- Tunnel Type | BPF Programs ----------------------------- GRE: gre_set_tunnel, gre_get_tunnel IP6GRE: ip6gretap_set_tunnel, ip6gretap_get_tunnel ERSPAN: erspan_set_tunnel, erspan_get_tunnel IP6ERSPAN: ip4ip6erspan_set_tunnel, ip4ip6erspan_get_tunnel VXLAN: vxlan_set_tunnel, vxlan_get_tunnel IP6VXLAN: ip6vxlan_set_tunnel, ip6vxlan_get_tunnel GENEVE: geneve_set_tunnel, geneve_get_tunnel IP6GENEVE: ip6geneve_set_tunnel, ip6geneve_get_tunnel IPIP: ipip_set_tunnel, ipip_get_tunnel IP6IP: ipip6_set_tunnel, ipip6_get_tunnel, ip6ip6_set_tunnel, ip6ip6_get_tunnel XFRM: xfrm_get_state William Tu (2): selftests/bpf: bpf tunnel test. samples/bpf: remove the bpf tunnel testsuite. samples/bpf/Makefile | 1 - samples/bpf/tcbpf2_kern.c | 612 --------------------- samples/bpf/test_tunnel_bpf.sh | 390 ------------- tools/testing/selftests/bpf/Makefile | 5 +- tools/testing/selftests/bpf/test_tunnel.sh | 729 +++++++++++++++++++++++++ tools/testing/selftests/bpf/test_tunnel_kern.c | 713 ++++++++++++++++++++++++ 6 files changed, 1445 insertions(+), 1005 deletions(-) delete mode 100644 samples/bpf/tcbpf2_kern.c delete mode 100755 samples/bpf/test_tunnel_bpf.sh create mode 100755 tools/testing/selftests/bpf/test_tunnel.sh create mode 100644 tools/testing/selftests/bpf/test_tunnel_kern.c