netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jesse Brandeburg <jesse.brandeburg@intel.com>
Cc: davem@davemloft.net, pabeni@redhat.com, netdev@vger.kernel.org,
	mkubecek@suse.cz
Subject: Re: [PATCH net-next v1 1/2] ethtool/uapi: use BIT for bit-shifts
Date: Wed, 7 Dec 2022 18:41:05 -0800	[thread overview]
Message-ID: <20221207184105.74dfdd1c@kernel.org> (raw)
In-Reply-To: <20221207231728.2331166-2-jesse.brandeburg@intel.com>

On Wed,  7 Dec 2022 15:17:27 -0800 Jesse Brandeburg wrote:
>  #define ETH_RSS_HASH_TOP	__ETH_RSS_HASH(TOP)
> diff --git a/include/uapi/linux/ethtool.h b/include/uapi/linux/ethtool.h
> index 58e587ba0450..6ce5da444098 100644
> --- a/include/uapi/linux/ethtool.h
> +++ b/include/uapi/linux/ethtool.h
> @@ -9,6 +9,7 @@
>   *                                christopher.leech@intel.com,
>   *                                scott.feldman@intel.com)
>   * Portions Copyright (C) Sun Microsystems 2008
> + * Portions Copyright (C) 2022 Intel Corporation

Is that appropriate?

> +/* BIT() and BIT_ULL() are defined in include/linux/bits.h but we need a
> + * local version to clean up this file and not break simultaneous
> + * kernel/userspace where userspace doesn't have the BIT and BIT_ULL
> + * defined. To avoid compiler issues we use the exact same definitions here
> + * of the macros as defined in the file noted below, so that we don't get
> + * 'duplicate define' or 'redefinition' errors.
> + */
> +/* include/uapi/linux/const.h */
> +#define __AC(X,Y)	(X##Y)
> +#define _AC(X,Y)	__AC(X,Y)
> +#define _AT(T,X)	((T)(X))
> +#define _UL(x)		(_AC(x, UL))
> +#define _ULL(x)		(_AC(x, ULL))
> +/* include/vdso/linux/const.h */
> +#define UL(x)		(_UL(x))
> +#define ULL(x)		(_ULL(x))
> +/* include/vdso/bits.h */
> +#define BIT(nr)		(UL(1) << (nr))
> +/* include/linux/bits.h */
> +#define BIT_ULL(nr)	(ULL(1) << (nr))

include/uapi/linux/const.h

  reply	other threads:[~2022-12-08  2:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 23:17 [PATCH net-next v1 0/2] ethtool: use bits.h defines Jesse Brandeburg
2022-12-07 23:17 ` [PATCH net-next v1 1/2] ethtool/uapi: use BIT for bit-shifts Jesse Brandeburg
2022-12-08  2:41   ` Jakub Kicinski [this message]
2022-12-09 22:17     ` Jesse Brandeburg
2022-12-07 23:17 ` [PATCH net-next v1 2/2] ethtool: refactor bit-shifts Jesse Brandeburg
2022-12-08  2:40 ` [PATCH net-next v1 0/2] ethtool: use bits.h defines Jakub Kicinski
2022-12-09 22:18   ` Jesse Brandeburg

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=20221207184105.74dfdd1c@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=jesse.brandeburg@intel.com \
    --cc=mkubecek@suse.cz \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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).