Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp938425lqs; Fri, 14 Jun 2024 09:45:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX4sNAj4K3zkj1YBxYhqm5r7HrIaYhi8ZEbrFz3FuopBYLaPkgVVQOXPDsaIhTW8LdipmTfW5/qg++VaXFaS6BYfakstKHncNL4s9XEwQ== X-Google-Smtp-Source: AGHT+IEY3YtDtFXMkRb6mDMMSJl4RNKlUDbIQfc+ATqBE4+CSyZv7vMQRUMFToF6ZterejtMU8Ts X-Received: by 2002:a05:6a20:3c92:b0:1b7:77ef:b121 with SMTP id adf61e73a8af0-1bae7e1caf4mr3961586637.13.1718383514545; Fri, 14 Jun 2024 09:45:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718383514; cv=pass; d=google.com; s=arc-20160816; b=x0vS7aYLWcZ4Mn0gziYjR6U+FFR0PZB8Nj5N3uhiAkOUu0zt8powqtbV7xQDQP5vbt GNp/5c7cqRM2uXJfpsVxCYPLxblW/RW/TbknLcvv7CZTBsTfzdyEq7L+QqVzDpRZJB1Q C+UFV13AK6M1msGMqADiv7e7pHvimoutVaQdVZxv4PNi+TzkU4ZByXP+sFqdbaBQMoIK V62v0PlJ34EBBYSLqBgG5vMA3gek+BeiRB8ExXrDPJ9NOlpTpk0frluTQxjuxLIS3ugI TDbix32XrFABKV35Q80X4Ij3T1fSatqv+6hyCJdM4FdwHNDl++gpbT19yh9bvitY1BqH Njpw== 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=Po3kZ0epNqC/nUCuDzDeXs2utchB5j1Z8nf8ZMB4Xls=; fh=o8af4o0N0bnrfCGmyHoVdoh8zBlMpfMuARXsDCtO3GA=; b=IcLkLUZZmfAt9LPvN3v8NGEwnnSGr81xTujvt89F3oeSfhiA/f2lTax9hcPy4VJmVL +Ngb13a1kK52hhVghqpcuevGhA2+VGnVufL1wz8lGEYkRMxWITbtLC/TZ+57KyFuA3y7 VYtW11oL9h0HhhnyUg/bHQIlEJm4jo5bKle+VOMfvbG4W/wQmZbQ9YzleW5jN3lLw/cY dyUQOs7iHnVjdqmuNMHJFSsi0/VtBfNJA0d0zm94YtrV7CxcqDZlvN4dqwC+XmVLgT7g HFLL0U0buT8WFCxm4HtmZtuOZzmNqZfe0nGHWdDWrkEdNzirg7WSjJnWGbVlnqDfJ+14 SfRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ahZf/ccb"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215206-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-705ccbc7d57si4042990b3a.383.2024.06.14.09.45.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 09:45:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ahZf/ccb"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-215206-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215206-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 6B041B27C9F for ; Fri, 14 Jun 2024 16:11:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 171A316F0D1; Fri, 14 Jun 2024 16:11:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ahZf/ccb" 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 3BD476CDB3; Fri, 14 Jun 2024 16:11:35 +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=1718381496; cv=none; b=SNSoJO/g0GpfBJaMp+kWnKJ1teOiihtZhBCjkZdbE2yPITfWLvtkrJNK7QCbcrIOGjX1g75eYSQ+CMkZTJt6jgg/N+rTdsAOn/MbNyv+oLZKDiBBFdrFRALJeU5LRhcN937rYPVhJ7QTmYVpfTiTAQj7QJsJdxFzAlVhbFjZAlo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718381496; c=relaxed/simple; bh=Y11qylTcMXSe5/oFaWd9ccqY6xOb5K0E3H4fKo7i4BU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CtZ9Rri9KU1FRgnk4BxSTGpvWyKKmEz+BaBZpxH0pZL1zWqMGTkWO+aCsAiqk5YA2M+XtTM6UgVB7rEa4XTZfon9IMfK3UdDxEbSwjbE9TuraeD0yaYkWqMBFBZe10EtzRIMNHX/9+8CBNOASBxE/Rv4UMSfNNB6f4KXmYbuS7c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ahZf/ccb; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C9C8BC2BD10; Fri, 14 Jun 2024 16:11:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718381495; bh=Y11qylTcMXSe5/oFaWd9ccqY6xOb5K0E3H4fKo7i4BU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ahZf/ccbbybr/r4coTPcq6i/A1fbSnqQStKe6wZV4Vky54gDKsFaQLAEvkkFxfYFM 0k1G6/MMuDwlzCUZlVWwwoty7pko2YHa67rXZkgcbzTy93RclN0UjNtRibEB/V+kgL 8pjLcLpI4zC59jAgbxkrs1FK0SSbcjfoiKGaT3eRCINmQtR2k4PrTdzZoU3T1/v1XF tGs6Nu1FfbtRww5MkPg5plsgno8PI1tTK5mffvJAyNDm2nCgrE/xUQGZLSlg50e+Mh u/PaDaYwV8qI/U4fdcOmLz5nqrc2wmPg5Dm4ZCaAJ3VD5RlhIpYdOxJg9vLcl0T9FB AGpKk2cPkKTqg== Date: Fri, 14 Jun 2024 17:11:30 +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, Yotam Gigi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Jamal Hadi Salim , Cong Wang , Jiri Pirko , linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next v2 4/9] net: psample: allow using rate as probability Message-ID: <20240614161130.GP8447@kernel.org> References: <20240603185647.2310748-1-amorenoz@redhat.com> <20240603185647.2310748-5-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-5-amorenoz@redhat.com> On Mon, Jun 03, 2024 at 08:56:38PM +0200, Adrian Moreno wrote: > Although not explicitly documented in the psample module itself, the > definition of PSAMPLE_ATTR_SAMPLE_RATE seems inherited from act_sample. > > Quoting tc-sample(8): > "RATE of 100 will lead to an average of one sampled packet out of every > 100 observed." > > With this semantics, the rates that we can express with an unsigned > 32-bits number are very unevenly distributed and concentrated towards > "sampling few packets". > For example, we can express a probability of 2.32E-8% but we > cannot express anything between 100% and 50%. > > For sampling applications that are capable of sampling a decent > amount of packets, this sampling rate semantics is not very useful. > > Add a new flag to the uAPI that indicates that the sampling rate is > expressed in scaled probability, this is: > - 0 is 0% probability, no packets get sampled. > - U32_MAX is 100% probability, all packets get sampled. > > Signed-off-by: Adrian Moreno Hi Adrian, Would it be possible to add appropriate documentation for rate - both the original ratio variant, and the new probability variant - somewhere? That aside, this looks good to me. ...