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

RDMA/nldev: Expose port_cap_flags2

port_cap_flags2 represents IBTA PortInfo:CapabilityMask2.

The field safely extends the RDMA_NLDEV_ATTR_CAP_FLAGS operand as it was
exported as 64 bit to allow this kind of extension.

Signed-off-by: Michael Guralnik <michaelgur@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

authored by

Michael Guralnik and committed by
Jason Gunthorpe
4fa2813d 2e8039c6

+9 -3
+6 -3
drivers/infiniband/core/nldev.c
··· 227 227 struct net_device *netdev = NULL; 228 228 struct ib_port_attr attr; 229 229 int ret; 230 + u64 cap_flags = 0; 230 231 231 232 if (fill_nldev_handle(msg, device)) 232 233 return -EMSGSIZE; ··· 240 239 return ret; 241 240 242 241 if (rdma_protocol_ib(device, port)) { 243 - BUILD_BUG_ON(sizeof(attr.port_cap_flags) > sizeof(u64)); 242 + BUILD_BUG_ON((sizeof(attr.port_cap_flags) + 243 + sizeof(attr.port_cap_flags2)) > sizeof(u64)); 244 + cap_flags = attr.port_cap_flags | 245 + ((u64)attr.port_cap_flags2 << 32); 244 246 if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_CAP_FLAGS, 245 - (u64)attr.port_cap_flags, 246 - RDMA_NLDEV_ATTR_PAD)) 247 + cap_flags, RDMA_NLDEV_ATTR_PAD)) 247 248 return -EMSGSIZE; 248 249 if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_SUBNET_PREFIX, 249 250 attr.subnet_prefix, RDMA_NLDEV_ATTR_PAD))
+3
include/uapi/rdma/rdma_netlink.h
··· 283 283 284 284 /* 285 285 * Device and port capabilities 286 + * 287 + * When used for port info, first 32-bits are CapabilityMask followed by 288 + * 16-bit CapabilityMask2. 286 289 */ 287 290 RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */ 288 291