public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>, davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: Re: [RFC net-next PATCH] ipv6: New define for reoccurring code
Date: Fri, 17 Jan 2020 14:17:37 -0800	[thread overview]
Message-ID: <693b94d6-eece-9334-4157-69f562836f3a@gmail.com> (raw)
In-Reply-To: <20200117215642.2029945-1-jeffrey.t.kirsher@intel.com>



On 1/17/20 1:56 PM, Jeff Kirsher wrote:
> Through out the kernel, sizeof() is used to determine the size of the IPv6
> address structure, so create a define for the commonly used code.
> 
> s/sizeof(struct in6_addr)/ipv6_addr_size/g
> 
> This is just a portion of the instances in the kernel and before cleaning
> up all the occurrences, wanted to make sure that this was a desired change
> or if this obfuscates the code.
> 
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
...

>  };
> +#define ipv6_addr_size		sizeof(struct in6_addr)
>  #endif /* __UAPI_DEF_IN6_ADDR */
>  
>  #if __UAPI_DEF_SOCKADDR_IN6
> diff --git a/net/core/filter.c b/net/core/filter.c
> index ef01c5599501..eabf42893b60 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -5053,7 +5053,7 @@ BPF_CALL_4(bpf_lwt_seg6_action, struct sk_buff *, skb,
>  	case SEG6_LOCAL_ACTION_END_X:
>  		if (!seg6_bpf_has_valid_srh(skb))
>  			return -EBADMSG;
> -		if (param_len != sizeof(struct in6_addr))
> +		if (param_len != ipv6_addr_size)

Hmm...

I vote seeing sizeof(struct in6_addr) rather than dealing
with yet another thing to remember and additional backports conflicts.

And I prefer not seeing dozens of followup trivial patches because
people will forget about this new pseudo variable.


  reply	other threads:[~2020-01-17 22:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-17 21:56 [RFC net-next PATCH] ipv6: New define for reoccurring code Jeff Kirsher
2020-01-17 22:17 ` Eric Dumazet [this message]
2020-01-17 23:36   ` Alexei Starovoitov
2020-01-18  7:10 ` Jiri Pirko

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=693b94d6-eece-9334-4157-69f562836f3a@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=netdev@vger.kernel.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