From patchwork Thu Jun 1 11:16:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Mi X-Patchwork-Id: 1788989 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=SeLw9kSa; dkim-atps=neutral Received: from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QX3Ww20KGz20QJ for ; Thu, 1 Jun 2023 21:17:48 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 89B90424E0; Thu, 1 Jun 2023 11:17:45 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 89B90424E0 Authentication-Results: smtp4.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=SeLw9kSa X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qz2xAB2Ybdkj; Thu, 1 Jun 2023 11:17:42 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp4.osuosl.org (Postfix) with ESMTPS id 62EAE424D7; Thu, 1 Jun 2023 11:17:39 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 62EAE424D7 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id F387CC0094; Thu, 1 Jun 2023 11:17:36 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 179E2C0029 for ; Thu, 1 Jun 2023 11:17:35 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 30D9B614FE for ; Thu, 1 Jun 2023 11:17:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 30D9B614FE Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=Nvidia.com header.i=@Nvidia.com header.a=rsa-sha256 header.s=selector2 header.b=SeLw9kSa X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5Gb09zLYxwna for ; Thu, 1 Jun 2023 11:17:33 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 4C53D60A7B Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on20615.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eb2::615]) by smtp3.osuosl.org (Postfix) with ESMTPS id 4C53D60A7B for ; Thu, 1 Jun 2023 11:17:33 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Po1uVp0TpA/W0CHm+ebSLxeP/oTX6toXyP97rSquCGVbgWh8zpYG/73a7mGy0GD6JlFR8qq4m9DVV3tk2Me1lB4p+Vk9fod/rKNh4io01Avn20o5tOulVjJNQJmcoMuZXcdbq1d71XhYYrxdGhZHuGALU6ccy4qq+oP1pFnW337xhfkANiAqmWkIF2olpuJsapaeYJ/OXiAx+xc0VHBkBwKRrkW+nhDdIraNsvx8cOQXsgkOdhwcujOT7XmC87XBevPXvaJi19jPZoK81RDJB2hDTSfEVf7zJrWPa2P6GeCn9c0+45PbUZCqnI0SXxpmR9Dz5kyJoaD0dh9JfOQp1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eo6HWp+kXlXk46W30de3ve8rjPXSXif89pFW/3qvQRk=; b=Ro87YpcJr3ptFRRk5WeIeCEUbnD2bHvLz5f9fNnRe7N1MA8TMzWHOrUZk/D2Jcw0mAW2iqTyILHBitkLvvou61UDQrsEHXAymQfc9WZs/iPBsB2lOXyNx+ax+WPTGRvIvXlcFHl4ct2fZVhTSBXCwE7byUFI2ihIJQIHJwdYDSqUZRIAhO2x1vExyPIfUJLUWqWPIvwvpPiCOBYvkyPOCF+Zbav72EWdOszyXQyEOjdOk+9P4CAdmEPy4eWy2YqS0xvnd+u0zE1LS7yj/+V17YNTwiFKqu52Afism72UNu6Y5HCN7dOO04qY1VRLldoG0/hXdcsVDZIaRDWFH/IavQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=openvswitch.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eo6HWp+kXlXk46W30de3ve8rjPXSXif89pFW/3qvQRk=; b=SeLw9kSafbRjYQXSxcEbSZnk11fcWpoMFlrSigph4DJBtlaAmSBnsdiAE/jK578BzofcDv3MPpl6Ai+lQjTZXV+UqGlBh5pnv7c/1ToRk+EIXN3g+2dHtNwCajTDXdchQ+kLriy+hveduaF1CL+dak811OrTLRDY31r3zl8laQ93/IeEPvw9LStxxG/aKCL14HtJHqLpePnos5bpVemDz2oc8e9HbAsb+andS+Dk7xfxGpM/701dxv6mkCeuwBCxS3hWigRKTAc1xNFSk95vW2nn8gLHAl6xW4S0c3ePtJSfKOcFRgOo1+NWY+IyEeDMIPSAuHpjhtm3v+l07a72ZQ== Received: from MW3PR06CA0003.namprd06.prod.outlook.com (2603:10b6:303:2a::8) by CY8PR12MB7732.namprd12.prod.outlook.com (2603:10b6:930:87::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.23; Thu, 1 Jun 2023 11:17:29 +0000 Received: from CO1PEPF000044FA.namprd21.prod.outlook.com (2603:10b6:303:2a:cafe::8d) by MW3PR06CA0003.outlook.office365.com (2603:10b6:303:2a::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.23 via Frontend Transport; Thu, 1 Jun 2023 11:17:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1PEPF000044FA.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6477.3 via Frontend Transport; Thu, 1 Jun 2023 11:17:29 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 1 Jun 2023 04:17:07 -0700 Received: from rnnvmail201.nvidia.com (10.129.68.8) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 1 Jun 2023 04:17:07 -0700 Received: from c-237-115-160-163.mtl.labs.mlnx (10.127.8.12) by mail.nvidia.com (10.129.68.8) with Microsoft SMTP Server id 15.2.986.37 via Frontend Transport; Thu, 1 Jun 2023 04:17:03 -0700 To: Date: Thu, 1 Jun 2023 14:16:51 +0300 Message-ID: <20230601111658.113144-2-cmi@nvidia.com> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20230601111658.113144-1-cmi@nvidia.com> References: <20230601111658.113144-1-cmi@nvidia.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044FA:EE_|CY8PR12MB7732:EE_ X-MS-Office365-Filtering-Correlation-Id: da058d67-9209-4e86-da01-08db6291c989 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QfgVs0wnaygRjPVlEExO8//V1dYx8ku7xWunjmnwL+qkFD+/mDYTsWRRG5RenEttf08Z+85X2M+B7gyktYpbL2h1+EmRu53o9dPxo3TwUxrm7dn6X2nulcVvxz2kBG3ZwMW9WsdKkQca4SFy51rshwDt/nX2ZjCxMMN6JMzWHd/SJQjR0rjN+65uD8h+Wv0vOIlgkqsuHcWEcTvFwHjltwce2aUL8rHFctyVb9T96zegBT17NJOXqlWMwYo6589UV0IWRV43EbjKy3tk8RXB/2TVx/2qGIO2HNDb7BUXoBs96TeACCvTjRoGum+GBfIrL72jvLRK7M7ywJEuOu6eP5JsuBRJOIkMTPza26B7EnX+u58jXTMyNS9qKg1iKSk0ytIz0RTKOtsLQHYhxE6vseXBn9B2eCnNuq6To1ZKXbmpVjT99IGTbffWfgPjQzKHqs0E4XzUGQarN8U2b7DTeNy3PKAB/RJzrNgKUix8q+IC7p0tIFBJzSdou0AdS+t5GhmlaVuKX0CGNr5N5Phd/g0X1TFvMSlXLLHZb9CdE66vKebx5Qd014RgCiqtlr6iy1C1x8OQWYiV+OOHgeoHAW/nlw0VMpA5k3y01hACy0Tn5sg1LRxSHrWkj/FyLF5fhxFBHVY7un2UH5XEgD9iHvgJ9UCXpORPTFMp6kzEcdFwTigLI+AUFD/7xTZTqBPVXhI/lg1PMW3faevSNrjwHG+9yRYu+PPUY80CwJXkirE= X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230028)(4636009)(136003)(346002)(396003)(376002)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(186003)(107886003)(41300700001)(2616005)(336012)(426003)(83380400001)(26005)(1076003)(6666004)(47076005)(36860700001)(40460700003)(54906003)(478600001)(6916009)(82740400003)(70206006)(70586007)(7636003)(40480700001)(316002)(356005)(2906002)(8936002)(5660300002)(8676002)(82310400005)(4326008)(36756003)(86362001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Jun 2023 11:17:29.2685 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: da058d67-9209-4e86-da01-08db6291c989 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044FA.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7732 Cc: elibr@nvidia.com, simon.horman@corigine.com, roniba@nvidia.com, i.maximets@ovn.org, konguyen@redhat.com, majd@nvidia.com, maord@nvidia.com Subject: [ovs-dev] [PATCH v27 1/8] compat: Add psample and tc sample action defines for older kernels 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: , X-Patchwork-Original-From: Chris Mi via dev From: Chris Mi Reply-To: Chris Mi Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" Update kernel UAPI to support psample and the tc sample action. Signed-off-by: Chris Mi Reviewed-by: Roi Dayan Acked-by: Eelco Chaudron --- include/linux/automake.mk | 10 +++--- include/linux/psample.h | 62 ++++++++++++++++++++++++++++++++ include/linux/tc_act/tc_sample.h | 25 +++++++++++++ 3 files changed, 93 insertions(+), 4 deletions(-) create mode 100644 include/linux/psample.h create mode 100644 include/linux/tc_act/tc_sample.h diff --git a/include/linux/automake.mk b/include/linux/automake.mk index cdae5eedc..a397562c0 100644 --- a/include/linux/automake.mk +++ b/include/linux/automake.mk @@ -1,12 +1,14 @@ noinst_HEADERS += \ - include/linux/netlink.h \ + include/linux/gen_stats.h \ include/linux/netfilter/nf_conntrack_sctp.h \ + include/linux/netlink.h \ include/linux/openvswitch.h \ include/linux/pkt_cls.h \ - include/linux/gen_stats.h \ + include/linux/psample.h \ + include/linux/tc_act/tc_ct.h \ include/linux/tc_act/tc_mpls.h \ include/linux/tc_act/tc_pedit.h \ + include/linux/tc_act/tc_sample.h \ include/linux/tc_act/tc_skbedit.h \ include/linux/tc_act/tc_tunnel_key.h \ - include/linux/tc_act/tc_vlan.h \ - include/linux/tc_act/tc_ct.h + include/linux/tc_act/tc_vlan.h diff --git a/include/linux/psample.h b/include/linux/psample.h new file mode 100644 index 000000000..e585db5bf --- /dev/null +++ b/include/linux/psample.h @@ -0,0 +1,62 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __UAPI_PSAMPLE_H +#define __UAPI_PSAMPLE_H + +enum { + PSAMPLE_ATTR_IIFINDEX, + PSAMPLE_ATTR_OIFINDEX, + PSAMPLE_ATTR_ORIGSIZE, + PSAMPLE_ATTR_SAMPLE_GROUP, + PSAMPLE_ATTR_GROUP_SEQ, + PSAMPLE_ATTR_SAMPLE_RATE, + PSAMPLE_ATTR_DATA, + PSAMPLE_ATTR_GROUP_REFCOUNT, + PSAMPLE_ATTR_TUNNEL, + + PSAMPLE_ATTR_PAD, + PSAMPLE_ATTR_OUT_TC, /* u16 */ + PSAMPLE_ATTR_OUT_TC_OCC, /* u64, bytes */ + PSAMPLE_ATTR_LATENCY, /* u64, nanoseconds */ + PSAMPLE_ATTR_TIMESTAMP, /* u64, nanoseconds */ + PSAMPLE_ATTR_PROTO, /* u16 */ + + __PSAMPLE_ATTR_MAX +}; + +enum psample_command { + PSAMPLE_CMD_SAMPLE, + PSAMPLE_CMD_GET_GROUP, + PSAMPLE_CMD_NEW_GROUP, + PSAMPLE_CMD_DEL_GROUP, +}; + +enum psample_tunnel_key_attr { + PSAMPLE_TUNNEL_KEY_ATTR_ID, /* be64 Tunnel ID */ + PSAMPLE_TUNNEL_KEY_ATTR_IPV4_SRC, /* be32 src IP address. */ + PSAMPLE_TUNNEL_KEY_ATTR_IPV4_DST, /* be32 dst IP address. */ + PSAMPLE_TUNNEL_KEY_ATTR_TOS, /* u8 Tunnel IP ToS. */ + PSAMPLE_TUNNEL_KEY_ATTR_TTL, /* u8 Tunnel IP TTL. */ + PSAMPLE_TUNNEL_KEY_ATTR_DONT_FRAGMENT, /* No argument, set DF. */ + PSAMPLE_TUNNEL_KEY_ATTR_CSUM, /* No argument. CSUM packet. */ + PSAMPLE_TUNNEL_KEY_ATTR_OAM, /* No argument. OAM frame. */ + PSAMPLE_TUNNEL_KEY_ATTR_GENEVE_OPTS, /* Array of Geneve options. */ + PSAMPLE_TUNNEL_KEY_ATTR_TP_SRC, /* be16 src Transport Port. */ + PSAMPLE_TUNNEL_KEY_ATTR_TP_DST, /* be16 dst Transport Port. */ + PSAMPLE_TUNNEL_KEY_ATTR_VXLAN_OPTS, /* Nested VXLAN opts* */ + PSAMPLE_TUNNEL_KEY_ATTR_IPV6_SRC, /* struct in6_addr src IPv6 address. */ + PSAMPLE_TUNNEL_KEY_ATTR_IPV6_DST, /* struct in6_addr dst IPv6 address. */ + PSAMPLE_TUNNEL_KEY_ATTR_PAD, + PSAMPLE_TUNNEL_KEY_ATTR_ERSPAN_OPTS, /* struct erspan_metadata */ + PSAMPLE_TUNNEL_KEY_ATTR_IPV4_INFO_BRIDGE, /* No argument. IPV4_INFO_BRIDGE mode.*/ + __PSAMPLE_TUNNEL_KEY_ATTR_MAX +}; + +/* Can be overridden at runtime by module option */ +#define PSAMPLE_ATTR_MAX (__PSAMPLE_ATTR_MAX - 1) + +#define PSAMPLE_NL_MCGRP_CONFIG_NAME "config" +#define PSAMPLE_NL_MCGRP_SAMPLE_NAME "packets" +#define PSAMPLE_GENL_NAME "psample" +#define PSAMPLE_GENL_VERSION 1 + +#endif diff --git a/include/linux/tc_act/tc_sample.h b/include/linux/tc_act/tc_sample.h new file mode 100644 index 000000000..fee1bcc20 --- /dev/null +++ b/include/linux/tc_act/tc_sample.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __LINUX_TC_SAMPLE_H +#define __LINUX_TC_SAMPLE_H + +#include +#include +#include + +struct tc_sample { + tc_gen; +}; + +enum { + TCA_SAMPLE_UNSPEC, + TCA_SAMPLE_TM, + TCA_SAMPLE_PARMS, + TCA_SAMPLE_RATE, + TCA_SAMPLE_TRUNC_SIZE, + TCA_SAMPLE_PSAMPLE_GROUP, + TCA_SAMPLE_PAD, + __TCA_SAMPLE_MAX +}; +#define TCA_SAMPLE_MAX (__TCA_SAMPLE_MAX - 1) + +#endif