From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= Subject: Re: [PATCH bpf-next v2 2/2] samples/bpf: Add xdp_sample_pkts example Date: Wed, 06 Jun 2018 14:28:43 +0200 Message-ID: <87po14yu84.fsf@toke.dk> References: <152813003609.3465.618891361534945522.stgit@alrua-kau> <152813003614.3465.11049830599815911223.stgit@alrua-kau> <1448c449-b853-b2df-2654-44c9c52adfe4@netronome.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable To: David Beckett , netdev@vger.kernel.org Return-path: Received: from mail.toke.dk ([52.28.52.200]:43043 "EHLO mail.toke.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750795AbeFFM2q (ORCPT ); Wed, 6 Jun 2018 08:28:46 -0400 In-Reply-To: <1448c449-b853-b2df-2654-44c9c52adfe4@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: David Beckett writes: > On 04/06/18 17:33, Toke H=C3=B8iland-J=C3=B8rgensen wrote: >> + >> +#define SAMPLE_SIZE 64ul >> + > The program currently cannot sample minimum sized packets, as the 4 Byte= =20 > crc checksum isnt present in ctx, > may be better to use 60ul sample size to allow for these packets to be=20 > processed? Right. However, this also reminds me that I wanted to make the sampling size dynamic, so it is possible to dump packets that are smaller than the configured SAMPLE_SIZE. Will fix :) >> + if (data + SAMPLE_SIZE < data_end) { >> + /* The XDP perf_event_output handler will use the upper 32 bits >> + * of the flags argument as a number of bytes to include of the > I may be wrong on this but should this also be <=3D to allow for packets= =20 > at SAMPLE_SIZE to be sampled? Yes, you are right, but that goes away with the change I mentioned above. -Toke