* [PATCH net-next v3] ipv6: ioam: Support for Queue depth data field
@ 2021-12-30 17:10 Justin Iurman
2021-12-30 19:18 ` Ido Schimmel
2022-01-02 12:20 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Justin Iurman @ 2021-12-30 17:10 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, dsahern, yoshfuji, idosch, justin.iurman
v3:
- Report 'backlog' (bytes) instead of 'qlen' (number of packets)
v2:
- Fix sparse warning (use rcu_dereference)
This patch adds support for the queue depth in IOAM trace data fields.
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.
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 | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/net/ipv6/ioam6.c b/net/ipv6/ioam6.c
index 122a3d47424c..e159eb4328a8 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,19 @@ 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;
+ struct Qdisc *qdisc;
+ __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 = rcu_dereference(queue->qdisc);
+ qdisc_qstats_qlen_backlog(qdisc, &qlen, &backlog);
+
+ *(__be32 *)data = cpu_to_be32(backlog);
+ }
data += sizeof(__be32);
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net-next v3] ipv6: ioam: Support for Queue depth data field
2021-12-30 17:10 [PATCH net-next v3] ipv6: ioam: Support for Queue depth data field Justin Iurman
@ 2021-12-30 19:18 ` Ido Schimmel
2022-01-02 12:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Ido Schimmel @ 2021-12-30 19:18 UTC (permalink / raw)
To: Justin Iurman; +Cc: netdev, davem, kuba, dsahern, yoshfuji
On Thu, Dec 30, 2021 at 06:10:04PM +0100, Justin Iurman wrote:
> v3:
> - Report 'backlog' (bytes) instead of 'qlen' (number of packets)
>
> v2:
> - Fix sparse warning (use rcu_dereference)
>
> This patch adds support for the queue depth in IOAM trace data fields.
>
> 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.
>
> 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>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net-next v3] ipv6: ioam: Support for Queue depth data field
2021-12-30 17:10 [PATCH net-next v3] ipv6: ioam: Support for Queue depth data field Justin Iurman
2021-12-30 19:18 ` Ido Schimmel
@ 2022-01-02 12:20 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-01-02 12:20 UTC (permalink / raw)
To: Justin Iurman; +Cc: netdev, davem, kuba, dsahern, yoshfuji, idosch
Hello:
This patch was applied to netdev/net-next.git (master)
by David S. Miller <davem@davemloft.net>:
On Thu, 30 Dec 2021 18:10:04 +0100 you wrote:
> v3:
> - Report 'backlog' (bytes) instead of 'qlen' (number of packets)
>
> v2:
> - Fix sparse warning (use rcu_dereference)
>
> This patch adds support for the queue depth in IOAM trace data fields.
>
> [...]
Here is the summary with links:
- [net-next,v3] ipv6: ioam: Support for Queue depth data field
https://git.kernel.org/netdev/net-next/c/b63c5478e9cb
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-02 12:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-30 17:10 [PATCH net-next v3] ipv6: ioam: Support for Queue depth data field Justin Iurman
2021-12-30 19:18 ` Ido Schimmel
2022-01-02 12:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).