lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180627132026.79190a42@redhat.com>
Date:   Wed, 27 Jun 2018 13:20:26 +0200
From:   Jesper Dangaard Brouer <brouer@...hat.com>
To:     Song Liu <liu.song.a23@...il.com>
Cc:     Networking <netdev@...r.kernel.org>,
        Daniel Borkmann <borkmann@...earbox.net>,
        Toke Høiland-Jørgensen <toke@...e.dk>,
        Alexei Starovoitov <alexei.starovoitov@...il.com>,
        brouer@...hat.com
Subject: Re: [bpf-next PATCH 2/2] samples/bpf: xdp_rxq_info action XDP_TX
 must adjust MAC-addrs

On Tue, 26 Jun 2018 17:09:01 -0700
Song Liu <liu.song.a23@...il.com> wrote:

> On Mon, Jun 25, 2018 at 7:27 AM, Jesper Dangaard Brouer
> <brouer@...hat.com> wrote:
> > XDP_TX requires also changing the MAC-addrs, else some hardware
> > may drop the TX packet before reaching the wire.  This was
> > observed with driver mlx5.
> >
> > If xdp_rxq_info select --action XDP_TX the swapmac functionality
> > is activated.  It is also possible to manually enable via cmdline
> > option --swapmac.  This is practical if wanting to measure the
> > overhead of writing/updating payload for other action types.
> >
> > Signed-off-by: Jesper Dangaard Brouer <brouer@...hat.com>
> > Signed-off-by: Toke Høiland-Jørgensen <toke@...e.dk>
> > ---
[...]
> >
> > diff --git a/samples/bpf/xdp_rxq_info_kern.c b/samples/bpf/xdp_rxq_info_kern.c
> > index 61af6210df2f..222a83eed1cb 100644
> > --- a/samples/bpf/xdp_rxq_info_kern.c
> > +++ b/samples/bpf/xdp_rxq_info_kern.c
> > @@ -21,6 +21,7 @@ struct config {
> >  enum cfg_options_flags {
> >         NO_TOUCH = 0x0U,
> >         READ_MEM = 0x1U,
> > +       SWAP_MAC = 0x2U,
> >  };
[...]
> > @@ -98,7 +116,7 @@ int  xdp_prognum0(struct xdp_md *ctx)
> >                 rxq_rec->issue++;
> >
> >         /* Default: Don't touch packet data, only count packets */
> > -       if (unlikely(config->options & READ_MEM)) {
> > +       if (unlikely(config->options & (READ_MEM|SWAP_MAC))) {
> >                 struct ethhdr *eth = data;
> >
> >                 if (eth + 1 > data_end)
[...]

> > diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
> > index 435485d4f49e..248a7eab9531 100644
[...]
> > @@ -119,6 +121,8 @@ static char* options2str(enum cfg_options_flags flag)
> >  {
> >         if (flag == NO_TOUCH)
> >                 return "no_touch";
> > +       if (flag & SWAP_MAC)
> > +               return "swapmac";
> >         if (flag & READ_MEM)
> >                 return "read";  
> 
> I guess SWAP_MAC also reads the memory, so it "includes" READ_MEM?

True (see _kern side)

> It is OK for now. We may need to refactor this part when adding other
> flags in the future.

Sure, do remember that this is only a 'sample' program.

-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ