Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

RDMA/siw: Fix setting active_{speed, width} attributes

Make sure to set the active_{speed, width} attributes to avoid reporting
the same values regardless of the underlying device.

Fixes: 303ae1cdfdf7 ("rdma/siw: application interface")
Link: https://lore.kernel.org/r/20200218095911.26614-1-kamalheib1@gmail.com
Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Tested-by: Bernard Metzler <bmt@zurich.ibm.com>
Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Kamal Heib and committed by
Jason Gunthorpe
25baba21 65a16620

+4 -3
+4 -3
drivers/infiniband/sw/siw/siw_verbs.c
··· 165 165 struct ib_port_attr *attr) 166 166 { 167 167 struct siw_device *sdev = to_siw_dev(base_dev); 168 + int rv; 168 169 169 170 memset(attr, 0, sizeof(*attr)); 170 171 171 - attr->active_speed = 2; 172 - attr->active_width = 2; 172 + rv = ib_get_eth_speed(base_dev, port, &attr->active_speed, 173 + &attr->active_width); 173 174 attr->gid_tbl_len = 1; 174 175 attr->max_msg_sz = -1; 175 176 attr->max_mtu = ib_mtu_int_to_enum(sdev->netdev->mtu); ··· 193 192 * attr->subnet_timeout = 0; 194 193 * attr->init_type_repy = 0; 195 194 */ 196 - return 0; 195 + return rv; 197 196 } 198 197 199 198 int siw_get_port_immutable(struct ib_device *base_dev, u8 port,