* [PATCH v2] RDMA/srp (gcc13): move large values to a new enum
@ 2022-12-12 12:04 Jiri Slaby (SUSE)
2022-12-12 19:28 ` Bart Van Assche
2022-12-29 7:10 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Slaby (SUSE) @ 2022-12-12 12:04 UTC (permalink / raw)
To: bvanassche
Cc: linux-kernel, Jiri Slaby (SUSE),
Martin Liska, Jason Gunthorpe, Leon Romanovsky, linux-rdma
Since gcc13, each member of an enum has the same type as the enum [1]. And
that is inherited from its members. Provided these two:
SRP_TAG_NO_REQ = ~0U,
SRP_TAG_TSK_MGMT = 1U << 31
all other members are unsigned ints.
Esp. with SRP_MAX_SGE and SRP_TSK_MGMT_SQ_SIZE and their use in min(),
this results in the following warnings:
include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast
drivers/infiniband/ulp/srp/ib_srp.c:563:42: note: in expansion of macro 'min'
include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast
drivers/infiniband/ulp/srp/ib_srp.c:2369:27: note: in expansion of macro 'min'
So move the large values away to a separate enum, so that they don't
affect other members.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113
Cc: Martin Liska <mliska@suse.cz>
Cc: Bart Van Assche <bvanassche@acm.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>
Cc: linux-rdma@vger.kernel.org
Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
---
Notes:
[v2] move to a new enum instead of min_t()s (Bart)
drivers/infiniband/ulp/srp/ib_srp.h | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/ulp/srp/ib_srp.h b/drivers/infiniband/ulp/srp/ib_srp.h
index 00b0068fda20..5d94db453df3 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.h
+++ b/drivers/infiniband/ulp/srp/ib_srp.h
@@ -62,9 +62,6 @@ enum {
SRP_DEFAULT_CMD_SQ_SIZE = SRP_DEFAULT_QUEUE_SIZE - SRP_RSP_SQ_SIZE -
SRP_TSK_MGMT_SQ_SIZE,
- SRP_TAG_NO_REQ = ~0U,
- SRP_TAG_TSK_MGMT = 1U << 31,
-
SRP_MAX_PAGES_PER_MR = 512,
SRP_MAX_ADD_CDB_LEN = 16,
@@ -79,6 +76,11 @@ enum {
sizeof(struct srp_imm_buf),
};
+enum {
+ SRP_TAG_NO_REQ = ~0U,
+ SRP_TAG_TSK_MGMT = BIT(31),
+};
+
enum srp_target_state {
SRP_TARGET_SCANNING,
SRP_TARGET_LIVE,
--
2.38.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] RDMA/srp (gcc13): move large values to a new enum
2022-12-12 12:04 [PATCH v2] RDMA/srp (gcc13): move large values to a new enum Jiri Slaby (SUSE)
@ 2022-12-12 19:28 ` Bart Van Assche
2022-12-29 7:10 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2022-12-12 19:28 UTC (permalink / raw)
To: Jiri Slaby (SUSE)
Cc: linux-kernel, Martin Liska, Jason Gunthorpe, Leon Romanovsky, linux-rdma
On 12/12/22 04:04, Jiri Slaby (SUSE) wrote:
> Since gcc13, each member of an enum has the same type as the enum [1]. And
> that is inherited from its members. Provided these two:
> SRP_TAG_NO_REQ = ~0U,
> SRP_TAG_TSK_MGMT = 1U << 31
> all other members are unsigned ints.
>
> Esp. with SRP_MAX_SGE and SRP_TSK_MGMT_SQ_SIZE and their use in min(),
> this results in the following warnings:
> include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast
> drivers/infiniband/ulp/srp/ib_srp.c:563:42: note: in expansion of macro 'min'
>
> include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast
> drivers/infiniband/ulp/srp/ib_srp.c:2369:27: note: in expansion of macro 'min'
>
> So move the large values away to a separate enum, so that they don't
> affect other members.
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] RDMA/srp (gcc13): move large values to a new enum
2022-12-12 12:04 [PATCH v2] RDMA/srp (gcc13): move large values to a new enum Jiri Slaby (SUSE)
2022-12-12 19:28 ` Bart Van Assche
@ 2022-12-29 7:10 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-12-29 7:10 UTC (permalink / raw)
To: bvanassche, Jiri Slaby (SUSE)
Cc: linux-rdma, Jason Gunthorpe, Martin Liska, linux-kernel
On Mon, 12 Dec 2022 13:04:11 +0100, Jiri Slaby (SUSE) wrote:
> Since gcc13, each member of an enum has the same type as the enum [1]. And
> that is inherited from its members. Provided these two:
> SRP_TAG_NO_REQ = ~0U,
> SRP_TAG_TSK_MGMT = 1U << 31
> all other members are unsigned ints.
>
> Esp. with SRP_MAX_SGE and SRP_TSK_MGMT_SQ_SIZE and their use in min(),
> this results in the following warnings:
> include/linux/minmax.h:20:35: error: comparison of distinct pointer types lacks a cast
> drivers/infiniband/ulp/srp/ib_srp.c:563:42: note: in expansion of macro 'min'
>
> [...]
Applied, thanks!
[1/1] RDMA/srp (gcc13): move large values to a new enum
https://git.kernel.org/rdma/rdma/c/fb5b88f5b78192
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-29 7:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 12:04 [PATCH v2] RDMA/srp (gcc13): move large values to a new enum Jiri Slaby (SUSE)
2022-12-12 19:28 ` Bart Van Assche
2022-12-29 7:10 ` Leon Romanovsky
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.