mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: Paul Moses <p@1g4.org>,
	netdev@vger.kernel.org, xiyou.wangcong@gmail.com,
	jiri@resnulli.us, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, horms@kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>
Subject: Re: [PATCH net] net: sched: act_api: size RTM_GETACTION reply by fill size
Date: Thu, 5 Feb 2026 22:36:15 +0200	[thread overview]
Message-ID: <20260205203615.t3n3bbqmjscp2cnz@skbuf> (raw)
In-Reply-To: <CAM0EoMk75BJYQUXm7FDW=ZmRsUqib3L+9tEAL90q_+DreroeXQ@mail.gmail.com> <CAM0EoMk75BJYQUXm7FDW=ZmRsUqib3L+9tEAL90q_+DreroeXQ@mail.gmail.com>

On Thu, Feb 05, 2026 at 02:23:00PM -0500, Jamal Hadi Salim wrote:
> On Thu, Feb 5, 2026 at 10:13 AM Paul Moses <p@1g4.org> wrote:
> >
> > Looks like pedit might also affected. Hopefully this makes it more clear. Going to wait on more input before doing anything else with this.
> >
> > NLMSG_GOODSIZE = SKB_WITH_OVERHEAD(min(PAGE_SIZE, 8192))
> > SKB_WITH_OVERHEAD(X) = X - SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
> > nla_total_size(payload) = NLA_ALIGN(NLA_HDRLEN + payload), with NLA_HDRLEN = 4 and 4 byte alignment
> >
> > Per entry size for the gate list:
> >
> > Each entry is a nested TCA_GATE_ONE_ENTRY plus five attributes:
> >
> > TCA_GATE_ONE_ENTRY (nest, no payload) -> 4
> > INDEX (u32) -> 8
> > GATE (flag, no payload) -> 4
> > INTERVAL (u32) -> 8
> > MAX_OCTETS (s32) -> 8
> > IPV (s32) -> 8
> >
> > So one entry is:
> >
> > entry_sz = 4 + 8 + 4 + 8 + 8 + 8 = 40 bytes
> >
> > Fixed overhead for one act_gate dump:
> >
> > 1. Action wrapper (RTM_GETACTION):
> >
> > NLMSG_HDRLEN + sizeof(struct tcamsg) + nla_total_size(0)
> > = 16 + 4 + 4 = 24 bytes
> >
> > 2. Action shared attributes emitted by tcf_action_dump_1, baseline only
> >    (no cookie, no HW stats, no flags):
> >
> > TCA_ACT_KIND (IFNAMSIZ) = 20
> > TCA_ACT_STATS nest = 4
> > TCA_STATS_BASIC = 20
> > TCA_STATS_PKT64 = 12
> > TCA_STATS_QUEUE = 24
> > TCA_ACT_OPTIONS nest = 4
> > TCA_GACT_TM = 36
> > TCA_ACT_IN_HW_COUNT = 8
> > action number nest = 4
> >
> > Total shared baseline = 156 bytes
> >
> > Optional shared attributes, only if present:
> >
> > TCA_ACT_HW_STATS = +12
> > TCA_ACT_USED_HW_STATS = +12
> > TCA_ACT_FLAGS = +12
> > TCA_ACT_COOKIE = +nla_total_size(cookie_len)
> >
> > 3. Gate specific attributes inside options, fixed part including TM:
> >
> > TCA_GATE_PARMS = 24
> > BASE_TIME = 12
> > CYCLE_TIME = 12
> > CYCLE_TIME_EXT = 12
> > CLOCKID = 8
> > FLAGS = 8
> > PRIORITY = 8
> > ENTRY_LIST nest = 4
> > TCA_GATE_TM = 36
> >
> > Total gate baseline = 124 bytes
> >
> > 4. 64 bit alignment padding, only when
> >    !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS
> >
> > There are 7 attributes that trigger the 64 bit padding:
> > -three stats blocks, three time values and the gate TM
> > -Each adds 4 bytes, so add 28 bytes in that case
> >
> > Putting it together:
> >
> > fixed = 24 (wrapper) + 156 (shared baseline) + 124 (gate baseline)
> > fixed = 304 bytes
> >
> > opt = nla_total_size(cookie_len)
> > + 12 for each of HW_STATS, USED_HW_STATS and FLAGS if present
> > + 28 if unaligned access padding is required
> >
> > The maximum number of entries that fit in a single skb is:
> >
> > Nmax = floor((NLMSG_GOODSIZE - fixed - opt) / 40)
> >
> > If PAGE_SIZE = 4096 and sizeof(struct skb_shared_info) = 320:
> >
> > NLMSG_GOODSIZE = 4096 - 320 = 3776
> > Nmax = floor((3776 - 304) / 40) = 86
> >
> > 8192:
> >
> > NLMSG_GOODSIZE = 8192 - 320 = 7872
> > Nmax = floor((7872 - 304) / 40) = 189
> >
> 
> Seems arbitrary and I was hoping you dont have to change iproute2
> which restricts the total size to 1KB.
> Earlier, unless i misread, you said you are looking at IEEE - what
> does the spec say?
> If i am not mistaken, the spec is   IEEE 802.1Qbv which unfortunately
> is behind a paywall.
> The closest i could find was a vendor talking about it here:
> https://onlinedocs.microchip.com/oxy/GUID-82119957-1E11-4B69-84AC-EF0EA08F5595-en-US-5/GUID-7E7509A4-351E-4D82-8266-967681BA2644.html
> 
> And they seem to indicate you can only have _one_ off and one timer
> per queue, for a max of 8 queues.
> Since Po is AWOL, +Cc the taprio folks (Vinicius, Vladmir).
> 
> cheers,
> jamal

Sorry, I haven't been following this thread, I don't know what the
question to me is?

The tc-gate action corresponds to a feature which can be identified by
the "stream gate" keyword in standard IEEE 802.1Q (-2018 or later).
It is a sub-function of clause 8.6.5.1 Per-stream filtering and policing
(PSFP).

This is different from what you reference above as taprio / IEEE 802.1Qbv
(old/obsolete name for workgroup which later became merged into standard
802.1Q as clause 8.6.8.4 Enhancements for scheduled traffic).

The tc-gate is not defined per queue, but rather a standalone object
that streams (tc filters) point to. The schedule (or "gate control list")
size, translatable into the number of TCA_GATE_ONE_ENTRY elements, is
arbitrary as far as the standard is concerned.

We at NXP have hardware today which supports up to 256 gates in a single
stream gate control list.

I'm not sure I understand the reference to the [number of] timers.

  reply	other threads:[~2026-02-05 20:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-30 13:43 Paul Moses
2026-01-30 16:05 ` Jamal Hadi Salim
2026-01-30 17:22   ` Paul Moses
2026-01-30 17:53     ` Jamal Hadi Salim
2026-01-30 20:47       ` Paul Moses
2026-01-31 16:51         ` Jamal Hadi Salim
2026-01-31 17:14           ` Jamal Hadi Salim
2026-01-31 17:18             ` Paul Moses
2026-01-31 17:34               ` Jamal Hadi Salim
2026-02-01  9:57                 ` Paul Moses
2026-02-02 14:33                   ` Jamal Hadi Salim
2026-02-02 20:49                     ` Paul Moses
2026-02-05 15:13                       ` Paul Moses
2026-02-05 19:23                         ` Jamal Hadi Salim
2026-02-05 20:36                           ` Vladimir Oltean [this message]
2026-02-05 21:30                             ` Jamal Hadi Salim
2026-02-05 22:11                               ` Vladimir Oltean
2026-02-06 13:33                                 ` Jamal Hadi Salim

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=20260205203615.t3n3bbqmjscp2cnz@skbuf \
    --to=vladimir.oltean@nxp.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=p@1g4.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=vinicius.gomes@intel.com \
    --cc=xiyou.wangcong@gmail.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®