Hi Lijun, I love your patch! Perhaps something to improve: [auto build test WARNING on rdma/for-next] [also build test WARNING on v4.18-rc3 next-20180702] [cannot apply to linus/master linux-sof-driver/master] [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/Lijun-Ou/Four-cmd-queues-support-for-hip08/20180703-104144 base: https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git for-next reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 [usertype] *val @@ got restricted __be32 [usertype] *val @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37: expected restricted __be32 [usertype] *val drivers/infiniband/hw/hns/hns_roce_hw_v2.c:522:37: got restricted __le32 [usertype] *<noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:843:18: sparse: restricted __le16 degrades to integer drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [unsigned] [usertype] desc_ret @@ got short [unsigned] [usertype] desc_ret @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34: expected unsigned short [unsigned] [usertype] desc_ret drivers/infiniband/hw/hns/hns_roce_hw_v2.c:860:34: got restricted __le16 [usertype] retval drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:899:26: sparse: cast from restricted __le16 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:900:29: sparse: cast from restricted __le16 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1276:44: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] base_addr_l @@ got __le32 [usertype] base_addr_l @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1276:44: expected restricted __le32 [usertype] base_addr_l drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1276:44: got unsigned long long drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1277:44: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] base_addr_h @@ got __le32 [usertype] base_addr_h @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1277:44: expected restricted __le32 [usertype] base_addr_h drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1277:44: got unsigned long long drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1287:42: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] head_ba_l @@ got unsignrestricted __le32 [usertype] head_ba_l @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1287:42: expected restricted __le32 [usertype] head_ba_l drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1287:42: got unsigned int [unsigned] [usertype] blk_ba0 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1288:49: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] head_ba_h_nxtptr @@ got unsignrestricted __le32 [usertype] head_ba_h_nxtptr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1288:49: expected restricted __le32 [usertype] head_ba_h_nxtptr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1288:49: got unsigned int [unsigned] [usertype] blk_ba1_nxt_ptr drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1293:42: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] tail_ba_l @@ got unsignrestricted __le32 [usertype] tail_ba_l @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1293:42: expected restricted __le32 [usertype] tail_ba_l drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1293:42: got unsigned int [unsigned] [usertype] blk_ba0 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1346:18: sparse: expression using sizeof(void) drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1346:18: sparse: expression using sizeof(void) include/linux/slab.h:631:13: sparse: undefined identifier '__builtin_mul_overflow' drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1491:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1491:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1493:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1493:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1495:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1495:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1497:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1497:9: sparse: invalid assignment: |= >> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1620:28: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] vf_smac_l @@ got unsigned int [unsrestricted __le32 [usertype] vf_smac_l @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1650:39: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1664:39: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1670:36: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1687:38: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1713:36: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1725:38: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1772:33: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1879:38: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1884:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] cqe_cur_blk_addr @@ got unsignrestricted __le32 [usertype] cqe_cur_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1886:33: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1888:9: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1897:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] cqe_nxt_blk_addr @@ got unsignrestricted __le32 [usertype] cqe_nxt_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1898:9: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1911:28: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] cqe_ba @@ got unsignrestricted __le32 [usertype] cqe_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1924:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] db_record_addr @@ got __le32 [usertype] db_record_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1952:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1952:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1954:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1954:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1956:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1956:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1959:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1959:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1961:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1961:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1964:28: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 [usertype] *val @@ got 2 [usertype] *val @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1988:24: sparse: expression using sizeof(void) drivers/infiniband/hw/hns/hns_roce_hw_v2.c:1988:24: sparse: expression using sizeof(void) drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2559:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] qkey_xrcd @@ got unsigned intrestricted __le32 [usertype] qkey_xrcd @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2578:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] rq_db_record_addr @@ got __le32 [usertype] rq_db_record_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2891:36: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] qkey_xrcd @@ got unsigned intrestricted __le32 [usertype] qkey_xrcd @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:2966:29: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] wqe_sge_ba @@ got unsignrestricted __le32 [usertype] wqe_sge_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3029:34: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] rq_cur_blk_addr @@ got unsignrestricted __le32 [usertype] rq_cur_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3042:34: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] rq_nxt_blk_addr @@ got unsignrestricted __le32 [usertype] rq_nxt_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3066:26: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] trrl_ba @@ got unsignrestricted __le32 [usertype] trrl_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3074:26: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] irrl_ba @@ got unsignrestricted __le32 [usertype] irrl_ba @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3085:9: sparse: cast from restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3253:34: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] sq_cur_blk_addr @@ got unsignrestricted __le32 [usertype] sq_cur_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3264:38: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] sq_cur_sge_blk_addr @@ got [usertype] sq_cur_sge_blk_addr @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3279:37: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] rx_sq_cur_blk_addr @@ got unsignrestricted __le32 [usertype] rx_sq_cur_blk_addr @@ include/linux/slab.h:631:13: sparse: not a function <noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3680:28: sparse: incorrect type in assignment (different base types) @@ expected unsigned char [unsigned] [usertype] rnr_retry @@ got d char [unsigned] [usertype] rnr_retry @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3680:28: expected unsigned char [unsigned] [usertype] rnr_retry drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3680:28: got restricted __le32 [usertype] rq_rnr_timer drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3839:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3839:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3839:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3839:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3839:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3839:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3845:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3845:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3845:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3845:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3845:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3845:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3848:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3848:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3848:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3848:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3848:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3848:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:9: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:9: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:9: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3855:9: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3859:28: sparse: incorrect type in argument 1 (different base types) @@ expected restricted __be32 [usertype] *val @@ got 2 [usertype] *val @@ drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3859:28: expected restricted __be32 [usertype] *val drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3859:28: got unsigned int *<noident> drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3870:20: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3901:20: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3938:15: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:3972:15: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4028:17: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4047:30: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4146:20: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4165:23: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4213:13: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4216:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4216:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4216:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4216:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4216:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4216:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4219:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4219:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4219:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4219:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4219:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4219:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4223:20: sparse: cast to restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4226:17: sparse: invalid assignment: &= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4226:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4226:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4226:17: sparse: invalid assignment: |= drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4226:17: left side has type unsigned int drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4226:17: right side has type restricted __le32 drivers/infiniband/hw/hns/hns_roce_hw_v2.c:4229:17: sparse: invalid assignment: &= vim +1620 drivers/infiniband/hw/hns/hns_roce_hw_v2.c 1469 1470 static int hns_roce_v2_post_mbox(struct hns_roce_dev *hr_dev, u64 in_param, 1471 u64 out_param, u32 in_modifier, u8 op_modifier, 1472 u16 op, u16 token, int event) 1473 { 1474 struct device *dev = hr_dev->dev; 1475 u32 __iomem *hcr = (u32 __iomem *)(hr_dev->reg_base + 1476 ROCEE_VF_MB_CFG0_REG); 1477 unsigned long end; 1478 u32 val0 = 0; 1479 u32 val1 = 0; 1480 1481 end = msecs_to_jiffies(HNS_ROCE_V2_GO_BIT_TIMEOUT_MSECS) + jiffies; 1482 while (hns_roce_v2_cmd_pending(hr_dev)) { 1483 if (time_after(jiffies, end)) { 1484 dev_dbg(dev, "jiffies=%d end=%d\n", (int)jiffies, 1485 (int)end); 1486 return -EAGAIN; 1487 } 1488 cond_resched(); 1489 } 1490 > 1491 roce_set_field(val0, HNS_ROCE_VF_MB4_TAG_MASK, 1492 HNS_ROCE_VF_MB4_TAG_SHIFT, in_modifier); 1493 roce_set_field(val0, HNS_ROCE_VF_MB4_CMD_MASK, 1494 HNS_ROCE_VF_MB4_CMD_SHIFT, op); 1495 roce_set_field(val1, HNS_ROCE_VF_MB5_EVENT_MASK, 1496 HNS_ROCE_VF_MB5_EVENT_SHIFT, event); 1497 roce_set_field(val1, HNS_ROCE_VF_MB5_TOKEN_MASK, 1498 HNS_ROCE_VF_MB5_TOKEN_SHIFT, token); 1499 1500 writeq(in_param, hcr + 0); 1501 writeq(out_param, hcr + 2); 1502 1503 /* Memory barrier */ 1504 wmb(); 1505 1506 writel(val0, hcr + 4); 1507 writel(val1, hcr + 5); 1508 1509 mmiowb(); 1510 1511 return 0; 1512 } 1513 1514 static int hns_roce_v2_chk_mbox(struct hns_roce_dev *hr_dev, 1515 unsigned long timeout) 1516 { 1517 struct device *dev = hr_dev->dev; 1518 unsigned long end = 0; 1519 u32 status; 1520 1521 end = msecs_to_jiffies(timeout) + jiffies; 1522 while (hns_roce_v2_cmd_pending(hr_dev) && time_before(jiffies, end)) 1523 cond_resched(); 1524 1525 if (hns_roce_v2_cmd_pending(hr_dev)) { 1526 dev_err(dev, "[cmd_poll]hw run cmd TIMEDOUT!\n"); 1527 return -ETIMEDOUT; 1528 } 1529 1530 status = hns_roce_v2_cmd_complete(hr_dev); 1531 if (status != 0x1) { 1532 dev_err(dev, "mailbox status 0x%x!\n", status); 1533 return -EBUSY; 1534 } 1535 1536 return 0; 1537 } 1538 1539 static int hns_roce_config_sgid_table(struct hns_roce_dev *hr_dev, 1540 int gid_index, const union ib_gid *gid, 1541 enum hns_roce_sgid_type sgid_type) 1542 { 1543 struct hns_roce_cmq_desc desc; 1544 struct hns_roce_cfg_sgid_tb *sgid_tb = 1545 (struct hns_roce_cfg_sgid_tb *)desc.data; 1546 u32 *p; 1547 1548 hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_CFG_SGID_TB, false); 1549 1550 roce_set_field(sgid_tb->table_idx_rsv, 1551 CFG_SGID_TB_TABLE_IDX_M, 1552 CFG_SGID_TB_TABLE_IDX_S, gid_index); 1553 roce_set_field(sgid_tb->vf_sgid_type_rsv, 1554 CFG_SGID_TB_VF_SGID_TYPE_M, 1555 CFG_SGID_TB_VF_SGID_TYPE_S, sgid_type); 1556 1557 p = (u32 *)&gid->raw[0]; 1558 sgid_tb->vf_sgid_l = cpu_to_le32(*p); 1559 1560 p = (u32 *)&gid->raw[4]; 1561 sgid_tb->vf_sgid_ml = cpu_to_le32(*p); 1562 1563 p = (u32 *)&gid->raw[8]; 1564 sgid_tb->vf_sgid_mh = cpu_to_le32(*p); 1565 1566 p = (u32 *)&gid->raw[0xc]; 1567 sgid_tb->vf_sgid_h = cpu_to_le32(*p); 1568 1569 return hns_roce_cmq_send(hr_dev, &desc, 1); 1570 } 1571 1572 static int hns_roce_v2_set_gid(struct hns_roce_dev *hr_dev, u8 port, 1573 int gid_index, const union ib_gid *gid, 1574 const struct ib_gid_attr *attr) 1575 { 1576 enum hns_roce_sgid_type sgid_type = GID_TYPE_FLAG_ROCE_V1; 1577 int ret; 1578 1579 if (!gid || !attr) 1580 return -EINVAL; 1581 1582 if (attr->gid_type == IB_GID_TYPE_ROCE) 1583 sgid_type = GID_TYPE_FLAG_ROCE_V1; 1584 1585 if (attr->gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) { 1586 if (ipv6_addr_v4mapped((void *)gid)) 1587 sgid_type = GID_TYPE_FLAG_ROCE_V2_IPV4; 1588 else 1589 sgid_type = GID_TYPE_FLAG_ROCE_V2_IPV6; 1590 } 1591 1592 ret = hns_roce_config_sgid_table(hr_dev, gid_index, gid, sgid_type); 1593 if (ret) 1594 dev_err(hr_dev->dev, "Configure sgid table failed(%d)!\n", ret); 1595 1596 return ret; 1597 } 1598 1599 static int hns_roce_v2_set_mac(struct hns_roce_dev *hr_dev, u8 phy_port, 1600 u8 *addr) 1601 { 1602 struct hns_roce_cmq_desc desc; 1603 struct hns_roce_cfg_smac_tb *smac_tb = 1604 (struct hns_roce_cfg_smac_tb *)desc.data; 1605 u16 reg_smac_h; 1606 u32 reg_smac_l; 1607 1608 hns_roce_cmq_setup_basic_desc(&desc, HNS_ROCE_OPC_CFG_SMAC_TB, false); 1609 1610 reg_smac_l = *(u32 *)(&addr[0]); 1611 reg_smac_h = *(u16 *)(&addr[4]); 1612 1613 memset(smac_tb, 0, sizeof(*smac_tb)); 1614 roce_set_field(smac_tb->tb_idx_rsv, 1615 CFG_SMAC_TB_IDX_M, 1616 CFG_SMAC_TB_IDX_S, phy_port); 1617 roce_set_field(smac_tb->vf_smac_h_rsv, 1618 CFG_SMAC_TB_VF_SMAC_H_M, 1619 CFG_SMAC_TB_VF_SMAC_H_S, reg_smac_h); > 1620 smac_tb->vf_smac_l = reg_smac_l; 1621 1622 return hns_roce_cmq_send(hr_dev, &desc, 1); 1623 } 1624 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html