Skip to content

Commit a0c1b2a

Browse files
Eli Cohendledford
authored andcommitted
IB/core: Support accessing SA in virtualized environment
Per the ongoing standardisation process, when virtual HCAs are present in a network, traffic is routed based on a destination GID. In order to access the SA we use the well known SA GID. We also add a GRH required boolean field to the port attributes which is used to report to the verbs consumer whether this port is connected to a virtual network. We use this field to realize whether we need to create an address vector with GRH to access the subnet administrator. We clear the port attributes struct before calling the hardware driver to make sure the default remains that GRH is not required. Signed-off-by: Eli Cohen <eli@mellanox.com> Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent fad61ad commit a0c1b2a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/infiniband/core/sa_query.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,11 @@ static void update_sm_ah(struct work_struct *work)
885885
ah_attr.dlid = port_attr.sm_lid;
886886
ah_attr.sl = port_attr.sm_sl;
887887
ah_attr.port_num = port->port_num;
888+
if (port_attr.grh_required) {
889+
ah_attr.ah_flags = IB_AH_GRH;
890+
ah_attr.grh.dgid.global.subnet_prefix = cpu_to_be64(port_attr.subnet_prefix);
891+
ah_attr.grh.dgid.global.interface_id = cpu_to_be64(IB_SA_WELL_KNOWN_GUID);
892+
}
888893

889894
new_ah->ah = ib_create_ah(port->agent->qp->pd, &ah_attr);
890895
if (IS_ERR(new_ah->ah)) {

include/rdma/ib_verbs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,11 @@ enum rdma_node_type {
9797
RDMA_NODE_USNIC_UDP,
9898
};
9999

100+
enum {
101+
/* set the local administered indication */
102+
IB_SA_WELL_KNOWN_GUID = BIT_ULL(57) | 2,
103+
};
104+
100105
enum rdma_transport_type {
101106
RDMA_TRANSPORT_IB,
102107
RDMA_TRANSPORT_IWARP,
@@ -510,6 +515,7 @@ struct ib_port_attr {
510515
u8 active_width;
511516
u8 active_speed;
512517
u8 phys_state;
518+
bool grh_required;
513519
};
514520

515521
enum ib_device_modify_flags {

0 commit comments

Comments
 (0)