On Tue, 2017-04-18 at 22:32 -0400, Jamal Hadi Salim wrote: > On 17-04-18 09:49 PM, Eric Dumazet wrote: > > On Tue, 2017-04-18 at 21:14 -0400, Jamal Hadi Salim wrote: > >> From: Jamal Hadi Salim <j...@mojatatu.com> > > > > So there is no more limit ? How user is supposed to size the buffer for > > recvmsg() ? > > > > That part doesnt change. Ok, I believe more clarity is needed:-> > > Current code allows only 32 actions to be dumped at a time. > This code: > > So lets i have 128 actions. I can fit them into 10K. > I do recvmsg(..., 32K). This will make about 32K space for me to fill > up the 128 actions. But the code only allows me to send 32 > TCA_ACT_MAX_PRIO which takes about 2-3K. > So I will do 4 runs from kernel->user to get 128 actions ;-> > User space in tc is trained to expect no more than > TCA_ACT_MAX_PRIO in every batch. > > With this change I ask the kernel to fit as many actions as > possible in the 32K (all these 128 will fit in one batch). > Then it has to tell user space how many are in that batch > using TCAA_ACT_COUNT attribute. > > Make sense?
What if we have 1024 actions, and user provides a 4KB buffer ? Normally multiple recvmsg() calls would be needed, but I do not see how the nla_put_u32(skb, TCAA_ACT_COUNT, cb->args[1]) can always succeed.