All of lore.kernel.org
 help / color / mirror / Atom feed
From: Justin Iurman <justin.iurman@uliege.be>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, dsahern@kernel.org,
	yoshfuji@linux-ipv6.org, linux-mm@kvack.org, cl@linux.com,
	penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com,
	akpm@linux-foundation.org, vbabka@suse.cz,
	justin.iurman@uliege.be
Subject: [RFC net-next 1/2] ipv6: ioam: Support for Queue depth data field
Date: Mon,  6 Dec 2021 22:17:57 +0100	[thread overview]
Message-ID: <20211206211758.19057-2-justin.iurman@uliege.be> (raw)
In-Reply-To: <20211206211758.19057-1-justin.iurman@uliege.be>

This patch is an attempt to support the queue depth 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 "queue depth" field is a 4-octet unsigned integer field.  This
   field indicates the current length of the egress interface queue of
   the interface from where the packet is forwarded out.  The queue
   depth is expressed as the current amount of memory buffers used by
   the queue (a packet could consume one or more memory buffers,
   depending on its size).

An existing function (i.e., qdisc_qstats_qlen_backlog) is used to
retrieve the current queue length without reinventing the wheel. Any
comment on that?

Right now, the number of skb's (qlen) is returned, which is not totally
correct compared to what the draft says: "a packet could consume one or
more memory buffers". Any idea on a solution to take this into account?

Note: it was tested and qlen is increasing when an artificial delay is
added on the egress with tc.

  [1] https://datatracker.ietf.org/doc/html/draft-ietf-ippm-ioam-data#section-5.4.2.7

Signed-off-by: Justin Iurman <justin.iurman@uliege.be>
---
 net/ipv6/ioam6.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/net/ipv6/ioam6.c b/net/ipv6/ioam6.c
index 122a3d47424c..088eb2f877bc 100644
--- a/net/ipv6/ioam6.c
+++ b/net/ipv6/ioam6.c
@@ -13,10 +13,12 @@
 #include <linux/ioam6.h>
 #include <linux/ioam6_genl.h>
 #include <linux/rhashtable.h>
+#include <linux/netdevice.h>
 
 #include <net/addrconf.h>
 #include <net/genetlink.h>
 #include <net/ioam6.h>
+#include <net/sch_generic.h>
 
 static void ioam6_ns_release(struct ioam6_namespace *ns)
 {
@@ -717,7 +719,17 @@ static void __ioam6_fill_trace_data(struct sk_buff *skb,
 
 	/* queue depth */
 	if (trace->type.bit6) {
-		*(__be32 *)data = cpu_to_be32(IOAM6_U32_UNAVAILABLE);
+		struct netdev_queue *queue;
+		__u32 qlen, backlog;
+
+		if (skb_dst(skb)->dev->flags & IFF_LOOPBACK) {
+			*(__be32 *)data = cpu_to_be32(IOAM6_U32_UNAVAILABLE);
+		} else {
+			queue = skb_get_tx_queue(skb_dst(skb)->dev, skb);
+			qdisc_qstats_qlen_backlog(queue->qdisc, &qlen, &backlog);
+
+			*(__be32 *)data = cpu_to_be32(qlen);
+		}
 		data += sizeof(__be32);
 	}
 
-- 
2.25.1


  reply	other threads:[~2021-12-06 21:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 21:17 [RFC net-next 0/2] IOAM queue depth and buffer occupancy Justin Iurman
2021-12-06 21:17 ` Justin Iurman [this message]
2021-12-06 21:17 ` [RFC net-next 2/2] ipv6: ioam: Support for Buffer occupancy data field Justin Iurman
2021-12-07  0:16   ` Jakub Kicinski
2021-12-07 11:54     ` Justin Iurman
2021-12-07 15:50       ` Jakub Kicinski
2021-12-07 16:35         ` Justin Iurman
2021-12-07 17:07           ` Jakub Kicinski
2021-12-07 18:05             ` Justin Iurman
2021-12-08 22:18               ` Jakub Kicinski
2021-12-09 14:10                 ` Justin Iurman
2021-12-10  0:38                   ` Jakub Kicinski
2021-12-10 12:57                     ` Justin Iurman
2021-12-21 17:06                     ` Justin Iurman
2021-12-21 17:23                       ` Vladimir Oltean
2021-12-21 20:13                         ` Jakub Kicinski
2021-12-22 16:13                           ` Justin Iurman
2021-12-22 15:49                         ` Justin Iurman
2021-12-07 16:37   ` David Ahern
2021-12-07 16:54     ` Justin Iurman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211206211758.19057-2-justin.iurman@uliege.be \
    --to=justin.iurman@uliege.be \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kuba@kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.