From: Ido Schimmel <idosch@idosch.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, kuba@kernel.org, mlxsw@nvidia.com,
Ido Schimmel <idosch@nvidia.com>
Subject: [PATCH net-next] netdevsim: Only use sampling truncation length when valid
Date: Thu, 22 Apr 2021 16:50:50 +0300 [thread overview]
Message-ID: <20210422135050.2429936-1-idosch@idosch.org> (raw)
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
next reply other threads:[~2021-04-22 13:51 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-22 13:50 Ido Schimmel [this message]
2021-04-22 16:14 ` [PATCH net-next] netdevsim: Only use sampling truncation length when valid Jakub Kicinski
2021-04-22 16:21 ` Ido Schimmel
2021-04-22 16:26 ` Jakub Kicinski
2021-04-22 20:30 ` patchwork-bot+netdevbpf
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=20210422135050.2429936-1-idosch@idosch.org \
--to=idosch@idosch.org \
--cc=davem@davemloft.net \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=mlxsw@nvidia.com \
--cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox