From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 63E9782D7A for ; Mon, 8 Apr 2024 13:15:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712582130; cv=none; b=MZDG0q7X/k0D9sEYLk6NQASBxDWmSwuG5iDPydM46qVJT9GY0i4IdMZr6GNhsbyZmzdcJAsBlE9cDG7NsLSv0ZOcDEetsPiXFu2hhxqhJ/RA/eLEyyI8EQv/FEz1ms9mWoFTsfKwFmB8NsLSRJYtbPgGaQiOyZxRfv+UEu93EVc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712582130; c=relaxed/simple; bh=sfYzdpPXqlJaE8bYgE/q4pPg6gKv1cfqE8JSzhBi9H4=; h=Message-ID:Date:MIME-Version:Cc:Subject:To:References:From: In-Reply-To:Content-Type; b=fvM56wp3FjR0I6m9PL5hXuPKQMRr9oaBo9Z3lXtngYrkQCE6ATt2QNqu5UySOFhc/+XNYJAiMfYhMUykKld/AgRnyrSjRgqo8pJHahjjAMjwABRZjmd9x3LA54C8H2h1r4EtHTJSJAwEi7g7dpakbv6Aud3euQBbfwoTCL/sQDs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org; spf=pass smtp.mailfrom=ovn.org; arc=none smtp.client-ip=217.70.183.198 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ovn.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ovn.org Received: by mail.gandi.net (Postfix) with ESMTPSA id 02256C000D; Mon, 8 Apr 2024 13:15:19 +0000 (UTC) Message-ID: Date: Mon, 8 Apr 2024 15:16:03 +0200 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Cc: i.maximets@ovn.org, jiri@resnulli.us, xiyou.wangcong@gmail.com, cmi@nvidia.com, yotam.gi@gmail.com, aconole@redhat.com, echaudro@redhat.com, horms@kernel.org Subject: Re: [RFC net-next v2 0/5] net: openvswitch: Add sample multicasting. Content-Language: en-US To: Adrian Moreno , netdev@vger.kernel.org References: <20240408125753.470419-1-amorenoz@redhat.com> From: Ilya Maximets Autocrypt: addr=i.maximets@ovn.org; keydata= xsFNBF77bOMBEADVZQ4iajIECGfH3hpQMQjhIQlyKX4hIB3OccKl5XvB/JqVPJWuZQRuqNQG /B70MP6km95KnWLZ4H1/5YOJK2l7VN7nO+tyF+I+srcKq8Ai6S3vyiP9zPCrZkYvhqChNOCF pNqdWBEmTvLZeVPmfdrjmzCLXVLi5De9HpIZQFg/Ztgj1AZENNQjYjtDdObMHuJQNJ6ubPIW cvOOn4WBr8NsP4a2OuHSTdVyAJwcDhu+WrS/Bj3KlQXIdPv3Zm5x9u/56NmCn1tSkLrEgi0i /nJNeH5QhPdYGtNzPixKgPmCKz54/LDxU61AmBvyRve+U80ukS+5vWk8zvnCGvL0ms7kx5sA tETpbKEV3d7CB3sQEym8B8gl0Ux9KzGp5lbhxxO995KWzZWWokVUcevGBKsAx4a/C0wTVOpP FbQsq6xEpTKBZwlCpxyJi3/PbZQJ95T8Uw6tlJkPmNx8CasiqNy2872gD1nN/WOP8m+cIQNu o6NOiz6VzNcowhEihE8Nkw9V+zfCxC8SzSBuYCiVX6FpgKzY/Tx+v2uO4f/8FoZj2trzXdLk BaIiyqnE0mtmTQE8jRa29qdh+s5DNArYAchJdeKuLQYnxy+9U1SMMzJoNUX5uRy6/3KrMoC/ 7zhn44x77gSoe7XVM6mr/mK+ViVB7v9JfqlZuiHDkJnS3yxKPw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ZHGzxI0isyww7PpEHx6sxFEvMhsOp7qnjPsQUcnGIIiqKlTj H7i86580VndsKrRK99zJrm4s9Tg/7OFP1SpVvNvSM4TRXSzVF25WVfLgeloN1yHC5Wsqk33X XNtNovqA0TLFjhfyyetBsIOgpGakgBNieC9GnY7tC3AG+BqG5jnVuGqSTO+iM/d+lsoa+w== In-Reply-To: <20240408125753.470419-1-amorenoz@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-GND-Sasl: i.maximets@ovn.org On 4/8/24 14:57, Adrian Moreno wrote: > ** Background ** > Currently, OVS supports several packet sampling mechanisms (sFlow, > per-bridge IPFIX, per-flow IPFIX). These end up being translated into a > userspace action that needs to be handled by ovs-vswitchd's handler > threads only to be forwarded to some third party application that > will somehow process the sample and provide observability on the > datapath. > > A particularly interesting use-case is controller-driven > per-flow IPFIX sampling where the OpenFlow controller can add metadata > to samples (via two 32bit integers) and this metadata is then available > to the sample-collecting system for correlation. > > ** Problem ** > The fact that sampled traffic share netlink sockets and handler thread > time with upcalls, apart from being a performance bottleneck in the > sample extraction itself, can severely compromise the datapath, > yielding this solution unfit for highly loaded production systems. > > Users are left with little options other than guessing what sampling > rate will be OK for their traffic pattern and system load and dealing > with the lost accuracy. > > Looking at available infrastructure, an obvious candidated would be > to use psample. However, it's current state does not help with the > use-case at stake because sampled packets do not contain user-defined > metadata. > > ** Proposal ** > In this RFC_v2, I'd like to request feedback on an attempt to fix this > situation by: > > - Extending the existing psample infrastructure to carry a variable > length user-defined cookie. > - Extending the tc act_sample action to use the actions' cookie as > psample metadata. > - Extending the OVS sample action with an attribute > (OVS_SAMPLE_ATTR_PSAMPLE) that contains a u32 group_id and a variable > length cookie and use the the psample infrastructure to multicast > the sample. > - Extending psample to allow group_id filtering on listening sockets so > that users can only receive samples they are interested in. > > -- > rfc_v1 -> rfc_v2: > - Use psample instead of a new OVS-only multicast group. > - Extend psample and tc with a user-defined cookie. > > > Adrian Moreno (5): > net: netlink: export genl private pointer getters > net: psample: add multicast filtering on group_id > net: psample: add user cookie > net:sched:act_sample: add action cookie to sample > net:openvswitch: add psample support > > include/net/psample.h | 2 + > include/uapi/linux/openvswitch.h | 22 ++++- > include/uapi/linux/psample.h | 2 + > net/netlink/genetlink.c | 2 + > net/openvswitch/actions.c | 52 ++++++++++-- > net/openvswitch/datapath.c | 2 +- > net/openvswitch/flow_netlink.c | 78 +++++++++++++---- > net/psample/psample.c | 139 +++++++++++++++++++++++++++++-- > net/sched/act_sample.c | 12 +++ > 9 files changed, 277 insertions(+), 34 deletions(-) > [copying my previous reply since this version actually has netdev@ in Cc] Thanks, Adrian! FWIW, I think this is a reasonable approach to the problem. I won't do a full review since it's an RFC, but I'll leave some comments for individual patches. Best regards, Ilya Maximets.