From patchwork Thu Oct 29 11:23:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mi X-Patchwork-Id: 1390066 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CMNP83RZ9z9sSC for ; Thu, 29 Oct 2020 22:23:56 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 25EC9868D4; Thu, 29 Oct 2020 11:23:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kleXTkEK37ht; Thu, 29 Oct 2020 11:23:53 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 4D2CC84F27; Thu, 29 Oct 2020 11:23:53 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 3390FC088B; Thu, 29 Oct 2020 11:23:53 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 441AFC0051 for ; Thu, 29 Oct 2020 11:23:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 2DB0F226E9 for ; Thu, 29 Oct 2020 11:23:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Nld4l78r+GRl for ; Thu, 29 Oct 2020 11:23:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by silver.osuosl.org (Postfix) with ESMTP id 911BB203D2 for ; Thu, 29 Oct 2020 11:23:48 +0000 (UTC) Received: from Internal Mail-Server by MTLPINE1 (envelope-from cmi@nvidia.com) with SMTP; 29 Oct 2020 13:23:44 +0200 Received: from dev-r630-04.mtbc.labs.mlnx (dev-r630-04.mtbc.labs.mlnx [10.75.205.14]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 09TBNg0b022472; Thu, 29 Oct 2020 13:23:43 +0200 From: Chris Mi To: dev@openvswitch.org Date: Thu, 29 Oct 2020 19:23:28 +0800 Message-Id: <20201029112340.14167-1-cmi@nvidia.com> X-Mailer: git-send-email 2.21.1 MIME-Version: 1.0 Cc: elibr@nvidia.com, Chris Mi , roniba@nvidia.com, i.maximets@ovn.org Subject: [ovs-dev] [PATCH v5 00/12] Add offload support for sFlow X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" This patch set adds offload support for sFlow. Psample is a genetlink channel for packet sampling. TC action act_sample uses psample to send sampled packets to userspace. When offloading sample action to TC, userspace creates a unique ID to map sFlow action and tunnel info and passes this ID to kernel instead of the sFlow info. psample will send this ID and sampled packet to userspace. Using the ID, userspace can recover the sFlow info and send sampled packet to the right sFlow monitoring host. Travis: v5: https://travis-ci.com/github/mishuang2017/ovs/builds/195422006 v2-v1: - Fix robot errors. v3-v2: - Remove Gerrit Change-Id. - Add patch #9 to fix older kernels build issue. - Add travis test result. v4-v3: - Fix offload issue when sampling rate is 1. v5-v4: - Move polling thread from ofproto to netdev-offload-tc. Chris Mi (12): compat: Add psample and tc sample action defines for older kernels ovs-kmod-ctl: Load kernel module psample dpif: Introduce register sFlow upcall callback API ofproto: Add upcall callback to process sFlow packet netdev-offload: Introduce register sFlow upcall callback API netdev-offload-tc: Implement register sFlow upcall callback API dpif-netlink: Implement register sFlow upcall callback API netdev-offload-tc: Introduce group ID management API netdev-offload-tc: Remove redundant ovsthread once netdev-offload-tc: Create psample netlink socket netdev-offload-tc: Add psample receive handler netdev-offload-tc: Add offload support for sFlow include/linux/automake.mk | 4 +- include/linux/psample.h | 58 +++ include/linux/tc_act/tc_sample.h | 25 ++ lib/dpif-netdev.c | 1 + lib/dpif-netlink.c | 27 ++ lib/dpif-netlink.h | 4 + lib/dpif-provider.h | 10 + lib/dpif.c | 8 + lib/dpif.h | 26 ++ lib/netdev-offload-provider.h | 3 + lib/netdev-offload-tc.c | 594 ++++++++++++++++++++++++++++++- lib/netdev-offload.c | 30 ++ lib/netdev-offload.h | 4 + lib/tc.c | 61 +++- lib/tc.h | 10 +- ofproto/ofproto-dpif-upcall.c | 42 +++ utilities/ovs-kmod-ctl.in | 14 + 17 files changed, 902 insertions(+), 19 deletions(-) create mode 100644 include/linux/psample.h create mode 100644 include/linux/tc_act/tc_sample.h