diff mbox series

[v6,13/13] SIW addition to kernel build environment

Message ID 20190325171047.23824-15-bmt@zurich.ibm.com (mailing list archive)
State Superseded
Headers show
Series SIW: Request for Comments | expand

Commit Message

Bernard Metzler March 25, 2019, 5:10 p.m. UTC
Signed-off-by: Bernard Metzler <bmt@zurich.ibm.com>
---
 MAINTAINERS                        |  7 +++++++
 drivers/infiniband/Kconfig         |  1 +
 drivers/infiniband/sw/Makefile     |  1 +
 drivers/infiniband/sw/siw/Kconfig  | 17 +++++++++++++++++
 drivers/infiniband/sw/siw/Makefile | 14 ++++++++++++++
 5 files changed, 40 insertions(+)
 create mode 100644 drivers/infiniband/sw/siw/Kconfig
 create mode 100644 drivers/infiniband/sw/siw/Makefile

Comments

kernel test robot March 26, 2019, 8:45 a.m. UTC | #1
Hi Bernard,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on v5.1-rc2 next-20190326]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Bernard-Metzler/SIW-Request-for-Comments/20190326-154025
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=sh 

All error/warnings (new ones prefixed by >>):

   In file included from include/asm-generic/percpu.h:7:0,
                    from ./arch/sh/include/generated/asm/percpu.h:1,
                    from include/linux/percpu.h:13,
                    from include/linux/netdevice.h:36,
                    from drivers/infiniband/sw/siw/siw_main.c:8:
   include/linux/percpu-defs.h:91:33: warning: '__pcpu_unique_use_cnt' initialized and declared 'extern'
     extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;  \
                                    ^
   include/linux/percpu-defs.h:114:2: note: in expansion of macro 'DEFINE_PER_CPU_SECTION'
     DEFINE_PER_CPU_SECTION(type, name, "")
     ^~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:187:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
           ^~~~~~~~~~~~~~
   include/linux/percpu-defs.h:92:26: error: redefinition of '__pcpu_unique_use_cnt'
     __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;   \
                             ^
   include/linux/percpu-defs.h:114:2: note: in expansion of macro 'DEFINE_PER_CPU_SECTION'
     DEFINE_PER_CPU_SECTION(type, name, "")
     ^~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:187:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
           ^~~~~~~~~~~~~~
   include/linux/percpu-defs.h:91:33: note: previous definition of '__pcpu_unique_use_cnt' was here
     extern __PCPU_DUMMY_ATTRS char __pcpu_unique_##name;  \
                                    ^
   include/linux/percpu-defs.h:114:2: note: in expansion of macro 'DEFINE_PER_CPU_SECTION'
     DEFINE_PER_CPU_SECTION(type, name, "")
     ^~~~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:187:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
           ^~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:187:33: warning: 'use_cnt' initialized and declared 'extern'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
                                    ^
   include/linux/percpu-defs.h:93:44: note: in definition of macro 'DEFINE_PER_CPU_SECTION'
     extern __PCPU_ATTRS(sec) __typeof__(type) name;   \
                                               ^~~~
   drivers/infiniband/sw/siw/siw_main.c:187:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
           ^~~~~~~~~~~~~~
>> drivers/infiniband/sw/siw/siw_main.c:187:33: error: redefinition of 'use_cnt'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
                                    ^
   include/linux/percpu-defs.h:94:44: note: in definition of macro 'DEFINE_PER_CPU_SECTION'
     __PCPU_ATTRS(sec) __weak __typeof__(type) name
                                               ^~~~
   drivers/infiniband/sw/siw/siw_main.c:187:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
           ^~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:187:33: note: previous definition of 'use_cnt' was here
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
                                    ^
   include/linux/percpu-defs.h:93:44: note: in definition of macro 'DEFINE_PER_CPU_SECTION'
     extern __PCPU_ATTRS(sec) __typeof__(type) name;   \
                                               ^~~~
   drivers/infiniband/sw/siw/siw_main.c:187:8: note: in expansion of macro 'DEFINE_PER_CPU'
    static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
           ^~~~~~~~~~~~~~
>> drivers/infiniband/sw/siw/siw_main.c:319:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .alloc_ucontext = siw_alloc_ucontext,
                       ^~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:319:20: note: (near initialization for 'siw_device_ops.alloc_ucontext')
>> drivers/infiniband/sw/siw/siw_main.c:323:3: error: 'const struct ib_device_ops' has no member named 'dealloc_driver'; did you mean 'dealloc_fmr'?
     .dealloc_driver = siw_device_cleanup,
      ^~~~~~~~~~~~~~
      dealloc_fmr
   drivers/infiniband/sw/siw/siw_main.c:323:20: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .dealloc_driver = siw_device_cleanup,
                       ^~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:323:20: note: (near initialization for 'siw_device_ops.modify_srq')
   drivers/infiniband/sw/siw/siw_main.c:325:22: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .dealloc_ucontext = siw_dealloc_ucontext,
                         ^~~~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:325:22: note: (near initialization for 'siw_device_ops.dealloc_ucontext')
   In file included from drivers/infiniband/sw/siw/siw_main.c:17:0:
   include/rdma/ib_verbs.h:2268:3: error: 'const struct ib_device_ops' has no member named 'size_ib_ucontext'; did you mean 'alloc_ucontext'?
     .size_##ib_struct =                                                    \
      ^
   drivers/infiniband/sw/siw/siw_main.c:352:2: note: in expansion of macro 'INIT_RDMA_OBJ_SIZE'
     INIT_RDMA_OBJ_SIZE(ib_ucontext, siw_ucontext, base_ucontext),
     ^~~~~~~~~~~~~~~~~~
   include/rdma/ib_verbs.h:2269:3: warning: excess elements in struct initializer
      (sizeof(struct drv_struct) +                                   \
      ^
   drivers/infiniband/sw/siw/siw_main.c:352:2: note: in expansion of macro 'INIT_RDMA_OBJ_SIZE'
     INIT_RDMA_OBJ_SIZE(ib_ucontext, siw_ucontext, base_ucontext),
     ^~~~~~~~~~~~~~~~~~
   include/rdma/ib_verbs.h:2269:3: note: (near initialization for 'siw_device_ops')
      (sizeof(struct drv_struct) +                                   \
      ^
   drivers/infiniband/sw/siw/siw_main.c:352:2: note: in expansion of macro 'INIT_RDMA_OBJ_SIZE'
     INIT_RDMA_OBJ_SIZE(ib_ucontext, siw_ucontext, base_ucontext),
     ^~~~~~~~~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c: In function 'siw_device_create':
>> drivers/infiniband/sw/siw/siw_main.c:442:7: error: implicit declaration of function 'ib_device_set_netdev'; did you mean 'ib_device_try_get'? [-Werror=implicit-function-declaration]
     rv = ib_device_set_netdev(base_dev, netdev, 1);
          ^~~~~~~~~~~~~~~~~~~~
          ib_device_try_get
   drivers/infiniband/sw/siw/siw_main.c: In function 'siw_netdev_event':
>> drivers/infiniband/sw/siw/siw_main.c:551:13: error: implicit declaration of function 'ib_device_get_by_netdev'; did you mean 'ib_device_try_get'? [-Werror=implicit-function-declaration]
     base_dev = ib_device_get_by_netdev(netdev, RDMA_DRIVER_SIW);
                ^~~~~~~~~~~~~~~~~~~~~~~
                ib_device_try_get
>> drivers/infiniband/sw/siw/siw_main.c:551:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     base_dev = ib_device_get_by_netdev(netdev, RDMA_DRIVER_SIW);
              ^
>> drivers/infiniband/sw/siw/siw_main.c:582:3: error: implicit declaration of function 'ib_unregister_device_queued'; did you mean 'ib_unregister_device'? [-Werror=implicit-function-declaration]
      ib_unregister_device_queued(&sdev->base_dev);
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      ib_unregister_device
   drivers/infiniband/sw/siw/siw_main.c: In function 'siw_newlink':
   drivers/infiniband/sw/siw/siw_main.c:614:11: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
     base_dev = ib_device_get_by_netdev(netdev, RDMA_DRIVER_SIW);
              ^
   drivers/infiniband/sw/siw/siw_main.c: At top level:
>> drivers/infiniband/sw/siw/siw_main.c:649:15: error: variable 'siw_link_ops' has initializer but incomplete type
    static struct rdma_link_ops siw_link_ops = {
                  ^~~~~~~~~~~~~
>> drivers/infiniband/sw/siw/siw_main.c:650:3: error: 'struct rdma_link_ops' has no member named 'type'
     .type = "siw",
      ^~~~
>> drivers/infiniband/sw/siw/siw_main.c:650:10: warning: excess elements in struct initializer
     .type = "siw",
             ^~~~~
   drivers/infiniband/sw/siw/siw_main.c:650:10: note: (near initialization for 'siw_link_ops')
>> drivers/infiniband/sw/siw/siw_main.c:651:3: error: 'struct rdma_link_ops' has no member named 'newlink'
     .newlink = siw_newlink,
      ^~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:651:13: warning: excess elements in struct initializer
     .newlink = siw_newlink,
                ^~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_main.c:651:13: note: (near initialization for 'siw_link_ops')
   drivers/infiniband/sw/siw/siw_main.c: In function 'siw_init_module':
>> drivers/infiniband/sw/siw/siw_main.c:703:2: error: implicit declaration of function 'rdma_link_register'; did you mean 'rdma_nl_register'? [-Werror=implicit-function-declaration]
     rdma_link_register(&siw_link_ops);
     ^~~~~~~~~~~~~~~~~~
     rdma_nl_register
   drivers/infiniband/sw/siw/siw_main.c: In function 'siw_exit_module':
>> drivers/infiniband/sw/siw/siw_main.c:737:2: error: implicit declaration of function 'rdma_link_unregister'; did you mean 'rdma_nl_unregister'? [-Werror=implicit-function-declaration]
     rdma_link_unregister(&siw_link_ops);
     ^~~~~~~~~~~~~~~~~~~~
     rdma_nl_unregister
>> drivers/infiniband/sw/siw/siw_main.c:738:2: error: implicit declaration of function 'ib_unregister_driver'; did you mean 'ib_unregister_device'? [-Werror=implicit-function-declaration]
     ib_unregister_driver(RDMA_DRIVER_SIW);
     ^~~~~~~~~~~~~~~~~~~~
     ib_unregister_device
   drivers/infiniband/sw/siw/siw_main.c: At top level:
>> drivers/infiniband/sw/siw/siw_main.c:753:24: error: expected declaration specifiers or '...' before string constant
    MODULE_ALIAS_RDMA_LINK("siw");
                           ^~~~~
>> drivers/infiniband/sw/siw/siw_main.c:649:29: error: storage size of 'siw_link_ops' isn't known
    static struct rdma_link_ops siw_link_ops = {
                                ^~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/infiniband/sw/siw/siw_verbs.c: In function 'siw_query_device':
>> drivers/infiniband/sw/siw/siw_verbs.c:196:34: error: 'IB_DEVICE_ALLOW_USER_UNREG' undeclared (first use in this function); did you mean 'IB_DEVICE_SG_GAPS_REG'?
      IB_DEVICE_MEM_MGT_EXTENSIONS | IB_DEVICE_ALLOW_USER_UNREG;
                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~
                                     IB_DEVICE_SG_GAPS_REG
   drivers/infiniband/sw/siw/siw_verbs.c:196:34: note: each undeclared identifier is reported only once for each function it appears in
   drivers/infiniband/sw/siw/siw_verbs.c: In function 'siw_create_qp':
>> drivers/infiniband/sw/siw/siw_verbs.c:479:30: error: implicit declaration of function 'rdma_udata_to_drv_context'; did you mean 'rdma_get_ucontext'? [-Werror=implicit-function-declaration]
      struct siw_ucontext *ctx = rdma_udata_to_drv_context(
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~
                                 rdma_get_ucontext
>> drivers/infiniband/sw/siw/siw_verbs.c:480:12: error: expected expression before 'struct'
        udata, struct siw_ucontext, base_ucontext);
               ^~~~~~
   drivers/infiniband/sw/siw/siw_verbs.c: In function 'siw_copy_inline_sgl':
   drivers/infiniband/sw/siw/siw_verbs.c:707:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
     sqe->sge[0].laddr = (u64)kbuf;
                         ^
   drivers/infiniband/sw/siw/siw_verbs.c: In function 'siw_post_send':
   drivers/infiniband/sw/siw/siw_verbs.c:872:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
       sqe->base_mr = (uint64_t)reg_wr(wr)->mr;
                      ^
   drivers/infiniband/sw/siw/siw_verbs.c: In function 'siw_create_cq':
   drivers/infiniband/sw/siw/siw_verbs.c:1111:12: error: expected expression before 'struct'
        udata, struct siw_ucontext, base_ucontext);
               ^~~~~~
   In file included from include/linux/printk.h:331:0,
                    from include/linux/kernel.h:14,
                    from include/asm-generic/bug.h:18,
                    from arch/sh/include/asm/bug.h:112,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:12,
                    from include/asm-generic/current.h:5,
                    from ./arch/sh/include/generated/asm/current.h:1,
                    from include/linux/sched.h:12,
                    from include/linux/uaccess.h:5,
                    from drivers/infiniband/sw/siw/siw_verbs.c:8:
   drivers/infiniband/sw/siw/siw_verbs.c: In function 'siw_map_mr_sg':
   drivers/infiniband/sw/siw/siw_verbs.c:1497:37: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
       OBJ_ID(&mr->mem), i, pble->size, (void *)pble->addr,
                                        ^
   include/linux/dynamic_debug.h:136:9: note: in definition of macro 'dynamic_dev_dbg'
          ##__VA_ARGS__);  \
            ^~~~~~~~~~~
   drivers/infiniband/sw/siw/siw_debug.h:10:2: note: in expansion of macro 'dev_dbg'
     dev_dbg(&(ddev)->base_dev.dev, "cpu%2d %s: " fmt, smp_processor_id(),  \
     ^~~~~~~
   drivers/infiniband/sw/siw/siw_verbs.c:1495:3: note: in expansion of macro 'siw_dbg'
      siw_dbg(mr->mem.hdr.sdev,
      ^~~~~~~
   drivers/infiniband/sw/siw/siw_verbs.c: In function 'siw_create_srq':
   drivers/infiniband/sw/siw/siw_verbs.c:1608:12: error: expected expression before 'struct'
        udata, struct siw_ucontext, base_ucontext);
               ^~~~~~
   cc1: some warnings being treated as errors

vim +/use_cnt +187 drivers/infiniband/sw/siw/siw_main.c

9110e762 Bernard Metzler 2019-03-25  186  
9110e762 Bernard Metzler 2019-03-25 @187  static DEFINE_PER_CPU(atomic_t, use_cnt = ATOMIC_INIT(0));
9110e762 Bernard Metzler 2019-03-25  188  
9110e762 Bernard Metzler 2019-03-25  189  static struct {
9110e762 Bernard Metzler 2019-03-25  190  	struct cpumask **tx_valid_cpus;
9110e762 Bernard Metzler 2019-03-25  191  	int num_nodes;
9110e762 Bernard Metzler 2019-03-25  192  } siw_cpu_info;
9110e762 Bernard Metzler 2019-03-25  193  
9110e762 Bernard Metzler 2019-03-25  194  static int siw_init_cpulist(void)
9110e762 Bernard Metzler 2019-03-25  195  {
9110e762 Bernard Metzler 2019-03-25  196  	int i, num_nodes;
9110e762 Bernard Metzler 2019-03-25  197  
9110e762 Bernard Metzler 2019-03-25  198  	num_nodes = num_possible_nodes();
9110e762 Bernard Metzler 2019-03-25  199  	siw_cpu_info.num_nodes = num_nodes;
9110e762 Bernard Metzler 2019-03-25  200  
9110e762 Bernard Metzler 2019-03-25  201  	siw_cpu_info.tx_valid_cpus =
9110e762 Bernard Metzler 2019-03-25  202  		kcalloc(num_nodes, sizeof(void *), GFP_KERNEL);
9110e762 Bernard Metzler 2019-03-25  203  	if (!siw_cpu_info.tx_valid_cpus) {
9110e762 Bernard Metzler 2019-03-25  204  		siw_cpu_info.num_nodes = 0;
9110e762 Bernard Metzler 2019-03-25  205  		return -ENOMEM;
9110e762 Bernard Metzler 2019-03-25  206  	}
9110e762 Bernard Metzler 2019-03-25  207  
9110e762 Bernard Metzler 2019-03-25  208  	for (i = 0; i < siw_cpu_info.num_nodes; i++) {
9110e762 Bernard Metzler 2019-03-25  209  		siw_cpu_info.tx_valid_cpus[i] =
9110e762 Bernard Metzler 2019-03-25  210  			kzalloc(sizeof(struct cpumask), GFP_KERNEL);
9110e762 Bernard Metzler 2019-03-25  211  		if (!siw_cpu_info.tx_valid_cpus[i])
9110e762 Bernard Metzler 2019-03-25  212  			goto out_err;
9110e762 Bernard Metzler 2019-03-25  213  
9110e762 Bernard Metzler 2019-03-25  214  		cpumask_clear(siw_cpu_info.tx_valid_cpus[i]);
9110e762 Bernard Metzler 2019-03-25  215  	}
9110e762 Bernard Metzler 2019-03-25  216  	for_each_possible_cpu(i)
9110e762 Bernard Metzler 2019-03-25  217  		cpumask_set_cpu(i, siw_cpu_info.tx_valid_cpus[cpu_to_node(i)]);
9110e762 Bernard Metzler 2019-03-25  218  
9110e762 Bernard Metzler 2019-03-25  219  	return 0;
9110e762 Bernard Metzler 2019-03-25  220  
9110e762 Bernard Metzler 2019-03-25  221  out_err:
9110e762 Bernard Metzler 2019-03-25  222  	siw_cpu_info.num_nodes = 0;
9110e762 Bernard Metzler 2019-03-25  223  	while (i) {
9110e762 Bernard Metzler 2019-03-25  224  		kfree(siw_cpu_info.tx_valid_cpus[i]);
9110e762 Bernard Metzler 2019-03-25  225  		siw_cpu_info.tx_valid_cpus[i--] = NULL;
9110e762 Bernard Metzler 2019-03-25  226  	}
9110e762 Bernard Metzler 2019-03-25  227  	kfree(siw_cpu_info.tx_valid_cpus);
9110e762 Bernard Metzler 2019-03-25  228  	siw_cpu_info.tx_valid_cpus = NULL;
9110e762 Bernard Metzler 2019-03-25  229  
9110e762 Bernard Metzler 2019-03-25  230  	return -ENOMEM;
9110e762 Bernard Metzler 2019-03-25  231  }
9110e762 Bernard Metzler 2019-03-25  232  
9110e762 Bernard Metzler 2019-03-25  233  static void siw_destroy_cpulist(void)
9110e762 Bernard Metzler 2019-03-25  234  {
9110e762 Bernard Metzler 2019-03-25  235  	int i = 0;
9110e762 Bernard Metzler 2019-03-25  236  
9110e762 Bernard Metzler 2019-03-25  237  	while (i < siw_cpu_info.num_nodes)
9110e762 Bernard Metzler 2019-03-25  238  		kfree(siw_cpu_info.tx_valid_cpus[i++]);
9110e762 Bernard Metzler 2019-03-25  239  
9110e762 Bernard Metzler 2019-03-25  240  	kfree(siw_cpu_info.tx_valid_cpus);
9110e762 Bernard Metzler 2019-03-25  241  }
9110e762 Bernard Metzler 2019-03-25  242  
9110e762 Bernard Metzler 2019-03-25  243  /*
9110e762 Bernard Metzler 2019-03-25  244   * Choose CPU with least number of active QP's from NUMA node of
9110e762 Bernard Metzler 2019-03-25  245   * TX interface.
9110e762 Bernard Metzler 2019-03-25  246   */
9110e762 Bernard Metzler 2019-03-25  247  int siw_get_tx_cpu(struct siw_device *sdev)
9110e762 Bernard Metzler 2019-03-25  248  {
9110e762 Bernard Metzler 2019-03-25  249  	const struct cpumask *tx_cpumask;
9110e762 Bernard Metzler 2019-03-25  250  	int i, num_cpus, cpu, min_use, node = sdev->numa_node, tx_cpu = -1;
9110e762 Bernard Metzler 2019-03-25  251  
9110e762 Bernard Metzler 2019-03-25  252  	if (node < 0)
9110e762 Bernard Metzler 2019-03-25  253  		tx_cpumask = cpu_online_mask;
9110e762 Bernard Metzler 2019-03-25  254  	else
9110e762 Bernard Metzler 2019-03-25  255  		tx_cpumask = siw_cpu_info.tx_valid_cpus[node];
9110e762 Bernard Metzler 2019-03-25  256  
9110e762 Bernard Metzler 2019-03-25  257  	num_cpus = cpumask_weight(tx_cpumask);
9110e762 Bernard Metzler 2019-03-25  258  	if (!num_cpus) {
9110e762 Bernard Metzler 2019-03-25  259  		/* no CPU on this NUMA node */
9110e762 Bernard Metzler 2019-03-25  260  		tx_cpumask = cpu_online_mask;
9110e762 Bernard Metzler 2019-03-25  261  		num_cpus = cpumask_weight(tx_cpumask);
9110e762 Bernard Metzler 2019-03-25  262  	}
9110e762 Bernard Metzler 2019-03-25  263  	if (!num_cpus)
9110e762 Bernard Metzler 2019-03-25  264  		goto out;
9110e762 Bernard Metzler 2019-03-25  265  
9110e762 Bernard Metzler 2019-03-25  266  	cpu = cpumask_first(tx_cpumask);
9110e762 Bernard Metzler 2019-03-25  267  
9110e762 Bernard Metzler 2019-03-25  268  	for (i = 0, min_use = SIW_MAX_QP; i < num_cpus;
9110e762 Bernard Metzler 2019-03-25  269  	     i++, cpu = cpumask_next(cpu, tx_cpumask)) {
9110e762 Bernard Metzler 2019-03-25  270  		int usage;
9110e762 Bernard Metzler 2019-03-25  271  
9110e762 Bernard Metzler 2019-03-25  272  		/* Skip any cores which have no TX thread */
9110e762 Bernard Metzler 2019-03-25  273  		if (!siw_tx_thread[cpu])
9110e762 Bernard Metzler 2019-03-25  274  			continue;
9110e762 Bernard Metzler 2019-03-25  275  
9110e762 Bernard Metzler 2019-03-25  276  		usage = atomic_read(&per_cpu(use_cnt, cpu));
9110e762 Bernard Metzler 2019-03-25  277  		if (usage <= min_use) {
9110e762 Bernard Metzler 2019-03-25  278  			tx_cpu = cpu;
9110e762 Bernard Metzler 2019-03-25  279  			min_use = usage;
9110e762 Bernard Metzler 2019-03-25  280  		}
9110e762 Bernard Metzler 2019-03-25  281  	}
9110e762 Bernard Metzler 2019-03-25  282  	siw_dbg(sdev, "tx cpu %d, node %d, %d qp's\n", tx_cpu, node, min_use);
9110e762 Bernard Metzler 2019-03-25  283  
9110e762 Bernard Metzler 2019-03-25  284  out:
9110e762 Bernard Metzler 2019-03-25  285  	if (tx_cpu >= 0)
9110e762 Bernard Metzler 2019-03-25  286  		atomic_inc(&per_cpu(use_cnt, tx_cpu));
9110e762 Bernard Metzler 2019-03-25  287  	else
9110e762 Bernard Metzler 2019-03-25  288  		pr_warn("siw: no tx cpu found\n");
9110e762 Bernard Metzler 2019-03-25  289  
9110e762 Bernard Metzler 2019-03-25  290  	return tx_cpu;
9110e762 Bernard Metzler 2019-03-25  291  }
9110e762 Bernard Metzler 2019-03-25  292  
9110e762 Bernard Metzler 2019-03-25  293  void siw_put_tx_cpu(int cpu)
9110e762 Bernard Metzler 2019-03-25  294  {
9110e762 Bernard Metzler 2019-03-25  295  	atomic_dec(&per_cpu(use_cnt, cpu));
9110e762 Bernard Metzler 2019-03-25  296  }
9110e762 Bernard Metzler 2019-03-25  297  
9110e762 Bernard Metzler 2019-03-25  298  static void siw_verbs_sq_flush(struct ib_qp *base_qp)
9110e762 Bernard Metzler 2019-03-25  299  {
9110e762 Bernard Metzler 2019-03-25  300  	struct siw_qp *qp = to_siw_qp(base_qp);
9110e762 Bernard Metzler 2019-03-25  301  
9110e762 Bernard Metzler 2019-03-25  302  	down_write(&qp->state_lock);
9110e762 Bernard Metzler 2019-03-25  303  	siw_sq_flush(qp);
9110e762 Bernard Metzler 2019-03-25  304  	up_write(&qp->state_lock);
9110e762 Bernard Metzler 2019-03-25  305  }
9110e762 Bernard Metzler 2019-03-25  306  
9110e762 Bernard Metzler 2019-03-25  307  static void siw_verbs_rq_flush(struct ib_qp *base_qp)
9110e762 Bernard Metzler 2019-03-25  308  {
9110e762 Bernard Metzler 2019-03-25  309  	struct siw_qp *qp = to_siw_qp(base_qp);
9110e762 Bernard Metzler 2019-03-25  310  
9110e762 Bernard Metzler 2019-03-25  311  	down_write(&qp->state_lock);
9110e762 Bernard Metzler 2019-03-25  312  	siw_rq_flush(qp);
9110e762 Bernard Metzler 2019-03-25  313  	up_write(&qp->state_lock);
9110e762 Bernard Metzler 2019-03-25  314  }
9110e762 Bernard Metzler 2019-03-25  315  
9110e762 Bernard Metzler 2019-03-25  316  static const struct ib_device_ops siw_device_ops = {
9110e762 Bernard Metzler 2019-03-25  317  	.alloc_mr = siw_alloc_mr,
9110e762 Bernard Metzler 2019-03-25  318  	.alloc_pd = siw_alloc_pd,
9110e762 Bernard Metzler 2019-03-25 @319  	.alloc_ucontext = siw_alloc_ucontext,
9110e762 Bernard Metzler 2019-03-25  320  	.create_cq = siw_create_cq,
9110e762 Bernard Metzler 2019-03-25  321  	.create_qp = siw_create_qp,
9110e762 Bernard Metzler 2019-03-25  322  	.create_srq = siw_create_srq,
9110e762 Bernard Metzler 2019-03-25 @323  	.dealloc_driver = siw_device_cleanup,
9110e762 Bernard Metzler 2019-03-25  324  	.dealloc_pd = siw_dealloc_pd,
9110e762 Bernard Metzler 2019-03-25  325  	.dealloc_ucontext = siw_dealloc_ucontext,
9110e762 Bernard Metzler 2019-03-25  326  	.dereg_mr = siw_dereg_mr,
9110e762 Bernard Metzler 2019-03-25  327  	.destroy_cq = siw_destroy_cq,
9110e762 Bernard Metzler 2019-03-25  328  	.destroy_qp = siw_destroy_qp,
9110e762 Bernard Metzler 2019-03-25  329  	.destroy_srq = siw_destroy_srq,
9110e762 Bernard Metzler 2019-03-25  330  	.drain_rq = siw_verbs_rq_flush,
9110e762 Bernard Metzler 2019-03-25  331  	.drain_sq = siw_verbs_sq_flush,
9110e762 Bernard Metzler 2019-03-25  332  	.get_dma_mr = siw_get_dma_mr,
9110e762 Bernard Metzler 2019-03-25  333  	.get_port_immutable = siw_get_port_immutable,
9110e762 Bernard Metzler 2019-03-25  334  	.map_mr_sg = siw_map_mr_sg,
9110e762 Bernard Metzler 2019-03-25  335  	.mmap = siw_mmap,
9110e762 Bernard Metzler 2019-03-25  336  	.modify_qp = siw_verbs_modify_qp,
9110e762 Bernard Metzler 2019-03-25  337  	.modify_srq = siw_modify_srq,
9110e762 Bernard Metzler 2019-03-25  338  	.poll_cq = siw_poll_cq,
9110e762 Bernard Metzler 2019-03-25  339  	.post_recv = siw_post_receive,
9110e762 Bernard Metzler 2019-03-25  340  	.post_send = siw_post_send,
9110e762 Bernard Metzler 2019-03-25  341  	.post_srq_recv = siw_post_srq_recv,
9110e762 Bernard Metzler 2019-03-25  342  	.query_device = siw_query_device,
9110e762 Bernard Metzler 2019-03-25  343  	.query_gid = siw_query_gid,
9110e762 Bernard Metzler 2019-03-25  344  	.query_pkey = siw_query_pkey,
9110e762 Bernard Metzler 2019-03-25  345  	.query_port = siw_query_port,
9110e762 Bernard Metzler 2019-03-25  346  	.query_qp = siw_query_qp,
9110e762 Bernard Metzler 2019-03-25  347  	.query_srq = siw_query_srq,
9110e762 Bernard Metzler 2019-03-25  348  	.req_notify_cq = siw_req_notify_cq,
9110e762 Bernard Metzler 2019-03-25  349  	.reg_user_mr = siw_reg_user_mr,
9110e762 Bernard Metzler 2019-03-25  350  
9110e762 Bernard Metzler 2019-03-25  351  	INIT_RDMA_OBJ_SIZE(ib_pd, siw_pd, base_pd),
9110e762 Bernard Metzler 2019-03-25 @352  	INIT_RDMA_OBJ_SIZE(ib_ucontext, siw_ucontext, base_ucontext),
9110e762 Bernard Metzler 2019-03-25  353  };
9110e762 Bernard Metzler 2019-03-25  354  

:::::: The code at line 187 was first introduced by commit
:::::: 9110e762c07e32d0cf9e86b7417bd1d6d7a07b97 SIW network and RDMA core interface

:::::: TO: Bernard Metzler <bmt@zurich.ibm.com>
:::::: CC: 0day robot <lkp@intel.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 8c68de3cfd80..db250fd67352 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14055,6 +14055,13 @@  M:	Chris Boot <bootc@bootc.net>
 S:	Maintained
 F:	drivers/leds/leds-net48xx.c
 
+SOFT-IWARP DRIVER (siw)
+M:	Bernard Metzler <bmt@zurich.ibm.com>
+L:	linux-rdma@vger.kernel.org
+S:	Supported
+F:	drivers/infiniband/sw/siw/
+F:	include/uapi/rdma/siw_user.h
+
 SOFT-ROCE DRIVER (rxe)
 M:	Moni Shoua <monis@mellanox.com>
 L:	linux-rdma@vger.kernel.org
diff --git a/drivers/infiniband/Kconfig b/drivers/infiniband/Kconfig
index a1fb840de45d..6d160aac26df 100644
--- a/drivers/infiniband/Kconfig
+++ b/drivers/infiniband/Kconfig
@@ -107,6 +107,7 @@  source "drivers/infiniband/hw/hfi1/Kconfig"
 source "drivers/infiniband/hw/qedr/Kconfig"
 source "drivers/infiniband/sw/rdmavt/Kconfig"
 source "drivers/infiniband/sw/rxe/Kconfig"
+source "drivers/infiniband/sw/siw/Kconfig"
 endif
 
 source "drivers/infiniband/ulp/ipoib/Kconfig"
diff --git a/drivers/infiniband/sw/Makefile b/drivers/infiniband/sw/Makefile
index 8b095b27db87..d37610fcbbc7 100644
--- a/drivers/infiniband/sw/Makefile
+++ b/drivers/infiniband/sw/Makefile
@@ -1,2 +1,3 @@ 
 obj-$(CONFIG_INFINIBAND_RDMAVT)		+= rdmavt/
 obj-$(CONFIG_RDMA_RXE)			+= rxe/
+obj-$(CONFIG_RDMA_SIW)			+= siw/
diff --git a/drivers/infiniband/sw/siw/Kconfig b/drivers/infiniband/sw/siw/Kconfig
new file mode 100644
index 000000000000..94f684174ce3
--- /dev/null
+++ b/drivers/infiniband/sw/siw/Kconfig
@@ -0,0 +1,17 @@ 
+config RDMA_SIW
+	tristate "Software RDMA over TCP/IP (iWARP) driver"
+	depends on INET && INFINIBAND && CRYPTO_CRC32
+	help
+	This driver implements the iWARP RDMA transport over
+	the Linux TCP/IP network stack. It enables a system with a
+	standard Ethernet adapter to interoperate with a iWARP
+	adapter or with another system running the SIW driver.
+	(See also RXE which is a similar software driver for RoCE.)
+
+	The driver interfaces with the Linux RDMA stack and
+	implements both a kernel and user space RDMA verbs API.
+	The user space verbs API requires a support
+	library named libsiw which is loaded by the generic user
+	space verbs API, libibverbs. To implement RDMA over
+	TCP/IP, the driver further interfaces with the Linux
+	in-kernel TCP socket layer.
diff --git a/drivers/infiniband/sw/siw/Makefile b/drivers/infiniband/sw/siw/Makefile
new file mode 100644
index 000000000000..4da842bdf919
--- /dev/null
+++ b/drivers/infiniband/sw/siw/Makefile
@@ -0,0 +1,14 @@ 
+obj-$(CONFIG_RDMA_SIW) += siw.o
+
+siw-y := \
+	siw_ae.o \
+	siw_cm.o \
+	siw_cq.o \
+	siw_debug.o \
+	siw_main.o \
+	siw_mem.o \
+	siw_obj.o \
+	siw_qp.o \
+	siw_qp_tx.o \
+	siw_qp_rx.o \
+	siw_verbs.o