From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x131.google.com (mail-il1-x131.google.com [IPv6:2607:f8b0:4864:20::131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.bufferbloat.net (Postfix) with ESMTPS id 939D23B29E for ; Tue, 7 Dec 2021 13:41:56 -0500 (EST) Received: by mail-il1-x131.google.com with SMTP id w1so2107068ilh.9 for ; Tue, 07 Dec 2021 10:41:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :content-transfer-encoding; bh=w2+hrrHnC4nHfmGRjeEVO2WfdztbgLWbmpz9CD0CP+0=; b=HVLl2O/j5EfHqi/FRT4KaCQy0aISF8qdt9Is1r7e99hSuDcYG3yqGgknVbr6xndQ7O s6+ro/VODsTGXcKtlnPPVhENpzlDrQBKsfVn7kxrXFTQc1GoLQdLqqVqRMrTcDe4oqc9 PgN8eFpmgDJ7mumUgl9y6ubNm3GAi3W55rXXCQIz3S/pWPjrWkHH2UnVBvfRD9wEBcqk aNqZAgttHpUtAhnZ5dzpBYozKNiw/m8FqjPBIweVfa7qskl/yjWBbHK1UKdNo8YPkv5y Yf8s38kFMV1SMak37yotT03Wqh3QLKf6JrCMH9bppbsa3f9W5hYkt6VTpy+QRnZ/bDUo XvWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:content-transfer-encoding; bh=w2+hrrHnC4nHfmGRjeEVO2WfdztbgLWbmpz9CD0CP+0=; b=Fch5stU8PTfxf0P+x/+UPUSwvoTuEfhEld3d7iPL1Lo8SCPFw693RX0ZgWUZeHlSol WS8xUBssgdRZGACussAAaJdgQl+LPCIvYaYY3Fhec1UnJjuygZNLydCaoCPoW3WxbB0N hQ/cA6f1bO9Cwk7Nbhb8xqz8yT2nqPbuDd0kzv2T13pIDTk02Em8V5bPEDdiIO6V/eKW hQuejWmr+O8hU+BCfKmE0gsfVNkt0RdfQ7YKxxy7aSwmr+bh/wT8rrEo03g+UIESVudd gTVU8iFZhnreDOn3G7hZ2d71lZzYaDc9AmLy83En5mfMlc19zKtV6+S6Evt/CQ7Rgen5 3bpQ== X-Gm-Message-State: AOAM533S/fpI+CDS1GaaJCMGpGQFPi3ceY8XaBJxm45kzZMP0FlLsGt0 Jx8XFXRBVmvKOb4aeua3OxX1cQNV6/JkMECZNsrchPzunMk= X-Google-Smtp-Source: ABdhPJzWUZ0xvvTAIBMvFyhvSKprlPPOpdBneuM4l1n6ogIbGnDDRhTCpGBLne93dKs2B9c50w83+4/Dj6n11gY91PA= X-Received: by 2002:a05:6e02:16c9:: with SMTP id 9mr1067336ilx.221.1638902515838; Tue, 07 Dec 2021 10:41:55 -0800 (PST) MIME-Version: 1.0 References: <20211206211758.19057-1-justin.iurman@uliege.be> <20211206211758.19057-3-justin.iurman@uliege.be> In-Reply-To: <20211206211758.19057-3-justin.iurman@uliege.be> From: Dave Taht Date: Tue, 7 Dec 2021 10:41:37 -0800 Message-ID: To: bloat Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: [Bloat] Fwd: [RFC net-next 2/2] ipv6: ioam: Support for Buffer occupancy data field X-BeenThere: bloat@lists.bufferbloat.net X-Mailman-Version: 2.1.20 Precedence: list List-Id: General list for discussing Bufferbloat List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2021 18:41:56 -0000 interesting thread, go respond there, tho. ---------- Forwarded message --------- From: Justin Iurman Date: Mon, Dec 6, 2021 at 9:56 PM Subject: [RFC net-next 2/2] ipv6: ioam: Support for Buffer occupancy data f= ield To: Cc: , , , , , , , , , , , This patch is an attempt to support the buffer occupancy in IOAM trace data fields. Any feedback is appreciated, or any other idea if this one is not correct. The draft [1] says the following: The "buffer occupancy" field is a 4-octet unsigned integer field. This field indicates the current status of the occupancy of the common buffer pool used by a set of queues. The units of this field are implementation specific. Hence, the units are interpreted within the context of an IOAM-Namespace and/or node-id if used. The authors acknowledge that in some operational cases there is a need for the units to be consistent across a packet path through the network, hence it is recommended for implementations to use standard units such as Bytes. An existing function (i.e., get_slabinfo) is used to retrieve info about skbuff_head_cache. For that, both the prototype of get_slabinfo and struct definition of slabinfo were moved from mm/slab.h to include/linux/slab.h. Any objection on this? The function kmem_cache_size is used to retrieve the size of a slab object. Note that it returns the "object_size" field, not the "size" field. If needed, a new function (e.g., kmem_cache_full_size) could be added to return the "size" field. To match the definition from the draft, the number of bytes is computed as follows: slabinfo.active_objs * size Thoughts? [1] https://datatracker.ietf.org/doc/html/draft-ietf-ippm-ioam-data#secti= on-5.4.2.12 Signed-off-by: Justin Iurman --- include/linux/slab.h | 15 +++++++++++++++ mm/slab.h | 14 -------------- net/ipv6/ioam6.c | 13 ++++++++++++- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 181045148b06..745790dbcbcb 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -19,6 +19,21 @@ #include +struct slabinfo { + unsigned long active_objs; + unsigned long num_objs; + unsigned long active_slabs; + unsigned long num_slabs; + unsigned long shared_avail; + unsigned int limit; + unsigned int batchcount; + unsigned int shared; + unsigned int objects_per_slab; + unsigned int cache_order; +}; + +void get_slabinfo(struct kmem_cache *s, struct slabinfo *sinfo); + /* * Flags to pass to kmem_cache_create(). * The ones marked DEBUG are only valid if CONFIG_DEBUG_SLAB is set. diff --git a/mm/slab.h b/mm/slab.h index 56ad7eea3ddf..cd6a8a2768e3 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -175,20 +175,6 @@ void slab_kmem_cache_release(struct kmem_cache *); struct seq_file; struct file; -struct slabinfo { - unsigned long active_objs; - unsigned long num_objs; - unsigned long active_slabs; - unsigned long num_slabs; - unsigned long shared_avail; - unsigned int limit; - unsigned int batchcount; - unsigned int shared; - unsigned int objects_per_slab; - unsigned int cache_order; -}; - -void get_slabinfo(struct kmem_cache *s, struct slabinfo *sinfo); void slabinfo_show_stats(struct seq_file *m, struct kmem_cache *s); ssize_t slabinfo_write(struct file *file, const char __user *buffer, size_t count, loff_t *ppos); diff --git a/net/ipv6/ioam6.c b/net/ipv6/ioam6.c index 088eb2f877bc..f0a44dc2a0df 100644 --- a/net/ipv6/ioam6.c +++ b/net/ipv6/ioam6.c @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include @@ -778,7 +780,16 @@ static void __ioam6_fill_trace_data(struct sk_buff *sk= b, /* buffer occupancy */ if (trace->type.bit11) { - *(__be32 *)data =3D cpu_to_be32(IOAM6_U32_UNAVAILABLE); + struct slabinfo sinfo; + u32 size, bytes; + + sinfo.active_objs =3D 0; + get_slabinfo(skbuff_head_cache, &sinfo); + size =3D kmem_cache_size(skbuff_head_cache); + + bytes =3D min(sinfo.active_objs * size, (unsigned long)(U32_MAX-1)); + + *(__be32 *)data =3D cpu_to_be32(bytes); data +=3D sizeof(__be32); } -- 2.25.1 --=20 I tried to build a better future, a few times: https://wayforward.archive.org/?site=3Dhttps%3A%2F%2Fwww.icei.org Dave T=C3=A4ht CEO, TekLibre, LLC