mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-08 15:04:45 +00:00
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>
This commit is contained in:
parent
2e8039c656
commit
4fa2813d26
@ -227,6 +227,7 @@ static int fill_port_info(struct sk_buff *msg,
|
|||||||
struct net_device *netdev = NULL;
|
struct net_device *netdev = NULL;
|
||||||
struct ib_port_attr attr;
|
struct ib_port_attr attr;
|
||||||
int ret;
|
int ret;
|
||||||
|
u64 cap_flags = 0;
|
||||||
|
|
||||||
if (fill_nldev_handle(msg, device))
|
if (fill_nldev_handle(msg, device))
|
||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
@ -239,10 +240,12 @@ static int fill_port_info(struct sk_buff *msg,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (rdma_protocol_ib(device, port)) {
|
if (rdma_protocol_ib(device, port)) {
|
||||||
BUILD_BUG_ON(sizeof(attr.port_cap_flags) > sizeof(u64));
|
BUILD_BUG_ON((sizeof(attr.port_cap_flags) +
|
||||||
|
sizeof(attr.port_cap_flags2)) > sizeof(u64));
|
||||||
|
cap_flags = attr.port_cap_flags |
|
||||||
|
((u64)attr.port_cap_flags2 << 32);
|
||||||
if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_CAP_FLAGS,
|
if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_CAP_FLAGS,
|
||||||
(u64)attr.port_cap_flags,
|
cap_flags, RDMA_NLDEV_ATTR_PAD))
|
||||||
RDMA_NLDEV_ATTR_PAD))
|
|
||||||
return -EMSGSIZE;
|
return -EMSGSIZE;
|
||||||
if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_SUBNET_PREFIX,
|
if (nla_put_u64_64bit(msg, RDMA_NLDEV_ATTR_SUBNET_PREFIX,
|
||||||
attr.subnet_prefix, RDMA_NLDEV_ATTR_PAD))
|
attr.subnet_prefix, RDMA_NLDEV_ATTR_PAD))
|
||||||
|
@ -283,6 +283,9 @@ enum rdma_nldev_attr {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Device and port capabilities
|
* Device and port capabilities
|
||||||
|
*
|
||||||
|
* When used for port info, first 32-bits are CapabilityMask followed by
|
||||||
|
* 16-bit CapabilityMask2.
|
||||||
*/
|
*/
|
||||||
RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
|
RDMA_NLDEV_ATTR_CAP_FLAGS, /* u64 */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user