tree:
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
queue-4.14
head: e7070c196c5e75ab1ac8bca2e88ebb8db34aa29f
commit: e7070c196c5e75ab1ac8bca2e88ebb8db34aa29f [23/23] RDMA/mlx4: Do not map the
core_clock page to user space unless enabled
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 7.5.0
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
#
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git/c...
git remote add sashal-linux-stable
https://git.kernel.org/pub/scm/linux/kernel/git/sashal/linux-stable.git
git fetch --no-tags sashal-linux-stable queue-4.14
git checkout e7070c196c5e75ab1ac8bca2e88ebb8db34aa29f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-7.5.0 make.cross ARCH=ia64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All error/warnings (new ones prefixed by >>):
drivers/infiniband/hw/mlx4/main.c: In function 'mlx4_ib_query_device':
> drivers/infiniband/hw/mlx4/main.c:569:1: error: version control
conflict marker in file
<<<<<<< HEAD
^~~~~~~
drivers/infiniband/hw/mlx4/main.c:577:1: error: version control conflict marker in
file
=======
^~~~~~~
> drivers/infiniband/hw/mlx4/main.c:579:9: error: 'struct
ib_device_attr' has no member named 'cq_caps'; did you mean 'tm_caps'?
props->cq_caps.max_cq_moderation_period = MLX4_MAX_CQ_PERIOD;
^~~~~~~
tm_caps
> drivers/infiniband/hw/mlx4/main.c:579:44: error:
'MLX4_MAX_CQ_PERIOD' undeclared (first use in this function); did you mean
'MLX4_MAX_SGE_RD'?
props->cq_caps.max_cq_moderation_period =
MLX4_MAX_CQ_PERIOD;
^~~~~~~~~~~~~~~~~~
MLX4_MAX_SGE_RD
drivers/infiniband/hw/mlx4/main.c:579:44: note: each undeclared identifier is reported
only once for each function it appears in
> drivers/infiniband/hw/mlx4/main.c:584:22: error:
'MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET' undeclared (first use in this
function)
resp.comp_mask |= MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:585:1: error: version control conflict marker in
file
>>>>>> 2300706ca2f6 (RDMA/mlx4: Do not map the
core_clock page to user space unless enabled)
^~~~~~~
>> drivers/infiniband/hw/mlx4/main.c:585:9: error: invalid suffix "ca2f6"
on integer constant
>>>>>> 2300706ca2f6 (RDMA/mlx4: Do not map the
core_clock page to user space unless enabled)
^~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:610:1: error: invalid storage
class for function 'mlx4_ib_port_link_layer'
mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num)
^~~~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:609:1: warning: ISO C90 forbids
mixed declarations and code [-Wdeclaration-after-statement]
static enum
rdma_link_layer
^~~~~~
> drivers/infiniband/hw/mlx4/main.c:618:12: error: invalid storage
class for function 'ib_link_query_port'
static int
ib_link_query_port(struct ib_device *ibdev, u8 port,
^~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:708:11: error: invalid storage
class for function 'state_to_phys_state'
static u8
state_to_phys_state(enum ib_port_state state)
^~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:713:12: error: invalid storage
class for function 'eth_link_query_port'
static int
eth_link_query_port(struct ib_device *ibdev, u8 port,
^~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:786:12: error: invalid storage
class for function 'mlx4_ib_query_port'
static int
mlx4_ib_query_port(struct ib_device *ibdev, u8 port,
^~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:849:12: error: invalid storage
class for function 'mlx4_ib_query_gid'
static int
mlx4_ib_query_gid(struct ib_device *ibdev, u8 port, int index,
^~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:872:12: error: invalid storage
class for function 'mlx4_ib_query_sl2vl'
static int
mlx4_ib_query_sl2vl(struct ib_device *ibdev, u8 port, u64 *sl2vl_tbl)
^~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:913:13: error: invalid storage
class for function 'mlx4_init_sl2vl_tbl'
static void
mlx4_init_sl2vl_tbl(struct mlx4_ib_dev *mdev)
^~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:965:12: error: invalid storage
class for function 'mlx4_ib_query_pkey'
static int
mlx4_ib_query_pkey(struct ib_device *ibdev, u8 port, u16 index, u16 *pkey)
^~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:970:12: error: invalid storage
class for function 'mlx4_ib_modify_device'
static int
mlx4_ib_modify_device(struct ib_device *ibdev, int mask,
^~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:1006:12: error: invalid storage
class for function 'mlx4_ib_SET_PORT'
static int mlx4_ib_SET_PORT(struct
mlx4_ib_dev *dev, u8 port, int reset_qkey_viols,
^~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:1032:12: error: invalid storage
class for function 'mlx4_ib_modify_port'
static int
mlx4_ib_modify_port(struct ib_device *ibdev, u8 port, int mask,
^~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:1066:28: error: invalid storage
class for function 'mlx4_ib_alloc_ucontext'
static struct ib_ucontext
*mlx4_ib_alloc_ucontext(struct ib_device *ibdev,
^~~~~~~~~~~~~~~~~~~~~~
> drivers/infiniband/hw/mlx4/main.c:1120:12: error: invalid storage
class for function 'mlx4_ib_dealloc_ucontext'
static int
mlx4_ib_dealloc_ucontext(struct ib_ucontext *ibcontext)
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1130:14: error: invalid storage class for function
'mlx4_ib_vma_open'
static void mlx4_ib_vma_open(struct vm_area_struct *area)
^~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1144:14: error: invalid storage class for function
'mlx4_ib_vma_close'
static void mlx4_ib_vma_close(struct vm_area_struct *area)
^~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1166:10: error: initializer element is not constant
.open = mlx4_ib_vma_open,
^~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1166:10: note: (near initialization for
'mlx4_ib_vm_ops.open')
drivers/infiniband/hw/mlx4/main.c:1167:11: error: initializer element is not constant
.close = mlx4_ib_vma_close
^~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1167:11: note: (near initialization for
'mlx4_ib_vm_ops.close')
drivers/infiniband/hw/mlx4/main.c:1170:13: error: invalid storage class for function
'mlx4_ib_disassociate_ucontext'
static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1236:13: error: invalid storage class for function
'mlx4_ib_set_vma_data'
static void mlx4_ib_set_vma_data(struct vm_area_struct *vma,
^~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1244:12: error: invalid storage class for function
'mlx4_ib_mmap'
static int mlx4_ib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma)
^~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1312:22: error: invalid storage class for function
'mlx4_ib_alloc_pd'
static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev,
^~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1339:12: error: invalid storage class for function
'mlx4_ib_dealloc_pd'
static int mlx4_ib_dealloc_pd(struct ib_pd *pd)
^~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1347:24: error: invalid storage class for function
'mlx4_ib_alloc_xrcd'
static struct ib_xrcd *mlx4_ib_alloc_xrcd(struct ib_device *ibdev,
^~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1390:12: error: invalid storage class for function
'mlx4_ib_dealloc_xrcd'
static int mlx4_ib_dealloc_xrcd(struct ib_xrcd *xrcd)
^~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1400:12: error: invalid storage class for function
'add_gid_entry'
static int add_gid_entry(struct ib_qp *ibqp, union ib_gid *gid)
^~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1423:13: error: invalid storage class for function
'mlx4_ib_delete_counters_table'
static void mlx4_ib_delete_counters_table(struct mlx4_ib_dev *ibdev,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1481:12: error: invalid storage class for function
'parse_flow_attr'
static int parse_flow_attr(struct mlx4_dev *dev,
^~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1564:12: error: invalid storage class for function
'__mlx4_ib_default_rules_match'
static int __mlx4_ib_default_rules_match(struct ib_qp *qp,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1618:12: error: invalid storage class for function
'__mlx4_ib_create_default_rules'
static int __mlx4_ib_create_default_rules(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1657:12: error: invalid storage class for function
'__mlx4_ib_create_flow'
static int __mlx4_ib_create_flow(struct ib_qp *qp, struct ib_flow_attr *flow_attr,
^~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1750:12: error: invalid storage class for function
'__mlx4_ib_destroy_flow'
static int __mlx4_ib_destroy_flow(struct mlx4_dev *dev, u64 reg_id)
^~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1762:12: error: invalid storage class for function
'mlx4_ib_tunnel_steer_add'
static int mlx4_ib_tunnel_steer_add(struct ib_qp *qp, struct ib_flow_attr *flow_attr,
^~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1787:12: error: invalid storage class for function
'mlx4_ib_add_dont_trap_rule'
static int mlx4_ib_add_dont_trap_rule(struct mlx4_dev *dev,
^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1837:24: error: invalid storage class for function
'mlx4_ib_create_flow'
static struct ib_flow *mlx4_ib_create_flow(struct ib_qp *qp,
^~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1957:12: error: invalid storage class for function
'mlx4_ib_destroy_flow'
static int mlx4_ib_destroy_flow(struct ib_flow *flow_id)
^~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:1981:12: error: invalid storage class for function
'mlx4_ib_mcg_attach'
static int mlx4_ib_mcg_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
^~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:2043:34: error: invalid storage class for function
'find_gid_entry'
static struct mlx4_ib_gid_entry *find_gid_entry(struct mlx4_ib_qp *qp, u8 *raw)
^~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:2059:12: error: invalid storage class for function
'mlx4_ib_mcg_detach'
static int mlx4_ib_mcg_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
^~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:2122:12: error: invalid storage class for function
'init_node_data'
static int init_node_data(struct mlx4_ib_dev *dev)
^~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:2160:16: error: invalid storage class for function
'show_hca'
static ssize_t show_hca(struct device *device, struct device_attribute *attr,
^~~~~~~~
drivers/infiniband/hw/mlx4/main.c:2168:16: error: invalid storage class for function
'show_rev'
static ssize_t show_rev(struct device *device, struct device_attribute *attr,
^~~~~~~~
drivers/infiniband/hw/mlx4/main.c:2176:16: error: invalid storage class for function
'show_board'
static ssize_t show_board(struct device *device, struct device_attribute *attr,
^~~~~~~~~~
In file included from include/linux/kobject.h:21:0,
from include/linux/module.h:17,
from drivers/infiniband/hw/mlx4/main.c:34:
drivers/infiniband/hw/mlx4/main.c:2185:39: error: initializer element is not constant
static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
^
include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
.show = _show, \
^~~~~
vim +569 drivers/infiniband/hw/mlx4/main.c
431
432 static int mlx4_ib_query_device(struct ib_device *ibdev,
433 struct ib_device_attr *props,
434 struct ib_udata *uhw)
435 {
436 struct mlx4_ib_dev *dev = to_mdev(ibdev);
437 struct ib_smp *in_mad = NULL;
438 struct ib_smp *out_mad = NULL;
439 int err;
440 int have_ib_ports;
441 struct mlx4_uverbs_ex_query_device cmd;
442 struct mlx4_uverbs_ex_query_device_resp resp = {.comp_mask = 0};
443 struct mlx4_clock_params clock_params;
444
445 if (uhw->inlen) {
446 if (uhw->inlen < sizeof(cmd))
447 return -EINVAL;
448
449 err = ib_copy_from_udata(&cmd, uhw, sizeof(cmd));
450 if (err)
451 return err;
452
453 if (cmd.comp_mask)
454 return -EINVAL;
455
456 if (cmd.reserved)
457 return -EINVAL;
458 }
459
460 resp.response_length = offsetof(typeof(resp), response_length) +
461 sizeof(resp.response_length);
462 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
463 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
464 err = -ENOMEM;
465 if (!in_mad || !out_mad)
466 goto out;
467
468 init_query_mad(in_mad);
469 in_mad->attr_id = IB_SMP_ATTR_NODE_INFO;
470
471 err = mlx4_MAD_IFC(to_mdev(ibdev), MLX4_MAD_IFC_IGNORE_KEYS,
472 1, NULL, NULL, in_mad, out_mad);
473 if (err)
474 goto out;
475
476 memset(props, 0, sizeof *props);
477
478 have_ib_ports = num_ib_ports(dev->dev);
479
480 props->fw_ver = dev->dev->caps.fw_ver;
481 props->device_cap_flags = IB_DEVICE_CHANGE_PHY_PORT |
482 IB_DEVICE_PORT_ACTIVE_EVENT |
483 IB_DEVICE_SYS_IMAGE_GUID |
484 IB_DEVICE_RC_RNR_NAK_GEN |
485 IB_DEVICE_BLOCK_MULTICAST_LOOPBACK;
486 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_PKEY_CNTR)
487 props->device_cap_flags |= IB_DEVICE_BAD_PKEY_CNTR;
488 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BAD_QKEY_CNTR)
489 props->device_cap_flags |= IB_DEVICE_BAD_QKEY_CNTR;
490 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_APM &&
have_ib_ports)
491 props->device_cap_flags |= IB_DEVICE_AUTO_PATH_MIG;
492 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UD_AV_PORT)
493 props->device_cap_flags |= IB_DEVICE_UD_AV_PORT_ENFORCE;
494 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_IPOIB_CSUM)
495 props->device_cap_flags |= IB_DEVICE_UD_IP_CSUM;
496 if (dev->dev->caps.max_gso_sz &&
497 (dev->dev->rev_id != MLX4_IB_CARD_REV_A0) &&
498 (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_BLH))
499 props->device_cap_flags |= IB_DEVICE_UD_TSO;
500 if (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_RESERVED_LKEY)
501 props->device_cap_flags |= IB_DEVICE_LOCAL_DMA_LKEY;
502 if ((dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_LOCAL_INV) &&
503 (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_REMOTE_INV) &&
504 (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_FAST_REG_WR))
505 props->device_cap_flags |= IB_DEVICE_MEM_MGT_EXTENSIONS;
506 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_XRC)
507 props->device_cap_flags |= IB_DEVICE_XRC;
508 if (dev->dev->caps.flags & MLX4_DEV_CAP_FLAG_MEM_WINDOW)
509 props->device_cap_flags |= IB_DEVICE_MEM_WINDOW;
510 if (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_TYPE_2_WIN) {
511 if (dev->dev->caps.bmme_flags & MLX4_BMME_FLAG_WIN_TYPE_2B)
512 props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2B;
513 else
514 props->device_cap_flags |= IB_DEVICE_MEM_WINDOW_TYPE_2A;
515 }
516 if (dev->steering_support == MLX4_STEERING_MODE_DEVICE_MANAGED)
517 props->device_cap_flags |= IB_DEVICE_MANAGED_FLOW_STEERING;
518
519 props->device_cap_flags |= IB_DEVICE_RAW_IP_CSUM;
520
521 props->vendor_id = be32_to_cpup((__be32 *) (out_mad->data + 36)) &
522 0xffffff;
523 props->vendor_part_id = dev->dev->persist->pdev->device;
524 props->hw_ver = be32_to_cpup((__be32 *) (out_mad->data + 32));
525 memcpy(&props->sys_image_guid, out_mad->data + 4, 8);
526
527 props->max_mr_size = ~0ull;
528 props->page_size_cap = dev->dev->caps.page_size_cap;
529 props->max_qp = dev->dev->quotas.qp;
530 props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE;
531 props->max_sge = min(dev->dev->caps.max_sq_sg,
532 dev->dev->caps.max_rq_sg);
533 props->max_sge_rd = MLX4_MAX_SGE_RD;
534 props->max_cq = dev->dev->quotas.cq;
535 props->max_cqe = dev->dev->caps.max_cqes;
536 props->max_mr = dev->dev->quotas.mpt;
537 props->max_pd = dev->dev->caps.num_pds -
dev->dev->caps.reserved_pds;
538 props->max_qp_rd_atom = dev->dev->caps.max_qp_dest_rdma;
539 props->max_qp_init_rd_atom = dev->dev->caps.max_qp_init_rdma;
540 props->max_res_rd_atom = props->max_qp_rd_atom * props->max_qp;
541 props->max_srq = dev->dev->quotas.srq;
542 props->max_srq_wr = dev->dev->caps.max_srq_wqes - 1;
543 props->max_srq_sge = dev->dev->caps.max_srq_sge;
544 props->max_fast_reg_page_list_len = MLX4_MAX_FAST_REG_PAGES;
545 props->local_ca_ack_delay = dev->dev->caps.local_ca_ack_delay;
546 props->atomic_cap = dev->dev->caps.flags &
MLX4_DEV_CAP_FLAG_ATOMIC ?
547 IB_ATOMIC_HCA : IB_ATOMIC_NONE;
548 props->masked_atomic_cap = props->atomic_cap;
549 props->max_pkeys = dev->dev->caps.pkey_table_len[1];
550 props->max_mcast_grp = dev->dev->caps.num_mgms +
dev->dev->caps.num_amgms;
551 props->max_mcast_qp_attach = dev->dev->caps.num_qp_per_mgm;
552 props->max_total_mcast_qp_attach = props->max_mcast_qp_attach *
553 props->max_mcast_grp;
554 props->max_map_per_fmr = dev->dev->caps.max_fmr_maps;
555 props->hca_core_clock = dev->dev->caps.hca_core_clock * 1000UL;
556 props->timestamp_mask = 0xFFFFFFFFFFFFULL;
557 props->max_ah = INT_MAX;
558
559 if ((dev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS) &&
560 (mlx4_ib_port_link_layer(ibdev, 1) == IB_LINK_LAYER_ETHERNET ||
561 mlx4_ib_port_link_layer(ibdev, 2) == IB_LINK_LAYER_ETHERNET)) {
562 props->rss_caps.max_rwq_indirection_tables = props->max_qp;
563 props->rss_caps.max_rwq_indirection_table_size =
564 dev->dev->caps.max_rss_tbl_sz;
565 props->rss_caps.supported_qpts = 1 << IB_QPT_RAW_PACKET;
566 props->max_wq_type_rq = props->max_qp;
567 }
568
569 <<<<<<< HEAD
570 if
(!mlx4_is_slave(dev->dev))
571 err = mlx4_get_internal_clock_params(dev->dev, &clock_params);
572
573 if (uhw->outlen >= resp.response_length +
sizeof(resp.hca_core_clock_offset)) {
574 resp.response_length += sizeof(resp.hca_core_clock_offset);
575 if (!err && !mlx4_is_slave(dev->dev)) {
576 resp.comp_mask |= QUERY_DEVICE_RESP_MASK_TIMESTAMP;
577 =======
578 props->cq_caps.max_cq_moderation_count = MLX4_MAX_CQ_COUNT;
579 props->cq_caps.max_cq_moderation_period = MLX4_MAX_CQ_PERIOD;
580
581 if (uhw->outlen >= resp.response_length +
sizeof(resp.hca_core_clock_offset)) {
582 resp.response_length += sizeof(resp.hca_core_clock_offset);
583 if (!mlx4_get_internal_clock_params(dev->dev, &clock_params)) {
584 resp.comp_mask |=
MLX4_IB_QUERY_DEV_RESP_MASK_CORE_CLOCK_OFFSET;
585 >>>>>>> 2300706ca2f6 (RDMA/mlx4: Do not map the core_clock page
to user space unless enabled)
586 resp.hca_core_clock_offset =
clock_params.offset % PAGE_SIZE;
587 }
588 }
589
590 if (uhw->outlen >= resp.response_length +
591 sizeof(resp.max_inl_recv_sz)) {
592 resp.response_length += sizeof(resp.max_inl_recv_sz);
593 resp.max_inl_recv_sz = dev->dev->caps.max_rq_sg *
594 sizeof(struct mlx4_wqe_data_seg);
595 }
596
597 if (uhw->outlen) {
598 err = ib_copy_to_udata(uhw, &resp, resp.response_length);
599 if (err)
600 goto out;
601 }
602 out:
603 kfree(in_mad);
604 kfree(out_mad);
605
606 return err;
607 }
608
609 static enum rdma_link_layer
610 mlx4_ib_port_link_layer(struct ib_device *device, u8 port_num)
611 {
612 struct mlx4_dev *dev = to_mdev(device)->dev;
613
614 return dev->caps.port_mask[port_num] == MLX4_PORT_TYPE_IB ?
615 IB_LINK_LAYER_INFINIBAND : IB_LINK_LAYER_ETHERNET;
616 }
617
618 static int ib_link_query_port(struct ib_device *ibdev, u8 port,
619 struct ib_port_attr *props, int netw_view)
620 {
621 struct ib_smp *in_mad = NULL;
622 struct ib_smp *out_mad = NULL;
623 int ext_active_speed;
624 int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS;
625 int err = -ENOMEM;
626
627 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
628 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
629 if (!in_mad || !out_mad)
630 goto out;
631
632 init_query_mad(in_mad);
633 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO;
634 in_mad->attr_mod = cpu_to_be32(port);
635
636 if (mlx4_is_mfunc(to_mdev(ibdev)->dev) && netw_view)
637 mad_ifc_flags |= MLX4_MAD_IFC_NET_VIEW;
638
639 err = mlx4_MAD_IFC(to_mdev(ibdev), mad_ifc_flags, port, NULL, NULL,
640 in_mad, out_mad);
641 if (err)
642 goto out;
643
644
645 props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16));
646 props->lmc = out_mad->data[34] & 0x7;
647 props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18));
648 props->sm_sl = out_mad->data[36] & 0xf;
649 props->state = out_mad->data[32] & 0xf;
650 props->phys_state = out_mad->data[33] >> 4;
651 props->port_cap_flags = be32_to_cpup((__be32 *) (out_mad->data + 20));
652 if (netw_view)
653 props->gid_tbl_len = out_mad->data[50];
654 else
655 props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port];
656 props->max_msg_sz = to_mdev(ibdev)->dev->caps.max_msg_sz;
657 props->pkey_tbl_len = to_mdev(ibdev)->dev->caps.pkey_table_len[port];
658 props->bad_pkey_cntr = be16_to_cpup((__be16 *) (out_mad->data + 46));
659 props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48));
660 props->active_width = out_mad->data[31] & 0xf;
661 props->active_speed = out_mad->data[35] >> 4;
662 props->max_mtu = out_mad->data[41] & 0xf;
663 props->active_mtu = out_mad->data[36] >> 4;
664 props->subnet_timeout = out_mad->data[51] & 0x1f;
665 props->max_vl_num = out_mad->data[37] >> 4;
666 props->init_type_reply = out_mad->data[41] >> 4;
667
668 /* Check if extended speeds (EDR/FDR/...) are supported */
669 if (props->port_cap_flags & IB_PORT_EXTENDED_SPEEDS_SUP) {
670 ext_active_speed = out_mad->data[62] >> 4;
671
672 switch (ext_active_speed) {
673 case 1:
674 props->active_speed = IB_SPEED_FDR;
675 break;
676 case 2:
677 props->active_speed = IB_SPEED_EDR;
678 break;
679 }
680 }
681
682 /* If reported active speed is QDR, check if is FDR-10 */
683 if (props->active_speed == IB_SPEED_QDR) {
684 init_query_mad(in_mad);
685 in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO;
686 in_mad->attr_mod = cpu_to_be32(port);
687
688 err = mlx4_MAD_IFC(to_mdev(ibdev), mad_ifc_flags, port,
689 NULL, NULL, in_mad, out_mad);
690 if (err)
691 goto out;
692
693 /* Checking LinkSpeedActive for FDR-10 */
694 if (out_mad->data[15] & 0x1)
695 props->active_speed = IB_SPEED_FDR10;
696 }
697
698 /* Avoid wrong speed value returned by FW if the IB link is down. */
699 if (props->state == IB_PORT_DOWN)
700 props->active_speed = IB_SPEED_SDR;
701
702 out:
703 kfree(in_mad);
704 kfree(out_mad);
705 return err;
706 }
707
708 static u8 state_to_phys_state(enum ib_port_state state)
709 {
710 return state == IB_PORT_ACTIVE ? 5 : 3;
711 }
712
713 static int eth_link_query_port(struct ib_device *ibdev, u8 port,
714 struct ib_port_attr *props)
715 {
716
717 struct mlx4_ib_dev *mdev = to_mdev(ibdev);
718 struct mlx4_ib_iboe *iboe = &mdev->iboe;
719 struct net_device *ndev;
720 enum ib_mtu tmp;
721 struct mlx4_cmd_mailbox *mailbox;
722 int err = 0;
723 int is_bonded = mlx4_is_bonded(mdev->dev);
724
725 mailbox = mlx4_alloc_cmd_mailbox(mdev->dev);
726 if (IS_ERR(mailbox))
727 return PTR_ERR(mailbox);
728
729 err = mlx4_cmd_box(mdev->dev, 0, mailbox->dma, port, 0,
730 MLX4_CMD_QUERY_PORT, MLX4_CMD_TIME_CLASS_B,
731 MLX4_CMD_WRAPPED);
732 if (err)
733 goto out;
734
735 props->active_width = (((u8 *)mailbox->buf)[5] == 0x40) ||
736 (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
737 IB_WIDTH_4X : IB_WIDTH_1X;
738 props->active_speed = (((u8 *)mailbox->buf)[5] == 0x20 /*56Gb*/) ?
739 IB_SPEED_FDR : IB_SPEED_QDR;
740 props->port_cap_flags = IB_PORT_CM_SUP | IB_PORT_IP_BASED_GIDS;
741 props->gid_tbl_len = mdev->dev->caps.gid_table_len[port];
742 props->max_msg_sz = mdev->dev->caps.max_msg_sz;
743 props->pkey_tbl_len = 1;
744 props->max_mtu = IB_MTU_4096;
745 props->max_vl_num = 2;
746 props->state = IB_PORT_DOWN;
747 props->phys_state = state_to_phys_state(props->state);
748 props->active_mtu = IB_MTU_256;
749 spin_lock_bh(&iboe->lock);
750 ndev = iboe->netdevs[port - 1];
751 if (ndev && is_bonded) {
752 rcu_read_lock(); /* required to get upper dev */
753 ndev = netdev_master_upper_dev_get_rcu(ndev);
754 rcu_read_unlock();
755 }
756 if (!ndev)
757 goto out_unlock;
758
759 tmp = iboe_get_mtu(ndev->mtu);
760 props->active_mtu = tmp ? min(props->max_mtu, tmp) : IB_MTU_256;
761
762 props->state = (netif_running(ndev) && netif_carrier_ok(ndev)) ?
763 IB_PORT_ACTIVE : IB_PORT_DOWN;
764 props->phys_state = state_to_phys_state(props->state);
765 out_unlock:
766 spin_unlock_bh(&iboe->lock);
767 out:
768 mlx4_free_cmd_mailbox(mdev->dev, mailbox);
769 return err;
770 }
771
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org