Re: [PATCH net-next v2 06/12] net: vxlan: make vxlan_set_mac() return drop reasons

From: Simon Horman
Date: Fri Aug 30 2024 - 11:34:13 EST


On Fri, Aug 30, 2024 at 09:59:55AM +0800, Menglong Dong wrote:
> Change the return type of vxlan_set_mac() from bool to enum
> skb_drop_reason. In this commit, two drop reasons are introduced:
>
> VXLAN_DROP_INVALID_SMAC
> VXLAN_DROP_ENTRY_EXISTS
>
> To make it easier to document the reasons in drivers/net/vxlan/drop.h,
> we don't define the enum vxlan_drop_reason with the macro
> VXLAN_DROP_REASONS(), but hand by hand.
>
> Signed-off-by: Menglong Dong <dongml2@xxxxxxxxxxxxxxx>
> ---
> drivers/net/vxlan/drop.h | 9 +++++++++
> drivers/net/vxlan/vxlan_core.c | 12 ++++++------
> 2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/vxlan/drop.h b/drivers/net/vxlan/drop.h
> index 6bcc6894fbbd..876b4a9de92f 100644
> --- a/drivers/net/vxlan/drop.h
> +++ b/drivers/net/vxlan/drop.h
> @@ -9,11 +9,20 @@
> #include <net/dropreason.h>
>
> #define VXLAN_DROP_REASONS(R) \
> + R(VXLAN_DROP_INVALID_SMAC) \
> + R(VXLAN_DROP_ENTRY_EXISTS) \
> /* deliberate comment for trailing \ */
>
> enum vxlan_drop_reason {
> __VXLAN_DROP_REASON = SKB_DROP_REASON_SUBSYS_VXLAN <<
> SKB_DROP_REASON_SUBSYS_SHIFT,
> + /** @VXLAN_DROP_INVALID_SMAC: source mac is invalid */
> + VXLAN_DROP_INVALID_SMAC,
> + /**
> + * @VXLAN_DROP_ENTRY_EXISTS: trying to migrate a static entry or
> + * one pointing to a nexthop

Maybe it is clearer to write: one -> an entry

> + */
> + VXLAN_DROP_ENTRY_EXISTS,
> };
>
> static inline void

...