IB/mlx5: Extend query_device/port to support RoCE
Hello Achiad Shochat,
The patch 3f89a643eb29: "IB/mlx5: Extend query_device/port to support RoCE" from Dec 23, 2015, leads to the following static checker warning:
drivers/infiniband/hw/mlx5/main.c:149 mlx5_query_port_roce() warn: passing casted pointer '&props->qkey_viol_cntr' to 'mlx5_query_nic_vport_qkey_viol_cntr()' 32 vs 16.
drivers/infiniband/hw/mlx5/main.c
129 static int mlx5_query_port_roce(struct ib_device *device, u8 port_num,
130 struct ib_port_attr *props)
131 {
132 struct mlx5_ib_dev *dev = to_mdev(device);
133 struct net_device *ndev;
134 enum ib_mtu ndev_ib_mtu;
135
136 memset(props, 0, sizeof(*props));
137
138 props->port_cap_flags |= IB_PORT_CM_SUP;
139 props->port_cap_flags |= IB_PORT_IP_BASED_GIDS;
140
141 props->gid_tbl_len = MLX5_CAP_ROCE(dev->mdev,
142 roce_address_table_size);
143 props->max_mtu = IB_MTU_4096;
144 props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg);
145 props->pkey_tbl_len = 1;
146 props->state = IB_PORT_DOWN;
147 props->phys_state = 3;
148
149 mlx5_query_nic_vport_qkey_viol_cntr(dev->mdev,
150 (u16 *)&props->qkey_viol_cntr);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^This will break on big endian systems.
151 152 ndev = mlx5_ib_get_netdev(device, port_num); 153 if (!ndev) 154 return 0; 155
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Dan Carpenter
Hello Achiad Shochat,
The patch
3f89a643eb29: "IB/mlx5: Extend query_device/port to support RoCE" from Dec 23, 2015, leads to the following static checker warning:drivers/infiniband/hw/mlx5/main.c:149 mlx5_query_port_roce() warn: passing casted pointer '&props->qkey_viol_cntr' to 'mlx5_query_nic_vport_qkey_viol_cntr()' 32 vs 16.
Thanks for spotting it to us.
I sent patch which should eliminate that warning and expected to work correctly on big endian systems too [1].
[1] https://patchwork.kernel.org/patch/7992081/
Quoted 33 lines
drivers/infiniband/hw/mlx5/main.c
129 static int mlx5_query_port_roce(structib_device*device, u8port_num,
130 structib_port_attr*props)131 { 132 struct mlx5_ib_dev *dev = to_mdev(device); 133 struct net_device *ndev; 134 enum ib_mtu ndev_ib_mtu; 135 136 memset(props, 0, sizeof(*props)); 137 138 props->port_cap_flags |= IB_PORT_CM_SUP; 139 props->port_cap_flags |= IB_PORT_IP_BASED_GIDS; 140 141 props->gid_tbl_len = MLX5_CAP_ROCE(dev->mdev, 142 roce_address_table_size); 143 props->max_mtu = IB_MTU_4096; 144 props->max_msg_sz = 1 << MLX5_CAP_GEN(dev->mdev, log_max_msg); 145 props->pkey_tbl_len = 1; 146 props->state = IB_PORT_DOWN; 147 props->phys_state = 3; 148 149 mlx5_query_nic_vport_qkey_viol_cntr(dev->mdev, 150 (u16 *)&props->qkey_viol_cntr); ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^This will break on big endian systems.
151 152 ndev = mlx5_ib_get_netdev(device, port_num); 153 if (!ndev) 154 return 0; 155
Quoted 6 lines
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html