Skip to contentSkip to conversation

RDMA/hns: Move capability flags of QP and CQ to hns-abi.h

PATCH Superseded Weihang Li 3 participants 5 messages Dec 1, 2020 – Dec 2, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Weihang Li

author
#0 lore raw

PATCH 1/1 RDMA/hns: Move capability flags of QP and CQ to hns-abi.h

These flags will be returned to the userspace through ABI, so they should be defined in hns-abi.h. Furthermore, there is no need to include hns-abi.h in every source files, it just needs to be included in the common header file.

---
 drivers/infiniband/hw/hns/hns_roce_cq.c     |  1 -
 drivers/infiniband/hw/hns/hns_roce_device.h | 11 +----------
 drivers/infiniband/hw/hns/hns_roce_main.c   |  1 -
 drivers/infiniband/hw/hns/hns_roce_pd.c     |  1 -
 drivers/infiniband/hw/hns/hns_roce_qp.c     |  1 -
 drivers/infiniband/hw/hns/hns_roce_srq.c    |  1 -
 include/uapi/rdma/hns-abi.h                 | 10 ++++++++++
 7 files changed, 11 insertions(+), 15 deletions(-)
drivers/infiniband/hw/hns/hns_roce_cq.c +0 -1
index 68f355f..5e6d688 100644
@@ -36,7 +36,6 @@
 #include "hns_roce_device.h"
 #include "hns_roce_cmd.h"
 #include "hns_roce_hem.h"
-#include <rdma/hns-abi.h>
 #include "hns_roce_common.h"
 
 static int alloc_cqc(struct hns_roce_dev *hr_dev, struct hns_roce_cq *hr_cq)
drivers/infiniband/hw/hns/hns_roce_device.h +1 -10
index 1c1deb4..6c5d5dd 100644
@@ -34,6 +34,7 @@
 #define _HNS_ROCE_DEVICE_H
 
 #include <rdma/ib_verbs.h>
+#include <rdma/hns-abi.h>
 
 #define DRV_NAME "hns_roce"
 
@@ -129,16 +130,6 @@ enum {
 	SERV_TYPE_UD,
 };
 
-enum hns_roce_qp_caps {
-	HNS_ROCE_QP_CAP_RQ_RECORD_DB = BIT(0),
-	HNS_ROCE_QP_CAP_SQ_RECORD_DB = BIT(1),
-	HNS_ROCE_QP_CAP_OWNER_DB = BIT(2),
-};
-
-enum hns_roce_cq_flags {
-	HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
-};
-
 enum hns_roce_qp_state {
 	HNS_ROCE_QP_STATE_RST,
 	HNS_ROCE_QP_STATE_INIT,
drivers/infiniband/hw/hns/hns_roce_main.c +0 -1
index f01590d..e8aa807 100644
@@ -40,7 +40,6 @@
 #include <rdma/ib_cache.h>
 #include "hns_roce_common.h"
 #include "hns_roce_device.h"
-#include <rdma/hns-abi.h>
 #include "hns_roce_hem.h"
 
 /**
drivers/infiniband/hw/hns/hns_roce_pd.c +0 -1
index 98f6949..45ec91d 100644
@@ -32,7 +32,6 @@
 
 #include <linux/platform_device.h>
 #include <linux/pci.h>
-#include <uapi/rdma/hns-abi.h>
 #include "hns_roce_device.h"
 
 static int hns_roce_pd_alloc(struct hns_roce_dev *hr_dev, unsigned long *pdn)
drivers/infiniband/hw/hns/hns_roce_qp.c +0 -1
index 5e505a3..5a94b20 100644
@@ -39,7 +39,6 @@
 #include "hns_roce_common.h"
 #include "hns_roce_device.h"
 #include "hns_roce_hem.h"
-#include <rdma/hns-abi.h>
 
 static void flush_work_handle(struct work_struct *work)
 {
drivers/infiniband/hw/hns/hns_roce_srq.c +0 -1
index 27646b9..36c6bcb 100644
@@ -4,7 +4,6 @@
  */
 
 #include <rdma/ib_umem.h>
-#include <rdma/hns-abi.h>
 #include "hns_roce_device.h"
 #include "hns_roce_cmd.h"
 #include "hns_roce_hem.h"
include/uapi/rdma/hns-abi.h +10 -0
index 9ec85f7..2dd5fa07 100644
@@ -43,6 +43,10 @@ struct hns_roce_ib_create_cq {
 	__u32 reserved;
 };
 
+enum hns_roce_cq_cap_flags {
+	HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
+};
+
 struct hns_roce_ib_create_cq_resp {
 	__aligned_u64 cqn; /* Only 32 bits used, 64 for compat */
 	__aligned_u64 cap_flags;
@@ -69,6 +73,12 @@ struct hns_roce_ib_create_qp {
 	__aligned_u64 sdb_addr;
 };
 
+enum hns_roce_qp_cap_flags {
+	HNS_ROCE_QP_CAP_RQ_RECORD_DB = BIT(0),
+	HNS_ROCE_QP_CAP_SQ_RECORD_DB = BIT(1),
+	HNS_ROCE_QP_CAP_OWNER_DB = BIT(2),
+};
+
 struct hns_roce_ib_create_qp_resp {
 	__aligned_u64 cap_flags;
 };
Signature · 1 line
2.8.1
#1 lore raw
Quoted 15 lines · Weihang Li
include/uapi/rdma/hns-abi.h +5 -0
index 9ec85f7..2dd5fa07 100644
+++ b/include/uapi/rdma/hns-abi.h
@@ -43,6 +43,10 @@ struct hns_roce_ib_create_cq {
 	__u32 reserved;
 };
 
+enum hns_roce_cq_cap_flags {
+	HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
+};
+
 struct hns_roce_ib_create_cq_resp {
 	__aligned_u64 cqn; /* Only 32 bits used, 64 for compat */
 	__aligned_u64 cap_flags;

include/uapi/rdma/hns-abi.h struct hns_roce_ib_create_qp { · line 80

Quoted 8 lines
include/uapi/rdma/hns-abi.h +5 -0
@@ -69,6 +73,12 @@ struct hns_roce_ib_create_qp {
 	__aligned_u64 sdb_addr;
 };
 
+enum hns_roce_qp_cap_flags {
+	HNS_ROCE_QP_CAP_RQ_RECORD_DB = BIT(0),
+	HNS_ROCE_QP_CAP_SQ_RECORD_DB = BIT(1),
+	HNS_ROCE_QP_CAP_OWNER_DB = BIT(2),
+};

Don't use BIT in uapi headers

Jason

author
#2 lore raw
Quoted 27 lines · Jason Gunthorpe
Quoted 15 lines · Weihang Li
include/uapi/rdma/hns-abi.h +5 -0
index 9ec85f7..2dd5fa07 100644
+++ b/include/uapi/rdma/hns-abi.h
@@ -43,6 +43,10 @@ struct hns_roce_ib_create_cq {
 	__u32 reserved;
 };
 
+enum hns_roce_cq_cap_flags {
+	HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
+};
+
 struct hns_roce_ib_create_cq_resp {
 	__aligned_u64 cqn; /* Only 32 bits used, 64 for compat */
 	__aligned_u64 cap_flags;

include/uapi/rdma/hns-abi.h struct hns_roce_ib_create_qp { · line 80

Quoted 8 lines
include/uapi/rdma/hns-abi.h +5 -0
@@ -69,6 +73,12 @@ struct hns_roce_ib_create_qp {
 	__aligned_u64 sdb_addr;
 };
 
+enum hns_roce_qp_cap_flags {
+	HNS_ROCE_QP_CAP_RQ_RECORD_DB = BIT(0),
+	HNS_ROCE_QP_CAP_SQ_RECORD_DB = BIT(1),
+	HNS_ROCE_QP_CAP_OWNER_DB = BIT(2),
+};

Don't use BIT in uapi headers

Quoted 2 lines

Jason

I see, thank you.

Weihang

#3 lore raw
In reply to Weihang Li
I love your patch! Yet something to improve:

Hi Weihang,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on next-20201201]
[cannot apply to linus/master v5.10-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Weihang-Li/RDMA-hns-Move-capability-flags-of-QP-and-CQ-to-hns-abi-h/20201201-213105
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: x86_64-randconfig-c002-20201201 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce (this is a W=1 build):
        # https://github.com/0day-ci/linux/commit/b93797e8106c9daaed3e9209905635a086354a5c
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Weihang-Li/RDMA-hns-Move-capability-flags-of-QP-and-CQ-to-hns-abi-h/20201201-213105
        git checkout b93797e8106c9daaed3e9209905635a086354a5c
        # save the attached .config to linux build tree
        make W=1 ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from <command-line>:32:

>> ./usr/include/rdma/hns-abi.h:47:31: error: implicit declaration of function 'BIT' [-Werror=implicit-function-declaration]
      47 |  HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
         |                               ^~~
>> ./usr/include/rdma/hns-abi.h:47:2: error: enumerator value for 'HNS_ROCE_CQ_FLAG_RECORD_DB' is not an integer constant
      47 |  HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> ./usr/include/rdma/hns-abi.h:77:2: error: enumerator value for 'HNS_ROCE_QP_CAP_RQ_RECORD_DB' is not an integer constant
      77 |  HNS_ROCE_QP_CAP_RQ_RECORD_DB = BIT(0),
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> ./usr/include/rdma/hns-abi.h:78:2: error: enumerator value for 'HNS_ROCE_QP_CAP_SQ_RECORD_DB' is not an integer constant
      78 |  HNS_ROCE_QP_CAP_SQ_RECORD_DB = BIT(1),
         |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> ./usr/include/rdma/hns-abi.h:79:2: error: enumerator value for 'HNS_ROCE_QP_CAP_OWNER_DB' is not an integer constant
      79 |  HNS_ROCE_QP_CAP_OWNER_DB = BIT(2),
         |  ^~~~~~~~~~~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#4 lore raw
In reply to Weihang Li
I love your patch! Yet something to improve:

Hi Weihang,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on next-20201201]
[cannot apply to linus/master v5.10-rc6]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Weihang-Li/RDMA-hns-Move-capability-flags-of-QP-and-CQ-to-hns-abi-h/20201201-213105
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: x86_64-randconfig-a006-20201201 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ac40a2d8f16b8a8c68fc811d67f647740e965cb8)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/b93797e8106c9daaed3e9209905635a086354a5c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Weihang-Li/RDMA-hns-Move-capability-flags-of-QP-and-CQ-to-hns-abi-h/20201201-213105 git checkout b93797e8106c9daaed3e9209905635a086354a5c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from <built-in>:1:

>> ./usr/include/rdma/hns-abi.h:47:31: error: implicit declaration of function 'BIT' [-Werror,-Wimplicit-function-declaration]
           HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
                                        ^
>> ./usr/include/rdma/hns-abi.h:47:31: error: expression is not an integer constant expression
           HNS_ROCE_CQ_FLAG_RECORD_DB = BIT(0),
                                        ^~~~~~
   ./usr/include/rdma/hns-abi.h:77:33: error: expression is not an integer constant expression
           HNS_ROCE_QP_CAP_RQ_RECORD_DB = BIT(0),
                                          ^~~~~~
   ./usr/include/rdma/hns-abi.h:78:33: error: expression is not an integer constant expression
           HNS_ROCE_QP_CAP_SQ_RECORD_DB = BIT(1),
                                          ^~~~~~
   ./usr/include/rdma/hns-abi.h:79:29: error: expression is not an integer constant expression
           HNS_ROCE_QP_CAP_OWNER_DB = BIT(2),
                                      ^~~~~~

5 errors generated.

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org