* [PATCH net-next] netdevsim: Only use sampling truncation length when valid
@ 2021-04-22 13:50 Ido Schimmel
2021-04-22 16:14 ` Jakub Kicinski
2021-04-22 20:30 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 5+ messages in thread
From: Ido Schimmel @ 2021-04-22 13:50 UTC (permalink / raw)
To: netdev; +Cc: davem, kuba, mlxsw, Ido Schimmel
From: Ido Schimmel <idosch@nvidia.com>
When the sampling truncation length is invalid (zero), pass the length
of the packet. Without the fix, no payload is reported to user space
when the truncation length is zero.
Fixes: a8700c3dd0a4 ("netdevsim: Add dummy psample implementation")
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
---
drivers/net/netdevsim/psample.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/netdevsim/psample.c b/drivers/net/netdevsim/psample.c
index 5ec3bd7f891b..f0c6477dd0ae 100644
--- a/drivers/net/netdevsim/psample.c
+++ b/drivers/net/netdevsim/psample.c
@@ -79,9 +79,10 @@ static struct sk_buff *nsim_dev_psample_skb_build(void)
}
static void nsim_dev_psample_md_prepare(const struct nsim_dev_psample *psample,
- struct psample_metadata *md)
+ struct psample_metadata *md,
+ unsigned int len)
{
- md->trunc_size = psample->trunc_size;
+ md->trunc_size = psample->trunc_size ? psample->trunc_size : len;
md->in_ifindex = psample->in_ifindex;
md->out_ifindex = psample->out_ifindex;
@@ -120,7 +121,7 @@ static void nsim_dev_psample_report_work(struct work_struct *work)
if (!skb)
goto out;
- nsim_dev_psample_md_prepare(psample, &md);
+ nsim_dev_psample_md_prepare(psample, &md, skb->len);
psample_sample_packet(psample->group, skb, psample->rate, &md);
consume_skb(skb);
--
2.30.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdevsim: Only use sampling truncation length when valid
2021-04-22 13:50 [PATCH net-next] netdevsim: Only use sampling truncation length when valid Ido Schimmel
@ 2021-04-22 16:14 ` Jakub Kicinski
2021-04-22 16:21 ` Ido Schimmel
2021-04-22 20:30 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 5+ messages in thread
From: Jakub Kicinski @ 2021-04-22 16:14 UTC (permalink / raw)
To: Ido Schimmel; +Cc: netdev, davem, mlxsw, Ido Schimmel
On Thu, 22 Apr 2021 16:50:50 +0300 Ido Schimmel wrote:
> From: Ido Schimmel <idosch@nvidia.com>
>
> When the sampling truncation length is invalid (zero), pass the length
> of the packet. Without the fix, no payload is reported to user space
> when the truncation length is zero.
>
> Fixes: a8700c3dd0a4 ("netdevsim: Add dummy psample implementation")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Acked-by: Jakub Kicinski <kuba@kernel.org>
> + md->trunc_size = psample->trunc_size ? psample->trunc_size : len;
nit: ... = psample->trunc_size ? : len; ?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdevsim: Only use sampling truncation length when valid
2021-04-22 16:14 ` Jakub Kicinski
@ 2021-04-22 16:21 ` Ido Schimmel
2021-04-22 16:26 ` Jakub Kicinski
0 siblings, 1 reply; 5+ messages in thread
From: Ido Schimmel @ 2021-04-22 16:21 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, davem, mlxsw, Ido Schimmel
On Thu, Apr 22, 2021 at 09:14:26AM -0700, Jakub Kicinski wrote:
> On Thu, 22 Apr 2021 16:50:50 +0300 Ido Schimmel wrote:
> > From: Ido Schimmel <idosch@nvidia.com>
> >
> > When the sampling truncation length is invalid (zero), pass the length
> > of the packet. Without the fix, no payload is reported to user space
> > when the truncation length is zero.
> >
> > Fixes: a8700c3dd0a4 ("netdevsim: Add dummy psample implementation")
> > Signed-off-by: Ido Schimmel <idosch@nvidia.com>
>
> Acked-by: Jakub Kicinski <kuba@kernel.org>
Thanks!
>
> > + md->trunc_size = psample->trunc_size ? psample->trunc_size : len;
>
> nit: ... = psample->trunc_size ? : len; ?
Yea, I don't find this form too readable and always prefer the one I
used when it fits in a single line :)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdevsim: Only use sampling truncation length when valid
2021-04-22 16:21 ` Ido Schimmel
@ 2021-04-22 16:26 ` Jakub Kicinski
0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2021-04-22 16:26 UTC (permalink / raw)
To: Ido Schimmel; +Cc: netdev, davem, mlxsw, Ido Schimmel
On Thu, 22 Apr 2021 19:21:37 +0300 Ido Schimmel wrote:
> > > + md->trunc_size = psample->trunc_size ? psample->trunc_size : len;
> >
> > nit: ... = psample->trunc_size ? : len; ?
>
> Yea, I don't find this form too readable and always prefer the one I
> used when it fits in a single line :)
Fair enough.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next] netdevsim: Only use sampling truncation length when valid
2021-04-22 13:50 [PATCH net-next] netdevsim: Only use sampling truncation length when valid Ido Schimmel
2021-04-22 16:14 ` Jakub Kicinski
@ 2021-04-22 20:30 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-22 20:30 UTC (permalink / raw)
To: Ido Schimmel; +Cc: netdev, davem, kuba, mlxsw, idosch
Hello:
This patch was applied to netdev/net-next.git (refs/heads/master):
On Thu, 22 Apr 2021 16:50:50 +0300 you wrote:
> From: Ido Schimmel <idosch@nvidia.com>
>
> When the sampling truncation length is invalid (zero), pass the length
> of the packet. Without the fix, no payload is reported to user space
> when the truncation length is zero.
>
> Fixes: a8700c3dd0a4 ("netdevsim: Add dummy psample implementation")
> Signed-off-by: Ido Schimmel <idosch@nvidia.com>
>
> [...]
Here is the summary with links:
- [net-next] netdevsim: Only use sampling truncation length when valid
https://git.kernel.org/netdev/net-next/c/a9b5d871abc4
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] 5+ messages in thread
end of thread, other threads:[~2021-04-22 20:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-22 13:50 [PATCH net-next] netdevsim: Only use sampling truncation length when valid Ido Schimmel
2021-04-22 16:14 ` Jakub Kicinski
2021-04-22 16:21 ` Ido Schimmel
2021-04-22 16:26 ` Jakub Kicinski
2021-04-22 20:30 ` patchwork-bot+netdevbpf
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.