提交 a9b5d871 编写于 作者: I Ido Schimmel 提交者: David S. Miller

netdevsim: Only use sampling truncation length when valid

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: a8700c3d ("netdevsim: Add dummy psample implementation")
Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
Acked-by: NJakub Kicinski <kuba@kernel.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 74c97ea3
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册