netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Menglong Dong <menglong8.dong@gmail.com>
Cc: davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
	dsahern@kernel.org, dongml2@chinatelecom.cn, idosch@nvidia.com,
	amcohen@nvidia.com, gnault@redhat.com, bpoirier@nvidia.com,
	b.galvani@gmail.com, razor@blackwall.org, petrm@nvidia.com,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 06/10] net: vxlan: add skb drop reasons to vxlan_rcv()
Date: Mon, 19 Aug 2024 15:59:45 -0700	[thread overview]
Message-ID: <20240819155945.19871372@kernel.org> (raw)
In-Reply-To: <CADxym3ZEvUYwfvh2O5M+aYmLSMe_eZ8n=X_qBj8DiN8hh2OkaQ@mail.gmail.com>

On Sat, 17 Aug 2024 19:33:23 +0800 Menglong Dong wrote:
> On Sat, Aug 17, 2024 at 10:22 AM Jakub Kicinski <kuba@kernel.org> wrote:
> >
> > On Thu, 15 Aug 2024 20:42:58 +0800 Menglong Dong wrote:  
> > >  #define VXLAN_DROP_REASONS(R)                        \
> > > +     R(VXLAN_DROP_FLAGS)                     \
> > > +     R(VXLAN_DROP_VNI)                       \
> > > +     R(VXLAN_DROP_MAC)                       \  
> >
> > Drop reasons should be documented.  
> 
> Yeah, I wrote the code here just like what we did in
> net/openvswitch/drop.h, which makes the definition of
> enum ovs_drop_reason a call of VXLAN_DROP_REASONS().
> 
> I think that we can define the enum ovs_drop_reason just like
> what we do in include/net/dropreason-core.h, which can make
> it easier to document the reasons.
> 
> > I don't think name of a header field is a great fit for a reason.
> >  
> 
> Enn...Do you mean the "VXLAN_DROP_" prefix?

No, I mean the thing after VXLAN_DROP_, it's FLAGS, VNI, MAC,
those are names of header fields.

> > > @@ -1815,8 +1831,9 @@ static int vxlan_rcv(struct sock *sk, struct sk_buff *skb)
> > >       return 0;
> > >
> > >  drop:
> > > +     SKB_DR_RESET(reason);  
> >
> > the name of this macro is very confusing, I don't think it should exist
> > in the first place. nothing should goto drop without initialing reason
> >  
> 
> It's for the case that we call a function which returns drop reasons.
> For example, the reason now is assigned from:
> 
>   reason = pskb_may_pull_reason(skb, VXLAN_HLEN);
>   if (reason) goto drop;
> 
>   xxxxxx
>   if (xx) goto drop;
> 
> The reason now is SKB_NOT_DROPPED_YET when we "goto drop",
> as we don't set a drop reason here, which is unnecessary in some cases.
> And, we can't set the drop reason for every "drop" code path, can we?

Why? It's like saying "we can't set return code before jumping to
an error label". In my mind drop reasons and function return codes
are very similar. So IDK why we need all the SK_DR_ macros when
we are just fine without them for function return codes.

  reply	other threads:[~2024-08-19 22:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-15 12:42 [PATCH net-next 00/10] net: vxlan: add skb drop reasons support Menglong Dong
2024-08-15 12:42 ` [PATCH net-next 01/10] net: vxlan: add vxlan to the drop reason subsystem Menglong Dong
2024-08-15 12:42 ` [PATCH net-next 02/10] net: skb: add SKB_DR_RESET Menglong Dong
2024-08-20 12:24   ` Ido Schimmel
2024-08-21 12:55     ` Menglong Dong
2024-08-15 12:42 ` [PATCH net-next 03/10] net: skb: introduce pskb_network_may_pull_reason() Menglong Dong
2024-08-15 12:42 ` [PATCH net-next 04/10] net: ip: introduce pskb_inet_may_pull_reason() Menglong Dong
2024-08-15 12:42 ` [PATCH net-next 05/10] net: vxlan: make vxlan_remcsum() return skb drop reasons Menglong Dong
2024-08-15 12:42 ` [PATCH net-next 06/10] net: vxlan: add skb drop reasons to vxlan_rcv() Menglong Dong
2024-08-17  2:22   ` Jakub Kicinski
2024-08-17 11:33     ` Menglong Dong
2024-08-19 22:59       ` Jakub Kicinski [this message]
2024-08-21 12:51         ` Menglong Dong
2024-08-20 12:26   ` Ido Schimmel
2024-08-21 12:54     ` Menglong Dong
2024-08-15 12:42 ` [PATCH net-next 07/10] net: vxlan: use vxlan_kfree_skb() in vxlan_xmit() Menglong Dong
2024-08-20 12:28   ` Ido Schimmel
2024-08-21 12:57     ` Menglong Dong
2024-08-15 12:43 ` [PATCH net-next 08/10] net: vxlan: add drop reasons support to vxlan_xmit_one() Menglong Dong
2024-08-20 12:33   ` Ido Schimmel
2024-08-21 13:02     ` Menglong Dong
2024-08-15 12:43 ` [PATCH net-next 09/10] net: vxlan: use kfree_skb_reason in vxlan_encap_bypass Menglong Dong
2024-08-15 12:43 ` [PATCH net-next 10/10] net: vxlan: use vxlan_kfree_skb in encap_bypass_if_local Menglong Dong

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=20240819155945.19871372@kernel.org \
    --to=kuba@kernel.org \
    --cc=amcohen@nvidia.com \
    --cc=b.galvani@gmail.com \
    --cc=bpoirier@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=dongml2@chinatelecom.cn \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=gnault@redhat.com \
    --cc=idosch@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=menglong8.dong@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=petrm@nvidia.com \
    --cc=razor@blackwall.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;
as well as URLs for NNTP newsgroup(s).