Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp525658lqr; Wed, 5 Jun 2024 12:51:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZ5lGJfeKO8pdI/3jgOka27np0xxTrd8n+USFK0ygd5bzbSIK7ndgwQsc3po/WT9JbQkucaRdJDk1JA+6wMjYQ+XnnjoIzM+Qbv9Pz0g== X-Google-Smtp-Source: AGHT+IGwyF2x2NOpx2Ldv0bDeV1qSjpoA5Inw1TMGISHZhWS6NhIDlppgyXtCqkI6zSVgA7sMkCx X-Received: by 2002:a05:6a21:3390:b0:1b0:18d1:c46c with SMTP id adf61e73a8af0-1b2b6ff5f19mr4441506637.27.1717617100983; Wed, 05 Jun 2024 12:51:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717617100; cv=pass; d=google.com; s=arc-20160816; b=lKWNZL9zS3mRZs3mjaL+Da0qloGmKP03gP4bsVZ3GB6FLKnu/mdYTVDbUVCGJJ1ZHm HhgwC+pMruYeaZe0XGQPE/xgqQEKJUT1xvbhDIaC1Ke2Uor245NVEa36Y/UnzoUMnTDS kYp/C0GSUlDHHXUG19Zo9VVpc8O1ykblL4E+SrtDwFpKrqehYv/PneeRdvbmpo8ep/K9 xvoRrSwg+2lJNbS7QnceKB4Y0EJD19cs2snDSlv4gYI42VR9h2H1Yad2exgbfr8kbO9E Ai9QyPqtwn40YPyHLXKkA/Bw70lDlsuuKbJ/S/hGmwpaxc+GEUPLu9BP00BWL9wgGXgm nqNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fe0vdguc6drhAiswjxQiz8RrvlGbWoCscanW1bd8lsA=; fh=DAGT5/aQ2dsggNMuSMmhJHO6nBIWXjoFs8LhCbtadHQ=; b=D9caQRHqXOnMvSDx+nnTjmk7dE8J6nERk1zoea6q3T/h4Gm29ziFFZqzF2XQDf97YA tVCA94L1ua6UflsObtJnZvT8xhVwj08CwQ4CpOeF9zuht+rSzlIBFsNCfHkr70HAHD27 hJP1A8+j1t/5jzE3nXVUeonynbeu61T2LoTI9jexXGzvUFAu6i/GNqSG8GGNT5R4bSQt W2rJApn1+IdQQxRJco+uvmdiBDvpMbQNjrlHghPmlLEPngwf198fzgo9D+5oCwAGdXiV bJDRPru2DF7N5h4o42KGmyL2PDAF2yOEQ04TvcoiRvWIcGByxutp5MYdZKqcF0xtzRtE v1lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IaqxZLI+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-7027a6a29cfsi4822745b3a.90.2024.06.05.12.51.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 12:51:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-203123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IaqxZLI+; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-203123-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-203123-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id E17A5281F72 for ; Wed, 5 Jun 2024 19:51:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3E45415444A; Wed, 5 Jun 2024 19:51:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IaqxZLI+" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 63E36154436; Wed, 5 Jun 2024 19:51:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717617083; cv=none; b=T6UM2mD1+W+RSzgGN3n1UG0sNN2GODdBg1oM9IRmSTvPZGtOWpDM/3mUSeYcmX4bluBGuoIJz9xwGiMpzSdyg1IJ/nUFsFauqu/ik0IJxnVUM6q1pLgMTkPnlUqm/3uq/KkFTutVHAH7+zl4FVrhUW89iGiF6YlNLSv5A4FCJSM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717617083; c=relaxed/simple; bh=41iLXtRakTOZqv2vBnh0hQcqUw/AeJryNuhiaoedJ2U=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iONyMQu8JOldhXx4b2TnNTAvSLBYeWxDPKOkvEnJBaavH5vw3jwTGw12vvt0NYZKj4nsz7lEYKCqbPD5eQHy6q0Pa6YaXPiLfCYkMR1ueV05C5dZFOsUOFMmXihiO3u5NpZ1rF+scEvP6DYuZOS0x8g8IJqWOZisskUVTQRhubU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IaqxZLI+; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B281C2BD11; Wed, 5 Jun 2024 19:51:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717617083; bh=41iLXtRakTOZqv2vBnh0hQcqUw/AeJryNuhiaoedJ2U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IaqxZLI+2cB24EwHJTLJbXiihQiwYcxhN5QYLFPVeXsxCPAh7xv185XcWVOUoYHax 3UT5mJDBVRO44xUCjiPIaPpugGOIGLEFLR0do+4FaFIDOD2o+MaRGodvBdq95hZ+dE 9Yg3yRVrd3f+M3grquR+Awyd0QiZx2y+3+Lq0xRUVodMS87bc5khz28kk/FUUPwlD1 iiSIdvgCB1IoZcW3VrmEK3EvAE6hBTFSNtUHZNdZwZ2Y6p5yABoeRDAehXVnMgaiLG dZkl04UBnywnZyzoo7IsOBis0HqVhb/s8vgwhaIw1YMemDBfSdFGVByAd4hh1dI8rZ DireAE1JRzXkw== Date: Wed, 5 Jun 2024 20:51:17 +0100 From: Simon Horman To: Adrian Moreno Cc: netdev@vger.kernel.org, aconole@redhat.com, echaudro@redhat.com, i.maximets@ovn.org, dev@openvswitch.org, Donald Hunter , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Pravin B Shelar , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2 5/9] net: openvswitch: add emit_sample action Message-ID: <20240605195117.GY791188@kernel.org> References: <20240603185647.2310748-1-amorenoz@redhat.com> <20240603185647.2310748-6-amorenoz@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240603185647.2310748-6-amorenoz@redhat.com> On Mon, Jun 03, 2024 at 08:56:39PM +0200, Adrian Moreno wrote: > Add support for a new action: emit_sample. > > This action accepts a u32 group id and a variable-length cookie and uses > the psample multicast group to make the packet available for > observability. > > The maximum length of the user-defined cookie is set to 16, same as > tc_cookie, to discourage using cookies that will not be offloadable. > > Signed-off-by: Adrian Moreno Hi Adrian, Some minor nits from my side. ... > diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h > index efc82c318fa2..a0e9dde0584a 100644 > --- a/include/uapi/linux/openvswitch.h > +++ b/include/uapi/linux/openvswitch.h > @@ -914,6 +914,30 @@ struct check_pkt_len_arg { > }; > #endif > > +#define OVS_EMIT_SAMPLE_COOKIE_MAX_SIZE 16 > +/** > + * enum ovs_emit_sample_attr - Attributes for %OVS_ACTION_ATTR_EMIT_SAMPLE > + * action. > + * > + * @OVS_EMIT_SAMPLE_ATTR_GROUP: 32-bit number to identify the source of the > + * sample. > + * @OVS_EMIT_SAMPLE_ATTR_COOKIE: A variable-length binary cookie that contains > + * user-defined metadata. The maximum length is 16 bytes. > + * > + * Sends the packet to the psample multicast group with the specified group and > + * cookie. It is possible to combine this action with the > + * %OVS_ACTION_ATTR_TRUNC action to limit the size of the packet being emitted. > + */ > +enum ovs_emit_sample_attr { > + OVS_EMIT_SAMPLE_ATTR_UNPSEC, > + OVS_EMIT_SAMPLE_ATTR_GROUP, /* u32 number. */ > + OVS_EMIT_SAMPLE_ATTR_COOKIE, /* Optional, user specified cookie. */ > + __OVS_EMIT_SAMPLE_ATTR_MAX > +}; > + > +#define OVS_EMIT_SAMPLE_ATTR_MAX (__OVS_EMIT_SAMPLE_ATTR_MAX - 1) > + > + nit: One blank line is enough. Flagged by checkpatch.pl > /** > * enum ovs_action_attr - Action types. > * > @@ -1004,6 +1028,7 @@ enum ovs_action_attr { > OVS_ACTION_ATTR_ADD_MPLS, /* struct ovs_action_add_mpls. */ > OVS_ACTION_ATTR_DEC_TTL, /* Nested OVS_DEC_TTL_ATTR_*. */ > OVS_ACTION_ATTR_DROP, /* u32 error code. */ > + OVS_ACTION_ATTR_EMIT_SAMPLE, /* Nested OVS_EMIT_SAMPLE_ATTR_*. */ nit: Please add OVS_ACTION_ATTR_EMIT_SAMPLE to the Kenrel doc for this structure. > > __OVS_ACTION_ATTR_MAX, /* Nothing past this will be accepted > * from userspace. */ ...