Skip to contentSkip to conversation

RDMA/efa: Support CQ receive entries with source GID

PATCH Superseded Michael Margolin 4 participants 9 messages Aug 9, 2022 – Aug 18, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Michael Margolin

author maintainer
#0 lore raw

PATCH 1/1 RDMA/efa: Support CQ receive entries with source GID

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +5 -1
index 0b0b93b529f3..d4b9226088bd 100644
@@ -444,7 +444,10 @@ struct efa_admin_create_cq_cmd {
 	/*
 	 * 4:0 : cq_entry_size_words - size of CQ entry in
 	 *    32-bit words, valid values: 4, 8.
-	 * 7:5 : reserved7 - MBZ
+	 * 5 : set_src_addr - If set, source address will be
+	 *    filled on RX completions from unknown senders.
+	 *    Requires 8 words CQ entry size.
+	 * 7:6 : reserved7 - MBZ
 	 */
 	u8 cq_caps_2;
 
@@ -980,6 +983,7 @@ struct efa_admin_host_info {
 #define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
 #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
 #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
+#define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK           BIT(5)
 
 /* create_cq_resp */
 #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK              BIT(0)
drivers/infiniband/hw/efa/efa_com_cmd.c +4 -1
index fb405da4e1db..8f8885e002ba 100644
@@ -168,7 +168,10 @@ int efa_com_create_cq(struct efa_com_dev *edev,
 			EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED, 1);
 		create_cmd.eqn = params->eqn;
 	}
-
+	if (params->set_src_addr) {
+		EFA_SET(&create_cmd.cq_caps_2,
+			EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR, 1);
+	}
 	efa_com_set_dma_addr(params->dma_addr,
 			     &create_cmd.cq_ba.mem_addr_high,
 			     &create_cmd.cq_ba.mem_addr_low);
drivers/infiniband/hw/efa/efa_com_cmd.h +1 -0
index c33010bbf9e8..c6234336543d 100644
@@ -76,6 +76,7 @@ struct efa_com_create_cq_params {
 	u16 eqn;
 	u8 entry_size_in_bytes;
 	bool interrupt_mode_enabled;
+	bool set_src_addr;
 };
 
 struct efa_com_create_cq_result {
drivers/infiniband/hw/efa/efa_verbs.c +3 -1
index ecfe70eb5efb..c06669ca9e1f 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB
 /*
- * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
+ * Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All rights reserved.
  */
 
 #include <linux/dma-buf.h>
@@ -242,6 +242,7 @@ int efa_query_device(struct ib_device *ibdev,
 		resp.max_rq_wr = dev_attr->max_rq_depth;
 		resp.max_rdma_size = dev_attr->max_rdma_size;
 
+		resp.device_caps |= EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID;
 		if (EFA_DEV_CAP(dev, RDMA_READ))
 			resp.device_caps |= EFA_QUERY_DEVICE_CAPS_RDMA_READ;
 
@@ -1138,6 +1139,7 @@ int efa_create_cq(struct ib_cq *ibcq, const struct ib_cq_init_attr *attr,
 	params.dma_addr = cq->dma_addr;
 	params.entry_size_in_bytes = cmd.cq_entry_size;
 	params.num_sub_cqs = cmd.num_sub_cqs;
+	params.set_src_addr = !!(cmd.flags & EFA_CREATE_CQ_WITH_SGID);
 	if (cmd.flags & EFA_CREATE_CQ_WITH_COMPLETION_CHANNEL) {
 		cq->eq = efa_vec2eq(dev, attr->comp_vector);
 		params.eqn = cq->eq->eeq.eqn;
include/uapi/rdma/efa-abi.h +3 -1
index 08035ccf1fff..163ac79556d6 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause) */
 /*
- * Copyright 2018-2021 Amazon.com, Inc. or its affiliates. All rights reserved.
+ * Copyright 2018-2022 Amazon.com, Inc. or its affiliates. All rights reserved.
  */
 
 #ifndef EFA_ABI_USER_H
@@ -54,6 +54,7 @@ struct efa_ibv_alloc_pd_resp {
 
 enum {
 	EFA_CREATE_CQ_WITH_COMPLETION_CHANNEL = 1 << 0,
+	EFA_CREATE_CQ_WITH_SGID               = 1 << 1,
 };
 
 struct efa_ibv_create_cq {
@@ -118,6 +119,7 @@ enum {
 	EFA_QUERY_DEVICE_CAPS_RDMA_READ = 1 << 0,
 	EFA_QUERY_DEVICE_CAPS_RNR_RETRY = 1 << 1,
 	EFA_QUERY_DEVICE_CAPS_CQ_NOTIFICATIONS = 1 << 2,
+	EFA_QUERY_DEVICE_CAPS_CQ_WITH_SGID     = 1 << 3,
 };
 
 struct efa_ibv_ex_query_device_resp {
Signature · 1 line
2.34.1
reviewer
#1 lore raw
Quoted 45 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +5 -1
index 0b0b93b529f3..d4b9226088bd 100644
@@ -444,7 +444,10 @@ struct efa_admin_create_cq_cmd {
 	/*
 	 * 4:0 : cq_entry_size_words - size of CQ entry in
 	 *    32-bit words, valid values: 4, 8.
-	 * 7:5 : reserved7 - MBZ
+	 * 5 : set_src_addr - If set, source address will be
+	 *    filled on RX completions from unknown senders.
+	 *    Requires 8 words CQ entry size.
+	 * 7:6 : reserved7 - MBZ
 	 */
 	u8 cq_caps_2;
 
@@ -980,6 +983,7 @@ struct efa_admin_host_info {
 #define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
 #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
 #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
+#define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK           BIT(5)
 
 /* create_cq_resp */
 #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK              BIT(0)
drivers/infiniband/hw/efa/efa_com_cmd.c +0 -0
index fb405da4e1db..8f8885e002ba 100644

drivers/infiniband/hw/efa/efa_com_cmd.c int efa_com_create_cq(struct efa_com_dev *edev, · line 174

Quoted 8 lines
drivers/infiniband/hw/efa/efa_com_cmd.c +4 -1
@@ -168,7 +168,10 @@ int efa_com_create_cq(struct efa_com_dev *edev,
 			EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED, 1);
 		create_cmd.eqn = params->eqn;
 	}
-
+	if (params->set_src_addr) {
+		EFA_SET(&create_cmd.cq_caps_2,
+			EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR, 1);
+	}

Don't you need to validate the CQE size requested by the user somewhere? I assume you must use 32 bytes completions for this.

author maintainer
#2 lore raw
Quoted 48 lines · Gal Pressman
Quoted 47 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +5 -1
index 0b0b93b529f3..d4b9226088bd 100644
@@ -444,7 +444,10 @@ struct efa_admin_create_cq_cmd {
      /*
       * 4:0 : cq_entry_size_words - size of CQ entry in
       *    32-bit words, valid values: 4, 8.
-      * 7:5 : reserved7 - MBZ
+      * 5 : set_src_addr - If set, source address will be
+      *    filled on RX completions from unknown senders.
+      *    Requires 8 words CQ entry size.
+      * 7:6 : reserved7 - MBZ
       */
      u8 cq_caps_2;
 
@@ -980,6 +983,7 @@ struct efa_admin_host_info {
 #define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
 #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
 #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
+#define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK           BIT(5)
 
 /* create_cq_resp */
 #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK              BIT(0)
drivers/infiniband/hw/efa/efa_com_cmd.c +0 -0
index fb405da4e1db..8f8885e002ba 100644
@@ -168,7 +168,10 @@ int efa_com_create_cq(struct efa_com_dev *edev,
                      EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED, 1);
              create_cmd.eqn = params->eqn;
Quoted 8 lines

drivers/infiniband/hw/efa/efa_com_cmd.c int efa_com_create_cq(struct efa_com_dev *edev, · line 174

Quoted 6 lines
drivers/infiniband/hw/efa/efa_com_cmd.c +4 -1
      }
-
+     if (params->set_src_addr) {
+             EFA_SET(&create_cmd.cq_caps_2,
+                     EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR, 1);
+     }

Don't you need to validate the CQE size requested by the user somewhere? I assume you must use 32 bytes completions for this.

This is a good point. Requested CQE size is validated against command feature bits in the device FW. In a case of user requesting for a wrong or unsupported configuration efa_com_cmd_exec() will return an appropriate error code. This is to avoid driver dependency on CQE structure or size.

Michael

reviewer
#3 lore raw
Quoted 57 lines · Michael
Quoted 48 lines · Gal Pressman
Quoted 47 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +5 -1
index 0b0b93b529f3..d4b9226088bd 100644
@@ -444,7 +444,10 @@ struct efa_admin_create_cq_cmd {
      /*
       * 4:0 : cq_entry_size_words - size of CQ entry in
       *    32-bit words, valid values: 4, 8.
-      * 7:5 : reserved7 - MBZ
+      * 5 : set_src_addr - If set, source address will be
+      *    filled on RX completions from unknown senders.
+      *    Requires 8 words CQ entry size.
+      * 7:6 : reserved7 - MBZ
       */
      u8 cq_caps_2;
 
@@ -980,6 +983,7 @@ struct efa_admin_host_info {
 #define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
 #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
 #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
+#define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK           BIT(5)
 
 /* create_cq_resp */
 #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK              BIT(0)
drivers/infiniband/hw/efa/efa_com_cmd.c +0 -0
index fb405da4e1db..8f8885e002ba 100644
@@ -168,7 +168,10 @@ int efa_com_create_cq(struct efa_com_dev *edev,
                      EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED, 1);
              create_cmd.eqn = params->eqn;
Quoted 8 lines

drivers/infiniband/hw/efa/efa_com_cmd.c int efa_com_create_cq(struct efa_com_dev *edev, · line 174

Quoted 6 lines
drivers/infiniband/hw/efa/efa_com_cmd.c +4 -1
      }
-
+     if (params->set_src_addr) {
+             EFA_SET(&create_cmd.cq_caps_2,
+                     EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR, 1);
+     }

Don't you need to validate the CQE size requested by the user somewhere? I assume you must use 32 bytes completions for this.

Quoted 9 lines

This is a good point. Requested CQE size is validated against command feature bits in the device FW. In a case of user requesting for a wrong or unsupported configuration efa_com_cmd_exec() will return an appropriate error code. This is to avoid driver dependency on CQE structure or size.

Michael

The driver usually terminates bad inputs before they get to the device to prevent unnecessary noise.
As of today, command failures are unexpected so we have a ibdev_err to indicate that something went very wrong, I don't think you want to allow a non-root user to flood your device (and dmesg) with errors.

author maintainer
#4 lore raw
Quoted 69 lines · Gal Pressman

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 64 lines · Michael
Quoted 48 lines · Gal Pressman
Quoted 47 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)
drivers/infiniband/hw/efa/efa_admin_cmds_defs.h +5 -1
index 0b0b93b529f3..d4b9226088bd 100644
@@ -444,7 +444,10 @@ struct efa_admin_create_cq_cmd {
      /*
       * 4:0 : cq_entry_size_words - size of CQ entry in
       *    32-bit words, valid values: 4, 8.
-      * 7:5 : reserved7 - MBZ
+      * 5 : set_src_addr - If set, source address will be
+      *    filled on RX completions from unknown senders.
+      *    Requires 8 words CQ entry size.
+      * 7:6 : reserved7 - MBZ
       */
      u8 cq_caps_2;
 
@@ -980,6 +983,7 @@ struct efa_admin_host_info {
 #define EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED_MASK BIT(5)
 #define EFA_ADMIN_CREATE_CQ_CMD_VIRT_MASK                   BIT(6)
 #define EFA_ADMIN_CREATE_CQ_CMD_CQ_ENTRY_SIZE_WORDS_MASK    GENMASK(4, 0)
+#define EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR_MASK           BIT(5)
 
 /* create_cq_resp */
 #define EFA_ADMIN_CREATE_CQ_RESP_DB_VALID_MASK              BIT(0)
drivers/infiniband/hw/efa/efa_com_cmd.c +0 -0
index fb405da4e1db..8f8885e002ba 100644
@@ -168,7 +168,10 @@ int efa_com_create_cq(struct efa_com_dev *edev,
                      EFA_ADMIN_CREATE_CQ_CMD_INTERRUPT_MODE_ENABLED, 1);
              create_cmd.eqn = params->eqn;
Quoted 8 lines

drivers/infiniband/hw/efa/efa_com_cmd.c int efa_com_create_cq(struct efa_com_dev *edev, · line 174

Quoted 6 lines
drivers/infiniband/hw/efa/efa_com_cmd.c +4 -1
      }
-
+     if (params->set_src_addr) {
+             EFA_SET(&create_cmd.cq_caps_2,
+                     EFA_ADMIN_CREATE_CQ_CMD_SET_SRC_ADDR, 1);
+     }

Don't you need to validate the CQE size requested by the user somewhere? I assume you must use 32 bytes completions for this.

This is a good point. Requested CQE size is validated against command feature bits in the device FW. In a case of user requesting for a wrong or unsupported configuration efa_com_cmd_exec() will return an appropriate error code. This is to avoid driver dependency on CQE structure or size.

Quoted 7 lines
Quoted 2 lines

Michael

The driver usually terminates bad inputs before they get to the device to prevent unnecessary noise.
As of today, command failures are unexpected so we have a ibdev_err to indicate that something went very wrong, I don't think you want to allow a non-root user to flood your device (and dmesg) with errors.

I agree that in this case it's better to just return an error code rather than printing to dmesg.

To avoid greater changes in error handling for control over error printing, I'll go with your suggestion and check for command correctness in driver code. Anyway it's better to early check all inputs.

Thanks.

#5 lore raw
In reply to Michael Margolin
Quoted 15 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)

<...>

drivers/infiniband/hw/efa/efa_com_cmd.h struct efa_com_create_cq_params { · line 79

Quoted 9 lines
drivers/infiniband/hw/efa/efa_com_cmd.h +1 -0
index c33010bbf9e8..c6234336543d 100644
@@ -76,6 +76,7 @@ struct efa_com_create_cq_params {
 	u16 eqn;
 	u8 entry_size_in_bytes;
 	bool interrupt_mode_enabled;
+	bool set_src_addr;

Please use "u8 xxx : 1" instead of bool in structs.

Thanks

author maintainer
#6 lore raw
Quoted 33 lines · Leon Romanovsky

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 15 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)

<...>

drivers/infiniband/hw/efa/efa_com_cmd.h struct efa_com_create_cq_params { · line 79

Quoted 9 lines
drivers/infiniband/hw/efa/efa_com_cmd.h +1 -0
index c33010bbf9e8..c6234336543d 100644
@@ -76,6 +76,7 @@ struct efa_com_create_cq_params {
      u16 eqn;
      u8 entry_size_in_bytes;
      bool interrupt_mode_enabled;
+     bool set_src_addr;

Please use "u8 xxx : 1" instead of bool in structs.

Quoted 1 line

Thanks

Thanks Leon for your reply.

Is this a convention in the subsystem? This is an internal struct used only to bind several variables for a function call and I think using bool makes it more readable.

Of course if it's essential I will change this.

Michael

maintainer
#7 lore raw
Quoted 37 lines · Michael
Quoted 33 lines · Leon Romanovsky

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 15 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)

<...>

drivers/infiniband/hw/efa/efa_com_cmd.h struct efa_com_create_cq_params { · line 79

Quoted 9 lines
drivers/infiniband/hw/efa/efa_com_cmd.h +1 -0
index c33010bbf9e8..c6234336543d 100644
@@ -76,6 +76,7 @@ struct efa_com_create_cq_params {
      u16 eqn;
      u8 entry_size_in_bytes;
      bool interrupt_mode_enabled;
+     bool set_src_addr;

Please use "u8 xxx : 1" instead of bool in structs.

Quoted 1 line

Thanks

Quoted 7 lines

Thanks Leon for your reply.

Is this a convention in the subsystem? This is an internal struct used only to bind several variables for a function call and I think using bool makes it more readable.

Of course if it's essential I will change this.

You should use bool xx:1 in cases like this and join all the bools in your struct into a bitfield - unless you can justify them being split eg due to needing a READ_ONCE/etc or something

This is expected across the kernel.

Jason

author maintainer
#8 lore raw
Quoted 46 lines · Jason Gunthorpe

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 41 lines · Michael
Quoted 33 lines · Leon Romanovsky

CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you can confirm the sender and know the content is safe.

Quoted 15 lines · Michael Margolin

Add a parameter for create CQ admin command to set source address on receive completion descriptors. Report capability for this feature through query device verb.

---
 drivers/infiniband/hw/efa/efa_admin_cmds_defs.h | 6 +++++-
 drivers/infiniband/hw/efa/efa_com_cmd.c         | 5 ++++-
 drivers/infiniband/hw/efa/efa_com_cmd.h         | 1 +
 drivers/infiniband/hw/efa/efa_verbs.c           | 4 +++-
 include/uapi/rdma/efa-abi.h                     | 4 +++-
 5 files changed, 16 insertions(+), 4 deletions(-)

<...>

drivers/infiniband/hw/efa/efa_com_cmd.h struct efa_com_create_cq_params { · line 79

Quoted 9 lines
drivers/infiniband/hw/efa/efa_com_cmd.h +1 -0
index c33010bbf9e8..c6234336543d 100644
@@ -76,6 +76,7 @@ struct efa_com_create_cq_params {
      u16 eqn;
      u8 entry_size_in_bytes;
      bool interrupt_mode_enabled;
+     bool set_src_addr;

Please use "u8 xxx : 1" instead of bool in structs.

Quoted 1 line

Thanks

Thanks Leon for your reply.

Is this a convention in the subsystem? This is an internal struct used only to bind several variables for a function call and I think using bool makes it more readable.

Quoted 8 lines
Quoted 1 line

Of course if it's essential I will change this.

You should use bool xx:1 in cases like this and join all the bools in your struct into a bitfield - unless you can justify them being split eg due to needing a READ_ONCE/etc or something

This is expected across the kernel.

Jason

Thank you for your clarification, seems reasonable to me.

Sending v2 patch with all the requested changes.

Michael