[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200106223206.uxq6isyk7pjruxx3@ast-mbp>
Date: Mon, 6 Jan 2020 14:32:07 -0800
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Song Liu <liu.song.a23@...il.com>
Cc: Simon Horman <simon.horman@...ronome.com>,
Li RongQing <lirongqing@...du.com>,
Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH][bpf-next] bpf: change bpf_skb_generic_push type as void
On Fri, Jan 03, 2020 at 11:18:28AM -0800, Song Liu wrote:
> On Fri, Jan 3, 2020 at 12:27 AM Simon Horman <simon.horman@...ronome.com> wrote:
> >
> > On Fri, Jan 03, 2020 at 02:02:33PM +0800, Li RongQing wrote:
> > > bpf_skb_generic_push always returns 0, not need to check
> > > its return, so change its type as void
> > >
> > > Signed-off-by: Li RongQing <lirongqing@...du.com>
> >
> > Reviewed-by: Simon Horman <simon.horman@...ronome.com>
> Acked-by: Song Liu <songliubraving@...com>
>
> >
> > > ---
> > > net/core/filter.c | 30 ++++++++++--------------------
> > > 1 file changed, 10 insertions(+), 20 deletions(-)
> > >
> > > diff --git a/net/core/filter.c b/net/core/filter.c
> > > index 42fd17c48c5f..1cbac34a4e11 100644
> > > --- a/net/core/filter.c
> > > +++ b/net/core/filter.c
> >
> > ...
> >
> > > @@ -5144,7 +5134,7 @@ BPF_CALL_3(bpf_lwt_seg6_adjust_srh, struct sk_buff *, skb, u32, offset,
> > > if (unlikely(ret < 0))
> > > return ret;
> > >
> > > - ret = bpf_skb_net_hdr_push(skb, offset, len);
> > > + bpf_skb_net_hdr_push(skb, offset, len);
> >
> > There is a check for (ret < 0) just below this if block.
> > That is ok becuase in order to get to here (ret < 0) must
> > be true as per the check a few lines above.
> >
> > So I think this is ok although the asymmetry with the else arm
> > of this if statement is not ideal IMHO.
>
> Agreed with this concern. But I cannot think of any free solution. I guess we
> will just live with assumption that skb_cow_head() never return >0.
I don't think this patch is worth doing.
I can imagine bpf_skb_generic_push() handling some errors in the future.
compiler can do this optimization job instead.
Powered by blists - more mailing lists