Re: [PATCH rdma-next] RDMA/mlx5: Fix definition of mlx5_ib_create_qp_resp

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Jason,

I love your patch! Yet something to improve:

[auto build test ERROR on rdma/for-next]
[also build test ERROR on v4.16 next-20180329]
[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/Leon-Romanovsky/RDMA-mlx5-Fix-definition-of-mlx5_ib_create_qp_resp/20180403-134735
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next
config: xtensa-allmodconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 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
        make.cross ARCH=xtensa 

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

   In file included from include/linux/list.h:9:0,
                    from include/linux/module.h:9,
                    from drivers/infiniband/hw/mlx5/qp.c:33:
   drivers/infiniband/hw/mlx5/qp.c: In function 'create_rss_raw_qp_tir':
>> drivers/infiniband/hw/mlx5/qp.c:1471:65: error: invalid type argument of unary '*' (have 'struct mlx5_ib_create_qp_resp')
     err = ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(*resp)));
                                                                    ^~
   include/linux/kernel.h:791:2: note: in definition of macro '__min'
     t2 min2 = (y);     \
     ^~
>> drivers/infiniband/hw/mlx5/qp.c:1471:39: note: in expansion of macro 'min'
     err = ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(*resp)));
                                          ^~~
>> drivers/infiniband/hw/mlx5/qp.c:1471:65: error: invalid type argument of unary '*' (have 'struct mlx5_ib_create_qp_resp')
     err = ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(*resp)));
                                                                    ^~
   include/linux/kernel.h:791:13: note: in definition of macro '__min'
     t2 min2 = (y);     \
                ^
>> drivers/infiniband/hw/mlx5/qp.c:1471:39: note: in expansion of macro 'min'
     err = ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(*resp)));
                                          ^~~
   include/linux/kernel.h:792:16: warning: comparison of distinct pointer types lacks a cast
     (void) (&min1 == &min2);   \
                   ^
   include/linux/kernel.h:801:2: note: in expansion of macro '__min'
     __min(typeof(x), typeof(y),   \
     ^~~~~
>> drivers/infiniband/hw/mlx5/qp.c:1471:39: note: in expansion of macro 'min'
     err = ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(*resp)));
                                          ^~~

vim +1471 drivers/infiniband/hw/mlx5/qp.c

  1400	
  1401	static int create_rss_raw_qp_tir(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
  1402					 struct ib_pd *pd,
  1403					 struct ib_qp_init_attr *init_attr,
  1404					 struct ib_udata *udata)
  1405	{
  1406		struct ib_uobject *uobj = pd->uobject;
  1407		struct ib_ucontext *ucontext = uobj->context;
  1408		struct mlx5_ib_ucontext *mucontext = to_mucontext(ucontext);
  1409		struct mlx5_ib_create_qp_resp resp = {};
  1410		int inlen;
  1411		int err;
  1412		u32 *in;
  1413		void *tirc;
  1414		void *hfso;
  1415		u32 selected_fields = 0;
  1416		size_t min_resp_len;
  1417		u32 tdn = mucontext->tdn;
  1418		struct mlx5_ib_create_qp_rss ucmd = {};
  1419		size_t required_cmd_sz;
  1420	
  1421		if (init_attr->qp_type != IB_QPT_RAW_PACKET)
  1422			return -EOPNOTSUPP;
  1423	
  1424		if (init_attr->create_flags || init_attr->send_cq)
  1425			return -EINVAL;
  1426	
  1427		min_resp_len = offsetof(typeof(resp), bfreg_index) + sizeof(resp.bfreg_index);
  1428		if (udata->outlen < min_resp_len)
  1429			return -EINVAL;
  1430	
  1431		required_cmd_sz = offsetof(typeof(ucmd), flags) + sizeof(ucmd.flags);
  1432		if (udata->inlen < required_cmd_sz) {
  1433			mlx5_ib_dbg(dev, "invalid inlen\n");
  1434			return -EINVAL;
  1435		}
  1436	
  1437		if (udata->inlen > sizeof(ucmd) &&
  1438		    !ib_is_udata_cleared(udata, sizeof(ucmd),
  1439					 udata->inlen - sizeof(ucmd))) {
  1440			mlx5_ib_dbg(dev, "inlen is not supported\n");
  1441			return -EOPNOTSUPP;
  1442		}
  1443	
  1444		if (ib_copy_from_udata(&ucmd, udata, min(sizeof(ucmd), udata->inlen))) {
  1445			mlx5_ib_dbg(dev, "copy failed\n");
  1446			return -EFAULT;
  1447		}
  1448	
  1449		if (ucmd.comp_mask) {
  1450			mlx5_ib_dbg(dev, "invalid comp mask\n");
  1451			return -EOPNOTSUPP;
  1452		}
  1453	
  1454		if (ucmd.flags & ~MLX5_QP_FLAG_TUNNEL_OFFLOADS) {
  1455			mlx5_ib_dbg(dev, "invalid flags\n");
  1456			return -EOPNOTSUPP;
  1457		}
  1458	
  1459		if (ucmd.flags & MLX5_QP_FLAG_TUNNEL_OFFLOADS &&
  1460		    !tunnel_offload_supported(dev->mdev)) {
  1461			mlx5_ib_dbg(dev, "tunnel offloads isn't supported\n");
  1462			return -EOPNOTSUPP;
  1463		}
  1464	
  1465		if (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_INNER &&
  1466		    !(ucmd.flags & MLX5_QP_FLAG_TUNNEL_OFFLOADS)) {
  1467			mlx5_ib_dbg(dev, "Tunnel offloads must be set for inner RSS\n");
  1468			return -EOPNOTSUPP;
  1469		}
  1470	
> 1471		err = ib_copy_to_udata(udata, &resp, min(udata->outlen, sizeof(*resp)));
  1472		if (err) {
  1473			mlx5_ib_dbg(dev, "copy failed\n");
  1474			return -EINVAL;
  1475		}
  1476	
  1477		inlen = MLX5_ST_SZ_BYTES(create_tir_in);
  1478		in = kvzalloc(inlen, GFP_KERNEL);
  1479		if (!in)
  1480			return -ENOMEM;
  1481	
  1482		tirc = MLX5_ADDR_OF(create_tir_in, in, ctx);
  1483		MLX5_SET(tirc, tirc, disp_type,
  1484			 MLX5_TIRC_DISP_TYPE_INDIRECT);
  1485		MLX5_SET(tirc, tirc, indirect_table,
  1486			 init_attr->rwq_ind_tbl->ind_tbl_num);
  1487		MLX5_SET(tirc, tirc, transport_domain, tdn);
  1488	
  1489		hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer);
  1490	
  1491		if (ucmd.flags & MLX5_QP_FLAG_TUNNEL_OFFLOADS)
  1492			MLX5_SET(tirc, tirc, tunneled_offload_en, 1);
  1493	
  1494		if (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_INNER)
  1495			hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_inner);
  1496		else
  1497			hfso = MLX5_ADDR_OF(tirc, tirc, rx_hash_field_selector_outer);
  1498	
  1499		switch (ucmd.rx_hash_function) {
  1500		case MLX5_RX_HASH_FUNC_TOEPLITZ:
  1501		{
  1502			void *rss_key = MLX5_ADDR_OF(tirc, tirc, rx_hash_toeplitz_key);
  1503			size_t len = MLX5_FLD_SZ_BYTES(tirc, rx_hash_toeplitz_key);
  1504	
  1505			if (len != ucmd.rx_key_len) {
  1506				err = -EINVAL;
  1507				goto err;
  1508			}
  1509	
  1510			MLX5_SET(tirc, tirc, rx_hash_fn, MLX5_RX_HASH_FN_TOEPLITZ);
  1511			MLX5_SET(tirc, tirc, rx_hash_symmetric, 1);
  1512			memcpy(rss_key, ucmd.rx_hash_key, len);
  1513			break;
  1514		}
  1515		default:
  1516			err = -EOPNOTSUPP;
  1517			goto err;
  1518		}
  1519	
  1520		if (!ucmd.rx_hash_fields_mask) {
  1521			/* special case when this TIR serves as steering entry without hashing */
  1522			if (!init_attr->rwq_ind_tbl->log_ind_tbl_size)
  1523				goto create_tir;
  1524			err = -EINVAL;
  1525			goto err;
  1526		}
  1527	
  1528		if (((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_IPV4) ||
  1529		     (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_IPV4)) &&
  1530		     ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_IPV6) ||
  1531		     (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_IPV6))) {
  1532			err = -EINVAL;
  1533			goto err;
  1534		}
  1535	
  1536		/* If none of IPV4 & IPV6 SRC/DST was set - this bit field is ignored */
  1537		if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_IPV4) ||
  1538		    (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_IPV4))
  1539			MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
  1540				 MLX5_L3_PROT_TYPE_IPV4);
  1541		else if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_IPV6) ||
  1542			 (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_IPV6))
  1543			MLX5_SET(rx_hash_field_select, hfso, l3_prot_type,
  1544				 MLX5_L3_PROT_TYPE_IPV6);
  1545	
  1546		if (((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_PORT_TCP) ||
  1547		     (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_PORT_TCP)) &&
  1548		     ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_PORT_UDP) ||
  1549		     (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_PORT_UDP))) {
  1550			err = -EINVAL;
  1551			goto err;
  1552		}
  1553	
  1554		/* If none of TCP & UDP SRC/DST was set - this bit field is ignored */
  1555		if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_PORT_TCP) ||
  1556		    (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_PORT_TCP))
  1557			MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
  1558				 MLX5_L4_PROT_TYPE_TCP);
  1559		else if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_PORT_UDP) ||
  1560			 (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_PORT_UDP))
  1561			MLX5_SET(rx_hash_field_select, hfso, l4_prot_type,
  1562				 MLX5_L4_PROT_TYPE_UDP);
  1563	
  1564		if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_IPV4) ||
  1565		    (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_IPV6))
  1566			selected_fields |= MLX5_HASH_FIELD_SEL_SRC_IP;
  1567	
  1568		if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_IPV4) ||
  1569		    (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_IPV6))
  1570			selected_fields |= MLX5_HASH_FIELD_SEL_DST_IP;
  1571	
  1572		if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_PORT_TCP) ||
  1573		    (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_SRC_PORT_UDP))
  1574			selected_fields |= MLX5_HASH_FIELD_SEL_L4_SPORT;
  1575	
  1576		if ((ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_PORT_TCP) ||
  1577		    (ucmd.rx_hash_fields_mask & MLX5_RX_HASH_DST_PORT_UDP))
  1578			selected_fields |= MLX5_HASH_FIELD_SEL_L4_DPORT;
  1579	
  1580		MLX5_SET(rx_hash_field_select, hfso, selected_fields, selected_fields);
  1581	
  1582	create_tir:
  1583		if (dev->rep)
  1584			MLX5_SET(tirc, tirc, self_lb_block,
  1585				 MLX5_TIRC_SELF_LB_BLOCK_BLOCK_UNICAST_);
  1586	
  1587		err = mlx5_core_create_tir(dev->mdev, in, inlen, &qp->rss_qp.tirn);
  1588	
  1589		if (err)
  1590			goto err;
  1591	
  1592		kvfree(in);
  1593		/* qpn is reserved for that QP */
  1594		qp->trans_qp.base.mqp.qpn = 0;
  1595		qp->flags |= MLX5_IB_QP_RSS;
  1596		return 0;
  1597	
  1598	err:
  1599		kvfree(in);
  1600		return err;
  1601	}
  1602	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux