IB/core: Add 32 bit LID support
Subsystems (6)
cover IB/core: Add 32 bit LID support
From: Ira Weiny <[email protected]>
OPA devices can support more than 48K LIDs in the fabric. A node with a LID greater than 0xbfff is called an 'extended lid'. In order to support verbs with extended LIDs it is necessary to modify some of the RDMA data structures where LIDs are currently only 16 bits in length.
This patch series follows on what was presented at the OFA Workshop. Rather than breaking the current UABI we propose to extend the LID address space by sending a 'special' GID value down the verbs stack that has the 32-bit LID programmed in it. By having a means to differentiate a regular GID from our 'special' GID, the underlying OPA device driver is able to retrieve the 32-bit LIDs from the GID fields instead of picking them up from the 16 bit lid fields.
Internal to the kernel data structures such as struct ib_wc, struct ib_port_attr and related ones have been modified to use 32 bit LID fields. These changes are specific to the kernel and do not break the current UABI.
Node <-> SM interaction in getting extended LID information
----------------------------------------------------------------------------
1. Source application determines the GID of the destination through standard means and send a pathrecord query to the SM.
2. SM (which is OPA specific) recognizes that one or more nodes in the pathrecord request uses extended LIDs.
3. SM issues a pathrecord response. The SGID and DGID fields in the pathrecord response is the specially formulated GID.
4. Additionally, SM sets the hoplimit field of the pathrecord to 1.
5. Source receives the response and can determine the actual LID of the destination, if needed, from the response.
Source Node <-> Destination Node interaction in using extended LID information
-------------------------------------------------------------------------------
1. Source uses the pathrecord response from the SM to create an address handle to the destination (either at user or kernel space).
2. Since hoplimit field in the pathrecord is > 0, GRH fields are enabled in the address handle.
3. Address handle information is now passed down through the RDMA stack and reaches the driver.
4. Driver looks at the GRH fields in the address handle and determines that the GID in the GRH is actually a special GID.
5. Driver retrieves LID from GID field and uses 16B bypass packets to send data on the wire.
6. Driver at the receiving side determines that a GRH needs to be added to the address handle before passing it on to the destination application.
7. Destination now receives the packet and can send back the response using the same address handle information.
There are some obvious limitations with this scheme:
----------------------------------------------------
1. Multicast packets which always need a GRH cannot use this scheme. Essentially multicast LIDs cannot be extended.
2. Subnet routed packets which also need a GRH cannot fully use this scheme. Specifically the LID of the router itself cannot be extended. The actual destination can still be extended.
3. Applications will need to use pathrecords to get destination address information. Any other out-of-band mechanisms are not guaranteed to work.
4. As an extension to 3, applications that 'validate' pathrecord responses need to be careful not to treat 0 LID field as an error condition.
Dasaratharaman Chandramouli (6):
IB/core: Add rdma_cap_opa_ah to expose opa address handles IB/core: Change port_attr.sm_lid from 16 to 32 bits IB/core: Change lid size in struct ib_port_attr from 16 to 32 bits IB/IPoIB: Retrieve 32 bit LIDs from path records when running on OPA
devices
IB/IPoIB: Modify ipoib_get_net_dev_by_params to lookup gid table IB/srpt: Increase lid and sm_lid to 32 bits
Don Hiatt (5):
IB/sa: Modify SM Address handle to program GRH when using large lids IB/core: Change lid size in struct ib_wc from 16 to 32 bits IB/mad: Ensure DR MADs are correctly specified when using OPA devices IB/mad: Change slid in RMPP recv from 16 to 32 bits IB/rdmavt: Modify rvt_check_ah() to account for extended LIDs
drivers/infiniband/core/cm.c | 4 +- drivers/infiniband/core/mad.c | 100 ++++++++++++++++++++++++++---- drivers/infiniband/core/mad_rmpp.c | 18 +++++- drivers/infiniband/core/sa_query.c | 20 +++++- drivers/infiniband/core/user_mad.c | 2 +- drivers/infiniband/core/uverbs_cmd.c | 12 +++- drivers/infiniband/hw/hfi1/hfi.h | 3 +- drivers/infiniband/hw/hfi1/mad.c | 2 +- drivers/infiniband/hw/hfi1/verbs.c | 13 ++++ drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +- drivers/infiniband/hw/mlx4/mad.c | 8 +-- drivers/infiniband/hw/mlx5/mad.c | 2 +- drivers/infiniband/hw/mthca/mthca_cmd.c | 4 +- drivers/infiniband/hw/mthca/mthca_mad.c | 4 +- drivers/infiniband/hw/qib/qib_verbs.c | 9 +++ drivers/infiniband/sw/rdmavt/ah.c | 10 --- drivers/infiniband/sw/rdmavt/cq.c | 2 +- drivers/infiniband/sw/rdmavt/qp.c | 9 ++- drivers/infiniband/ulp/ipoib/ipoib.h | 4 +- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 11 ++++ drivers/infiniband/ulp/ipoib/ipoib_main.c | 63 ++++++++++++++++++- drivers/infiniband/ulp/srpt/ib_srpt.h | 4 +- include/rdma/ib_addr.h | 31 +++++++++ include/rdma/ib_verbs.h | 27 +++++++- 24 files changed, 309 insertions(+), 55 deletions(-)
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 1/11 IB/core: Add rdma_cap_opa_ah to expose opa address handles
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
rdma_cap_opa_ah(..) enables core components to check if the corresponding port supports extended addresses
--- include/rdma/ib_verbs.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
include/rdma/ib_verbs.h +21 -0
@@ -467,6 +467,7 @@ static inline struct rdma_hw_stats *rdma_alloc_hw_stats_struct(/* Address format 0x000FF000 */ #define RDMA_CORE_CAP_AF_IB 0x00001000#define RDMA_CORE_CAP_ETH_AH 0x00002000 +#define RDMA_CORE_CAP_OPA_AH 0x00004000/* Protocol 0xFFF00000 */ #define RDMA_CORE_CAP_PROT_IB 0x00100000
@@ -2418,6 +2419,26 @@ static inline bool rdma_cap_eth_ah(const struct ib_device *device, u8 port_num) }/** +* rdma_cap_opa_ah - Check if the port of device has the capability +* OPA Address handle +* @device: Device to check +* @port_num: Port number to check +* +* OPA Address handles enable use of 32 bit LIDs by using a specially +* formatted GID field to carry the LID. This check enables kernel +* components to identify such a scheme so that they can then try +* to make use of the LID in the GID field. +* +* Return: true if we are running as a OPA device which enables +* 32 bit LIDs to be used in the fabric. +*/ +static inline bool rdma_cap_opa_ah (struct ib_device *device,u8 port_num) +{ +return (device->port_immutable[port_num].core_cap_flags & +RDMA_CORE_CAP_OPA_AH ) ==RDMA_CORE_CAP_OPA_AH ; +} + +/** * rdma_max_mad_size - Return the max MAD size required by this RDMA Port. * * @device: Device
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 2/11 IB/core: Change port_attr.sm_lid from 16 to 32 bits
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
sm_lid field in port_attr is increased to 32 bits. This enables core components to use the larger addresses if needed. The user ABI is unchanged and return 16 bit values when queried.
--- drivers/infiniband/core/uverbs_cmd.c | 6 +++++- drivers/infiniband/ulp/srpt/ib_srpt.c | 2 +- include/rdma/ib_addr.h | 3 +++ include/rdma/ib_verbs.h | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +5 -1
@@ -39,6 +39,7 @@#include <linux/sched.h> #include <asm/uaccess.h> +#include <rdma/ib_addr.h> #include "uverbs.h" #include "core_priv.h"
@@ -515,7 +516,10 @@ ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, resp.qkey_viol_cntr = attr.qkey_viol_cntr; resp.pkey_tbl_len = attr.pkey_tbl_len; resp.lid = attr.lid; - resp.sm_lid = attr.sm_lid; +if (rdma_cap_opa_ah (ib_dev, cmd.port_num)) + resp.sm_lid =OPA_TO_IB_UCAST_LID (attr.sm_lid); +else + resp.sm_lid = (u16 )attr.sm_lid; resp.lmc = attr.lmc; resp.max_vl_num = attr.max_vl_num; resp.sm_sl = attr.sm_sl;
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -1
@@ -514,7 +514,7 @@ static int srpt_refresh_port(struct srpt_port *sport)if (ret) goto err_query_port; - sport->sm_lid = port_attr.sm_lid; + sport->sm_lid = (u16 )port_attr.sm_lid; sport->lid = port_attr.lid; ret = ib_query_gid(sport->sdev->device, sport->port, 0, &sport->gid,
include/rdma/ib_addr.h +3 -0
@@ -49,6 +49,9 @@#include <net/ipv6.h> #include <net/net_namespace.h> +#define OPA_TO_IB_UCAST_LID (x) (((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \ + ? 0 : x) +struct rdma_addr_client {atomic_t refcount;struct completion comp;
include/rdma/ib_verbs.h +1 -1
@@ -509,7 +509,7 @@ struct ib_port_attr {u32 qkey_viol_cntr;u16 pkey_tbl_len;u16 lid; -u16 sm_lid; +u32 sm_lid;u8 lmc;u8 max_vl_num;u8 sm_sl;
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 3/11 IB/sa: Modify SM Address handle to program GRH when using large lids
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
When either the port lid or the sm lid is above the ib unicast lid space, the SMI creates an address handle with the revelant GRH information.
--- drivers/infiniband/core/sa_query.c | 20 +++++++++++++++++++- include/rdma/ib_addr.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-)
drivers/infiniband/core/sa_query.c +19 -1
@@ -958,7 +958,6 @@ static void update_sm_ah(struct work_struct *work)pr_err ("Couldn't find index for default PKey\n" );memset (&ah_attr,0 ,sizeof ah_attr); - ah_attr.dlid = port_attr.sm_lid; ah_attr.sl = port_attr.sm_sl; ah_attr.port_num = port->port_num;if (port_attr.grh_required) {
@@ -967,6 +966,25 @@ static void update_sm_ah(struct work_struct *work) ah_attr.grh.dgid.global.interface_id =cpu_to_be64 (IB_SA_WELL_KNOWN_GUID ); } +if (rdma_cap_opa_ah (port->agent->device, port->port_num)) { + ah_attr.dlid =OPA_TO_IB_UCAST_LID (port_attr.sm_lid); +if ((port_attr.sm_lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) || + (port_attr.lid >=be16_to_cpu (IB_MULTICAST_LID_BASE ))) { +if (port_attr.grh_required) +pr_warn ("Overwriting GRH specified in SM AH\n" ); + ah_attr.ah_flags =IB_AH_GRH ; + ah_attr.grh.hop_limit =1 ; + ah_attr.grh.sgid_index =0 ; +/* Same prefix as sgid */ + ah_attr.grh.dgid.global.subnet_prefix = +cpu_to_be64 (port_attr.subnet_prefix); + ah_attr.grh.dgid.global.interface_id = +OPA_MAKE_ID (port_attr.sm_lid); + } + }else { + ah_attr.dlid = (u16 )port_attr.sm_lid; + } + new_ah->ah =ib_create_ah (port->agent->qp->pd, &ah_attr);if (IS_ERR (new_ah->ah)) {pr_warn ("Couldn't create new SM AH\n" );
include/rdma/ib_addr.h +2 -0
@@ -51,6 +51,8 @@#define OPA_TO_IB_UCAST_LID (x) (((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \ ? 0 : x) +#define OPA_STL_OUI (0x00066AULL) +#define OPA_MAKE_ID (x) (cpu_to_be64(OPA_STL_OUI << 40 | (x)))struct rdma_addr_client {atomic_t refcount;
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 4/11 IB/core: Change lid size in struct ib_port_attr from 16 to 32 bits
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
lid field in port_attr is increased to 32 bits. This enables core components to use the larger addresses if needed.
The user ABI is unchanged and return 16 bit values when queried.
--- drivers/infiniband/core/uverbs_cmd.c | 8 +++++--- drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +- drivers/infiniband/hw/mlx4/mad.c | 2 +- drivers/infiniband/hw/mthca/mthca_mad.c | 2 +- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 2 +- drivers/infiniband/ulp/srpt/ib_srpt.c | 2 +- include/rdma/ib_verbs.h | 2 +- 7 files changed, 11 insertions(+), 9 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +5 -3
@@ -515,11 +515,13 @@ ssize_t ib_uverbs_query_port(struct ib_uverbs_file *file, resp.bad_pkey_cntr = attr.bad_pkey_cntr; resp.qkey_viol_cntr = attr.qkey_viol_cntr; resp.pkey_tbl_len = attr.pkey_tbl_len; - resp.lid = attr.lid; -if (rdma_cap_opa_ah (ib_dev, cmd.port_num)) +if (rdma_cap_opa_ah (ib_dev, cmd.port_num)) { resp.sm_lid =OPA_TO_IB_UCAST_LID (attr.sm_lid); -else + resp.lid =OPA_TO_IB_UCAST_LID (attr.lid); + }else { resp.sm_lid = (u16 )attr.sm_lid; + resp.lid = (u16 )attr.lid; + } resp.lmc = attr.lmc; resp.max_vl_num = attr.max_vl_num; resp.sm_sl = attr.sm_sl;
drivers/infiniband/hw/mlx4/alias_GUID.c +1 -1
@@ -527,7 +527,7 @@ static int set_guid_rec(struct ib_device *ibdev,memset (&guid_info_rec,0 ,sizeof (struct ib_sa_guidinfo_rec )); - guid_info_rec.lid =cpu_to_be16 (attr.lid); + guid_info_rec.lid =cpu_to_be16 ((u16 )attr.lid); guid_info_rec.block_num = index; memcpy(guid_info_rec.guid_info_list, rec_det->all_recs,
drivers/infiniband/hw/mlx4/mad.c +1 -1
@@ -794,7 +794,7 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, in_mad->mad_hdr.method == IB_MGMT_METHOD_SET && in_mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO && !ib_query_port(ibdev, port_num, &pattr)) - prev_lid = pattr.lid; + prev_lid = (u16 )pattr.lid; err = mlx4_MAD_IFC(to_mdev(ibdev), (mad_flags & IB_MAD_IGNORE_MKEY ? MLX4_MAD_IFC_IGNORE_MKEY : 0) |
drivers/infiniband/hw/mthca/mthca_mad.c +1 -1
@@ -254,7 +254,7 @@ int mthca_process_mad(struct ib_device *ibdev, in_mad->mad_hdr.method == IB_MGMT_METHOD_SET && in_mad->mad_hdr.attr_id == IB_SMP_ATTR_PORT_INFO && !ib_query_port(ibdev, port_num, &pattr)) - prev_lid = pattr.lid; + prev_lid = (u16 )pattr.lid; err = mthca_MAD_IFC(to_mdev(ibdev), mad_flags & IB_MAD_IGNORE_MKEY,
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +1 -1
@@ -581,7 +581,7 @@ void ipoib_mcast_join_task(struct work_struct *work) port_attr.state);return ; } - priv->local_lid = port_attr.lid; + priv->local_lid = (u16 )port_attr.lid;netif_addr_lock_bh (dev);if (!test_bit (IPOIB_FLAG_DEV_ADDR_SET , &priv->flags)) {
drivers/infiniband/ulp/srpt/ib_srpt.c +1 -1
@@ -515,7 +515,7 @@ static int srpt_refresh_port(struct srpt_port *sport) goto err_query_port; sport->sm_lid = (u16 )port_attr.sm_lid; - sport->lid = port_attr.lid; + sport->lid = (u16 )port_attr.lid; ret =ib_query_gid (sport->sdev->device, sport->port,0 , &sport->gid,NULL );
include/rdma/ib_verbs.h +1 -1
@@ -508,7 +508,7 @@ struct ib_port_attr {u32 bad_pkey_cntr;u32 qkey_viol_cntr;u16 pkey_tbl_len; -u16 lid; +u32 lid;u32 sm_lid;u8 lmc;u8 max_vl_num;
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 5/11 IB/core: Change lid size in struct ib_wc from 16 to 32 bits
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
lid field in ib_wc is increased to 32 bits. This enables core components to use the larger addresses if needed.
The user ABI is unchanged and return 16 bit values when queried.
--- drivers/infiniband/core/cm.c | 4 ++-- drivers/infiniband/core/mad_rmpp.c | 4 ++-- drivers/infiniband/core/user_mad.c | 2 +- drivers/infiniband/core/uverbs_cmd.c | 2 +- drivers/infiniband/hw/hfi1/hfi.h | 2 +- drivers/infiniband/hw/hfi1/mad.c | 2 +- drivers/infiniband/hw/mlx4/mad.c | 6 +++--- drivers/infiniband/hw/mlx5/mad.c | 2 +- drivers/infiniband/hw/mthca/mthca_cmd.c | 4 ++-- drivers/infiniband/hw/mthca/mthca_mad.c | 2 +- drivers/infiniband/sw/rdmavt/cq.c | 2 +- include/rdma/ib_verbs.h | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-)
drivers/infiniband/core/cm.c +2 -2
@@ -1576,7 +1576,7 @@ static void cm_process_routed_req(struct cm_req_msg *req_msg, struct ib_wc *wc) {if (!cm_req_get_primary_subnet_local (req_msg)) {if (req_msg->primary_local_lid ==IB_LID_PERMISSIVE ) { - req_msg->primary_local_lid =cpu_to_be16 (wc->slid); + req_msg->primary_local_lid =cpu_to_be16 ((u16 )wc->slid);cm_req_set_primary_sl (req_msg, wc->sl); }
@@ -1586,7 +1586,7 @@ static void cm_process_routed_req(struct cm_req_msg *req_msg, struct ib_wc *wc)if (!cm_req_get_alt_subnet_local (req_msg)) {if (req_msg->alt_local_lid ==IB_LID_PERMISSIVE ) { - req_msg->alt_local_lid =cpu_to_be16 (wc->slid); + req_msg->alt_local_lid =cpu_to_be16 ((u16 )wc->slid);cm_req_set_alt_sl (req_msg, wc->sl); }
drivers/infiniband/core/mad_rmpp.c +2 -2
@@ -316,7 +316,7 @@ create_rmpp_recv(struct ib_mad_agent_private *agent, mad_hdr = &mad_recv_wc->recv_buf.mad->mad_hdr; rmpp_recv->tid = mad_hdr->tid; rmpp_recv->src_qp = mad_recv_wc->wc->src_qp; - rmpp_recv->slid = mad_recv_wc->wc->slid; + rmpp_recv->slid = (u16 )mad_recv_wc->wc->slid; rmpp_recv->mgmt_class = mad_hdr->mgmt_class; rmpp_recv->class_version = mad_hdr->class_version; rmpp_recv->method = mad_hdr->method;
@@ -337,7 +337,7 @@ find_rmpp_recv(struct ib_mad_agent_private *agent,list_for_each_entry (rmpp_recv, &agent->rmpp_list, list) {if (rmpp_recv->tid == mad_hdr->tid && rmpp_recv->src_qp == mad_recv_wc->wc->src_qp && - rmpp_recv->slid == mad_recv_wc->wc->slid && + rmpp_recv->slid == (u16 )mad_recv_wc->wc->slid && rmpp_recv->mgmt_class == mad_hdr->mgmt_class && rmpp_recv->class_version == mad_hdr->class_version && rmpp_recv->method == mad_hdr->method)
drivers/infiniband/core/user_mad.c +1 -1
@@ -229,7 +229,7 @@ static void recv_handler(struct ib_mad_agent *agent, packet->mad.hdr.status =0 ; packet->mad.hdr.length =hdr_size (file) + mad_recv_wc->mad_len; packet->mad.hdr.qpn =cpu_to_be32 (mad_recv_wc->wc->src_qp); - packet->mad.hdr.lid =cpu_to_be16 (mad_recv_wc->wc->slid); + packet->mad.hdr.lid =cpu_to_be16 ((u16 )mad_recv_wc->wc->slid); packet->mad.hdr.sl = mad_recv_wc->wc->sl; packet->mad.hdr.path_bits = mad_recv_wc->wc->dlid_path_bits; packet->mad.hdr.pkey_index = mad_recv_wc->wc->pkey_index;
drivers/infiniband/core/uverbs_cmd.c +1 -1
@@ -1619,7 +1619,7 @@ static int copy_wc_to_user(void __user *dest, struct ib_wc *wc) tmp.src_qp = wc->src_qp; tmp.wc_flags = wc->wc_flags; tmp.pkey_index = wc->pkey_index; - tmp.slid = wc->slid; + tmp.slid = (u16 )wc->slid; tmp.sl = wc->sl; tmp.dlid_path_bits = wc->dlid_path_bits; tmp.port_num = wc->port_num;
drivers/infiniband/hw/hfi1/hfi.h +1 -1
@@ -1448,7 +1448,7 @@ static int ingress_pkey_table_search(struct hfi1_pportdata *ppd, u16 pkey)* the 'error info' for this failure. */ static void ingress_pkey_table_fail (struct hfi1_pportdata *ppd,u16 pkey, -u16 slid) +u32 slid) {struct hfi1_devdata *dd = ppd->dd;
drivers/infiniband/hw/hfi1/mad.c +1 -1
@@ -3974,7 +3974,7 @@ static int opa_local_smp_check(struct hfi1_ibport *ibp, const struct ib_wc *in_wc) {struct hfi1_pportdata *ppd =ppd_from_ibp (ibp); -u16 slid = in_wc->slid; +u32 slid = in_wc->slid;u16 pkey;if (in_wc->pkey_index >=ARRAY_SIZE (ppd->pkeys))
drivers/infiniband/hw/mlx4/mad.c +3 -3
@@ -167,7 +167,7 @@ int mlx4_MAD_IFC(struct mlx4_ib_dev *dev, int mad_ifc_flags, op_modifier |=0x4 ; - in_modifier |= in_wc->slid <<16 ; + in_modifier |= (u16 )in_wc->slid <<16 ; } err = mlx4_cmd_box(dev->dev, inmailbox->dma, outmailbox->dma, in_modifier,
@@ -572,7 +572,7 @@ int mlx4_ib_send_to_slave(struct mlx4_ib_dev *dev, int slave, u8 port,memcpy ((char *)&tun_mad->hdr.slid_mac_47_32, &(wc->smac[4 ]),2 ); }else { tun_mad->hdr.sl_vid =cpu_to_be16 (((u16)(wc->sl)) <<12 ); - tun_mad->hdr.slid_mac_47_32 =cpu_to_be16 (wc->slid); + tun_mad->hdr.slid_mac_47_32 =cpu_to_be16 ((u16 )wc->slid); } ib_dma_sync_single_for_device(&dev->ib_dev,
@@ -760,7 +760,7 @@ static int ib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num, } } - slid = in_wc ? in_wc->slid :be16_to_cpu (IB_LID_PERMISSIVE ); + slid = in_wc ? (u16 )in_wc->slid :be16_to_cpu (IB_LID_PERMISSIVE );if (in_mad->mad_hdr.method ==IB_MGMT_METHOD_TRAP && slid ==0 ) {forward_trap (to_mdev (ibdev), port_num, in_mad);
drivers/infiniband/hw/mlx5/mad.c +1 -1
@@ -66,7 +66,7 @@ static int process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,u16 slid;int err; - slid = in_wc ? in_wc->slid :be16_to_cpu (IB_LID_PERMISSIVE ); + slid = in_wc ? (u16 )in_wc->slid :be16_to_cpu (IB_LID_PERMISSIVE );if (in_mad->mad_hdr.method ==IB_MGMT_METHOD_TRAP && slid ==0 )return IB_MAD_RESULT_SUCCESS |IB_MAD_RESULT_CONSUMED ;
drivers/infiniband/hw/mthca/mthca_cmd.c +2 -2
@@ -1913,7 +1913,7 @@ int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey, (in_wc->wc_flags &IB_WC_GRH ?0x80 :0 );MTHCA_PUT (inbox, val,MAD_IFC_G_PATH_OFFSET ); -MTHCA_PUT (inbox, in_wc->slid,MAD_IFC_RLID_OFFSET ); +MTHCA_PUT (inbox, (u16 )in_wc->slid,MAD_IFC_RLID_OFFSET );MTHCA_PUT (inbox, in_wc->pkey_index,MAD_IFC_PKEY_OFFSET );if (in_grh)
@@ -1921,7 +1921,7 @@ int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey, op_modifier |=0x4 ; - in_modifier |= in_wc->slid <<16 ; + in_modifier |= (u16 )in_wc->slid <<16 ; } err = mthca_cmd_box(dev, inmailbox->dma, outmailbox->dma,
drivers/infiniband/hw/mthca/mthca_mad.c +1 -1
@@ -203,7 +203,7 @@ int mthca_process_mad(struct ib_device *ibdev, u16 *out_mad_pkey_index) {int err; -u16 slid = in_wc ? in_wc->slid :be16_to_cpu (IB_LID_PERMISSIVE ); +u16 slid = in_wc ? (u16 )in_wc->slid :be16_to_cpu (IB_LID_PERMISSIVE );u16 prev_lid =0 ;struct ib_port_attr pattr;const struct ib_mad *in_mad = (const struct ib_mad *)in;
drivers/infiniband/sw/rdmavt/cq.c +1 -1
@@ -105,7 +105,7 @@ void rvt_cq_enter(struct rvt_cq *cq, struct ib_wc *entry, bool solicited) wc->uqueue[head].src_qp = entry->src_qp; wc->uqueue[head].wc_flags = entry->wc_flags; wc->uqueue[head].pkey_index = entry->pkey_index; - wc->uqueue[head].slid = entry->slid; + wc->uqueue[head].slid = (u16 )entry->slid; wc->uqueue[head].sl = entry->sl; wc->uqueue[head].dlid_path_bits = entry->dlid_path_bits; wc->uqueue[head].port_num = entry->port_num;
include/rdma/ib_verbs.h +1 -1
@@ -882,7 +882,7 @@ struct ib_wc {u32 src_qp;int wc_flags;u16 pkey_index; -u16 slid; +u32 slid;u8 sl;u8 dlid_path_bits;u8 port_num;/* valid only for DR SMPs on switches */
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 6/11 IB/mad: Ensure DR MADs are correctly specified when using OPA devices
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
Pure DR MADs do not need OPA GIDs to be specified in the GRH since they do not rely on LID information.
--- drivers/infiniband/core/mad.c | 100 +++++++++++++++++++++++++++++++++++++----- include/rdma/ib_addr.h | 14 ++++++ 2 files changed, 102 insertions(+), 12 deletions(-)
drivers/infiniband/core/mad.c +88 -12
@@ -41,6 +41,7 @@#include <linux/slab.h> #include <linux/module.h> #include <rdma/ib_cache.h> +#include <rdma/ib_addr.h> #include "mad_priv.h" #include "mad_rmpp.h"
@@ -731,6 +732,76 @@ static size_t mad_priv_dma_size(const struct ib_mad_private *mp)return sizeof (struct ib_grh ) + mp->mad_size; } +static int verify_mad_ah (struct ib_mad_agent_private *mad_agent_priv, +struct ib_mad_send_wr_private *mad_send_wr) +{ +struct ib_device *ib_dev = mad_agent_priv->qp_info->port_priv->device; +u8 port = mad_agent_priv->qp_info->port_priv->port_num; +struct ib_smp *smp = mad_send_wr->send_buf.mad; +struct opa_smp *opa_smp = (struct opa_smp *)smp; +u32 opa_drslid =be32_to_cpu (opa_smp->route.dr.dr_slid); +u32 opa_drdlid =be32_to_cpu (opa_smp->route.dr.dr_dlid); + +bool dr_slid_is_permissive = (OPA_LID_PERMISSIVE == + opa_smp->route.dr.dr_slid); +bool dr_dlid_is_permissive = (OPA_LID_PERMISSIVE == + opa_smp->route.dr.dr_dlid); +bool drslid_is_ib_ucast = !(opa_drslid &0xFFFFC000 ); +bool drdlid_is_ib_ucast = !(opa_drdlid &0xFFFFC000 ); +bool drslid_is_ext = !drslid_is_ib_ucast && !dr_slid_is_permissive; +bool drdlid_is_ext = !drdlid_is_ib_ucast && !dr_dlid_is_permissive; +bool grh_present = false; +struct ib_ah_attr attr; +union ib_gid sgid; +int ret =0 ; + + ret =ib_query_ah (mad_send_wr->send_buf.ah, &attr); +if (ret) +return ret; + grh_present = (attr.ah_flags &IB_AH_GRH ); +if (grh_present) { + ret =ib_query_gid (ib_dev, port, attr.grh.sgid_index, + &sgid,NULL ); +if (ret) +return ret; + } + +if (smp->class_version ==OPA_SMP_CLASS_VERSION ) { +/* +* Conditions when GRH info should not be specified +* 1. both dr_slid and dr_dlid are permissve (Pure DR) +* 2. both dr_slid and dr_dlid are less than 0xc000. +* +* Conditions when GRH info should be specified +* 1. dr_dlid is not permissive and above 0xbfff +* OR +* 2. dr_slid is not permissive and above 0xbfff +*/ +if (grh_present) { +if ((dr_slid_is_permissive && + dr_dlid_is_permissive) || + (drslid_is_ib_ucast && drdlid_is_ib_ucast)) +if (ib_is_opa_gid (&attr.grh.dgid) && +ib_is_opa_gid (&sgid)) +return -EINVAL ; +if (drslid_is_ext && !ib_is_opa_gid (&sgid)) +return -EINVAL ; +if (drdlid_is_ext && + !ib_is_opa_gid (&attr.grh.dgid)) +return -EINVAL ; + }else {/* There is no GRH */ +if (drslid_is_ext || drdlid_is_ext) +return -EINVAL ; + } + }else { +if (grh_present) +if (ib_is_opa_gid (&attr.grh.dgid) && +ib_is_opa_gid (&sgid)) +return -EINVAL ; + } +return 0 ; +} +/* * Return 0 if SMP is to be sent * Return 1 if SMP was consumed locally (whether or not solicited)
@@ -754,8 +825,12 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,size_t mad_size =port_mad_size (mad_agent_priv->qp_info->port_priv);u16 out_mad_pkey_index =0 ;u16 drslid; -bool opa =rdma_cap_opa_mad (mad_agent_priv->qp_info->port_priv->device, - mad_agent_priv->qp_info->port_priv->port_num); +bool opa_mad = +rdma_cap_opa_mad (mad_agent_priv->qp_info->port_priv->device, + mad_agent_priv->qp_info->port_priv->port_num); +bool opa_ah = +rdma_cap_opa_ah (mad_agent_priv->qp_info->port_priv->device, + mad_agent_priv->qp_info->port_priv->port_num);if (rdma_cap_ib_switch (device) && smp->mgmt_class ==IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE )
@@ -763,13 +838,21 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,else port_num = mad_agent_priv->agent.port_num; +if (opa_mad && opa_ah) { + ret =verify_mad_ah (mad_agent_priv, mad_send_wr); +if (ret) { +dev_err (&device->dev, +"Error verifying MAD format\n" ); + goto out; + } + }/* * Directed route handling starts if the initial LID routed part of * a request or the ending LID routed part of a response is empty. * If we are at the start of the LID routed part, don't update the * hop_ptr or hop_cnt. See section 14.2.2, Vol 1 IB spec. */ -if (opa && smp->class_version ==OPA_SMP_CLASS_VERSION ) { +if (opa_mad && smp->class_version ==OPA_SMP_CLASS_VERSION ) {u32 opa_drslid; if ((opa_get_smp_direction(opa_smp)
@@ -783,13 +866,6 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, goto out; } opa_drslid =be32_to_cpu (opa_smp->route.dr.dr_slid); -if (opa_drslid !=be32_to_cpu (OPA_LID_PERMISSIVE ) && - opa_drslid &0xffff0000 ) { - ret = -EINVAL ; -dev_err (&device->dev,"OPA Invalid dr_slid 0x%x\n" , - opa_drslid); - goto out; - } drslid = (u16)(opa_drslid &0x0000ffff );/* Check to post send on QP or process locally */
@@ -834,7 +910,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, send_wr->pkey_index, send_wr->port_num, &mad_wc); -if (opa && smp->base_version ==OPA_MGMT_BASE_VERSION ) { +if (opa_mad && smp->base_version ==OPA_MGMT_BASE_VERSION ) { mad_wc.byte_len = mad_send_wr->send_buf.hdr_len + mad_send_wr->send_buf.data_len +sizeof (struct ib_grh );
@@ -891,7 +967,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv, } local->mad_send_wr = mad_send_wr; -if (opa) { +if (opa_mad) { local->mad_send_wr->send_wr.pkey_index = out_mad_pkey_index; local->return_wc_byte_len = mad_size; }
include/rdma/ib_addr.h +14 -0
@@ -333,4 +333,18 @@ static inline struct net_device *rdma_vlan_dev_real_dev(const struct net_device vlan_dev_real_dev(dev) : NULL; } +/** +* ib_is_opa_gid: Returns true if the top 24 bits of the gid +* contains the OPA_STL_OUI identifier. This identifies that +* the provided gid is a special purpose GID meant to carry +* extended LID information. +* +* @gid: The Global identifier +*/ +static inline bool ib_is_opa_gid (union ib_gid *gid) +{ +return ((be64_to_cpu (gid->global.interface_id) >>40 ) == +OPA_STL_OUI ); +} +#endif /* IB_ADDR_H */
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 7/11 IB/mad: Change slid in RMPP recv from 16 to 32 bits
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
OPA devices will contain larger lids in the wc.slid which is now 32 bits. This change ensures RMPP handler is able to retrieve the correct lid.
--- drivers/infiniband/core/mad_rmpp.c | 22 ++++++++++++++++++---- include/rdma/ib_addr.h | 12 ++++++++++++ 2 files changed, 30 insertions(+), 4 deletions(-)
drivers/infiniband/core/mad_rmpp.c +18 -4
@@ -33,6 +33,7 @@*/ #include <linux/slab.h> +#include <rdma/ib_addr.h> #include "mad_priv.h" #include "mad_rmpp.h"
@@ -64,7 +65,7 @@ struct mad_rmpp_recv {__be64 tid;u32 src_qp; -u16 slid; +u32 slid;u8 mgmt_class;u8 class_version;u8 method;
@@ -316,7 +317,7 @@ create_rmpp_recv(struct ib_mad_agent_private *agent, mad_hdr = &mad_recv_wc->recv_buf.mad->mad_hdr; rmpp_recv->tid = mad_hdr->tid; rmpp_recv->src_qp = mad_recv_wc->wc->src_qp; - rmpp_recv->slid = (u16 )mad_recv_wc->wc->slid; + rmpp_recv->slid = mad_recv_wc->wc->slid; rmpp_recv->mgmt_class = mad_hdr->mgmt_class; rmpp_recv->class_version = mad_hdr->class_version; rmpp_recv->method = mad_hdr->method;
@@ -337,7 +338,7 @@ find_rmpp_recv(struct ib_mad_agent_private *agent,list_for_each_entry (rmpp_recv, &agent->rmpp_list, list) {if (rmpp_recv->tid == mad_hdr->tid && rmpp_recv->src_qp == mad_recv_wc->wc->src_qp && - rmpp_recv->slid == (u16 )mad_recv_wc->wc->slid && + rmpp_recv->slid == mad_recv_wc->wc->slid && rmpp_recv->mgmt_class == mad_hdr->mgmt_class && rmpp_recv->class_version == mad_hdr->class_version && rmpp_recv->method == mad_hdr->method)
@@ -850,11 +851,14 @@ out:static int init_newwin (struct ib_mad_send_wr_private *mad_send_wr) {struct ib_mad_agent_private *agent = mad_send_wr->mad_agent_priv; +struct ib_device *ib_dev = agent->qp_info->port_priv->device; +u8 port = agent->qp_info->port_priv->port_num;struct ib_mad_hdr *mad_hdr = mad_send_wr->send_buf.mad;struct mad_rmpp_recv *rmpp_recv;struct ib_ah_attr ah_attr;unsigned long flags;int newwin =1 ; +u32 dlid;if (!(mad_hdr->method &IB_MGMT_METHOD_RESP )) goto out;
@@ -870,7 +874,17 @@ static int init_newwin(struct ib_mad_send_wr_private *mad_send_wr)if (ib_query_ah (mad_send_wr->send_buf.ah, &ah_attr))continue ; -if (rmpp_recv->slid == ah_attr.dlid) { +if (rdma_cap_opa_ah (ib_dev, port)) { +if ((ah_attr.ah_flags &IB_AH_GRH ) && + (ib_is_opa_gid (&ah_attr.grh.dgid))) + dlid =opa_get_lid_from_gid (&ah_attr.grh.dgid); +else + dlid =OPA_TO_IB_UCAST_LID (ah_attr.dlid); + }else { + dlid = ah_attr.dlid; + } + +if (rmpp_recv->slid == dlid) { newwin = rmpp_recv->repwin;break ; }
include/rdma/ib_addr.h +12 -0
@@ -347,4 +347,16 @@ static inline bool ib_is_opa_gid(union ib_gid *gid) OPA_STL_OUI); } +/** +* opa_get_lid_from_gid: Returns the last 32 bits of the gid. +* OPA devices use one of the gids in the gid table to also +* store the lid. +* +* @gid: The Global identifier +*/ +static inline u32 opa_get_lid_from_gid (union ib_gid *gid) +{ +return be64_to_cpu (gid->global.interface_id) &0xFFFFFFFF ; +} +#endif /* IB_ADDR_H */
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 8/11 IB/IPoIB: Retrieve 32 bit LIDs from path records when running on OPA devices
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Path record responses will contain the 32 bit LID information in the SGID and DGID field of the responses. Modify IPoIB to use these extended LIDs in datagram and connected mode communication.
--- drivers/infiniband/ulp/ipoib/ipoib.h | 4 +++- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 11 +++++++++++ drivers/infiniband/ulp/ipoib/ipoib_main.c | 26 ++++++++++++++++++++++++++ drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 2 +- 4 files changed, 41 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib.h +3 -1
@@ -352,7 +352,7 @@ struct ipoib_dev_priv {u32 qkey;union ib_gid local_gid; -u16 local_lid; +u32 local_lid;unsigned int admin_mtu;unsigned int mcast_mtu;
@@ -421,6 +421,8 @@ struct ipoib_path {struct rb_node rb_node;struct list_head list;int valid; +u32 dlid; +u32 slid; };struct ipoib_neigh {
drivers/infiniband/ulp/ipoib/ipoib_cm.c +11 -0
@@ -38,6 +38,7 @@#include <linux/slab.h> #include <linux/vmalloc.h> #include <linux/moduleparam.h> +#include <rdma/ib_addr.h> #include "ipoib.h"
@@ -1356,6 +1357,16 @@ static void ipoib_cm_tx_start(struct work_struct *work) }memcpy (&pathrec, &p->path->pathrec,sizeof pathrec); +if (rdma_cap_opa_ah (priv->ca, priv->port)) { +if (p->path->dlid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) + pathrec.dgid.global.interface_id = +OPA_MAKE_ID (p->path->dlid); + +if (p->path->slid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) + pathrec.sgid.global.interface_id = +OPA_MAKE_ID (p->path->slid); + } +spin_unlock_irqrestore (&priv->lock, flags);netif_tx_unlock_bh (dev);
drivers/infiniband/ulp/ipoib/ipoib_main.c +26 -0
@@ -52,6 +52,7 @@#include <linux/inetdevice.h> #include <rdma/ib_cache.h> #include <linux/pci.h> +#include <rdma/ib_addr.h> #define DRV_VERSION "1.0.0"
@@ -766,6 +767,31 @@ static void path_rec_completion(int status,spin_lock_irqsave (&priv->lock, flags);if (!IS_ERR_OR_NULL (ah)) { +/* +* Extended LIDs might get programmed into GIDs in the +* case of OPA devices. Since we have created the ah +* above which would have made use of the lids, now is +* a good time to change them back to regular GIDs after +* saving the extended LIDs. +*/ +if (rdma_cap_opa_ah (priv->ca, priv->port) && +ib_is_opa_gid (&pathrec->sgid)) { + path->slid =opa_get_lid_from_gid (&pathrec->sgid); + pathrec->sgid = path->pathrec.sgid; + }else { + path->slid =be16_to_cpu (pathrec->slid); + } + +if (rdma_cap_opa_ah (priv->ca, priv->port) && +ib_is_opa_gid (&pathrec->dgid)) { + path->dlid =opa_get_lid_from_gid (&pathrec->dgid); + pathrec->dgid = path->pathrec.dgid; + }else { + path->dlid =be16_to_cpu (pathrec->dlid); + } +ipoib_dbg (priv,"PathRec SGID %pI6 DGID %pI6\n" , + pathrec->sgid.raw, pathrec->dgid.raw); + path->pathrec = *pathrec; old_ah = path->ah;
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +1 -1
@@ -581,7 +581,7 @@ void ipoib_mcast_join_task(struct work_struct *work) port_attr.state);return ; } - priv->local_lid = (u16 )port_attr.lid; + priv->local_lid = port_attr.lid;netif_addr_lock_bh (dev);if (!test_bit (IPOIB_FLAG_DEV_ADDR_SET , &priv->flags)) {
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 9/11 IB/IPoIB: Modify ipoib_get_net_dev_by_params to lookup gid table
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
ipoib_get_net_dev_by_params compares incoming gid with local_gid which is gid at index 0 of the gid table. OPA devices using larger LIDs may have a different GID format than whats setup in the local_gid field. Do a search of the gid table in those cases.
--- drivers/infiniband/ulp/ipoib/ipoib_main.c | 37 +++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/ipoib/ipoib_main.c +35 -2
@@ -328,6 +328,40 @@ out:return result; } +/* retuns true if the incoming gid is assigned to the IPoIB +* netdev interface +* +* OPA devices may have the incoming GID in the OPA GID +* format which might not necessarily be assigned to the +* netdev interface. This necessitates searching the GID +* table to match this OPA GID. +*/ +static bool ipoib_check_gid (struct ipoib_dev_priv *priv, +const union ib_gid *gid) +{ +bool is_local_gid; +struct ib_port_attr attr; +union ib_gid port_gid; +int i; + +if (!gid) +return true; + + is_local_gid = !memcmp (gid, &priv->local_gid,sizeof (*gid)); + +if (!rdma_cap_opa_ah (priv->ca, priv->port) || is_local_gid) +return is_local_gid; + +if (ib_query_port (priv->ca, priv->port, &attr)) +return false; +for (i =1 ; i < attr.gid_tbl_len; i++) { +if (ib_query_gid (priv->ca, priv->port, i, &port_gid,NULL )) +return false; +if (!memcmp (gid, &port_gid,sizeof (*gid))) +return true; + } +return false; +}/* returns the number of IPoIB netdevs on top a given ipoib device matching a * pkey_index and address, if one exists. *
@@ -344,8 +378,7 @@ static int ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,struct net_device *net_dev =NULL ;int matches =0 ; -if (priv->pkey_index == pkey_index && - (!gid || !memcmp (gid, &priv->local_gid,sizeof (*gid)))) { +if (priv->pkey_index == pkey_index &&ipoib_check_gid (priv, gid)) {if (!addr) { net_dev =ipoib_get_master_net_dev (priv->dev); }else {
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 10/11 IB/srpt: Increase lid and sm_lid to 32 bits
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
srpt contains lid and sm_lid fields which are 16 bits in length, increase them to 32 bits.
--- drivers/infiniband/ulp/srpt/ib_srpt.c | 4 ++-- drivers/infiniband/ulp/srpt/ib_srpt.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.c +2 -2
@@ -514,8 +514,8 @@ static int srpt_refresh_port(struct srpt_port *sport)if (ret) goto err_query_port; - sport->sm_lid = (u16 )port_attr.sm_lid; - sport->lid = (u16 )port_attr.lid; + sport->sm_lid = port_attr.sm_lid; + sport->lid = port_attr.lid; ret =ib_query_gid (sport->sdev->device, sport->port,0 , &sport->gid,NULL );
drivers/infiniband/ulp/srpt/ib_srpt.h +2 -2
@@ -322,8 +322,8 @@ struct srpt_port {bool enabled;u8 port_guid[64 ];u8 port; -u16 sm_lid; -u16 lid; +u32 sm_lid; +u32 lid;union ib_gid gid;struct work_struct work;struct se_portal_group port_tpg_1;
Signature · 6 lines
1.8.2 -- 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
RFC PATCH 11/11 IB/rdmavt: Modify rvt_check_ah() to account for extended LIDs
In reply to a message not in the archiveFrom: Don Hiatt <[email protected]>
rvt_check_ah() delegates lid verification to underlying driver. Underlying driver uses different conditions to check for dlid depending on whether the device supports extended LIDs
--- drivers/infiniband/hw/hfi1/hfi.h | 1 + drivers/infiniband/hw/hfi1/verbs.c | 13 +++++++++++++ drivers/infiniband/hw/qib/qib_verbs.c | 9 +++++++++ drivers/infiniband/sw/rdmavt/ah.c | 10 ---------- drivers/infiniband/sw/rdmavt/qp.c | 9 ++++++--- 5 files changed, 29 insertions(+), 13 deletions(-)
drivers/infiniband/hw/hfi1/hfi.h +1 -0
@@ -67,6 +67,7 @@#include <rdma/ib_hdrs.h> #include <linux/rhashtable.h> #include <rdma/rdma_vt.h> +#include <rdma/ib_addr.h> #include "chip_registers.h" #include "common.h"
drivers/infiniband/hw/hfi1/verbs.c +13 -0
@@ -1510,7 +1510,20 @@ static int hfi1_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)struct hfi1_pportdata *ppd;struct hfi1_devdata *dd;u8 sc5; +u32 lid; +if ((ah_attr->ah_flags &IB_AH_GRH ) && +ib_is_opa_gid (&ah_attr->grh.dgid)) { + lid =opa_get_lid_from_gid (&ah_attr->grh.dgid); +if (lid !=OPA_LID_PERMISSIVE ) +return -EINVAL ; + }else { + lid = ah_attr->dlid; +if ((lid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) && + (lid !=be16_to_cpu (IB_LID_PERMISSIVE )) && + (!(ah_attr->ah_flags &IB_AH_GRH ))) +return -EINVAL ; + }/* test the mapping for validity */ ibp =to_iport (ibdev, ah_attr->port_num); ppd =ppd_from_ibp (ibp);
drivers/infiniband/hw/qib/qib_verbs.c +9 -0
@@ -1426,6 +1426,15 @@ int qib_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr)if (ah_attr->sl >15 )return -EINVAL ; +if (ah_attr->dlid ==0 ) +return -EINVAL ; +if (ah_attr->dlid >= +be16_to_cpu (IB_MULTICAST_LID_BASE ) && + ah_attr->dlid != +be16_to_cpu (IB_LID_PERMISSIVE ) && + !(ah_attr->ah_flags &IB_AH_GRH )) +return -EINVAL ; +return 0 ; }
drivers/infiniband/sw/rdmavt/ah.c +0 -10
@@ -65,8 +65,6 @@ int rvt_check_ah(struct ib_device *ibdev,int err;struct ib_port_attr port_attr;struct rvt_dev_info *rdi =ib_to_rvt (ibdev); -enum rdma_link_layer link =rdma_port_get_link_layer (ibdev, - ah_attr->port_num); err =ib_query_port (ibdev, ah_attr->port_num, &port_attr);if (err)
@@ -80,14 +78,6 @@ int rvt_check_ah(struct ib_device *ibdev,if ((ah_attr->ah_flags &IB_AH_GRH ) && ah_attr->grh.sgid_index >= port_attr.gid_tbl_len)return -EINVAL ; -if (link !=IB_LINK_LAYER_ETHERNET ) { -if (ah_attr->dlid ==0 ) -return -EINVAL ; -if (ah_attr->dlid >=be16_to_cpu (IB_MULTICAST_LID_BASE ) && - ah_attr->dlid !=be16_to_cpu (IB_LID_PERMISSIVE ) && - !(ah_attr->ah_flags &IB_AH_GRH )) -return -EINVAL ; - }if (rdi->driver_f.check_ah)return rdi->driver_f.check_ah (ibdev, ah_attr);return 0 ;
drivers/infiniband/sw/rdmavt/qp.c +6 -3
@@ -1035,6 +1035,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,int mig =0 ;int pmtu =0 ;/* for gcc warning only */ enum rdma_link_layer link; +int opa_ah; link =rdma_port_get_link_layer (ibqp->device, qp->port_num);
@@ -1045,6 +1046,7 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, cur_state = attr_mask &IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask &IB_QP_STATE ? attr->qp_state : cur_state; + opa_ah =rdma_cap_opa_ah (ibqp->device, qp->port_num);if (!ib_modify_qp_is_ok (cur_state, new_state, ibqp->qp_type, attr_mask, link))
@@ -1055,15 +1057,16 @@ int rvt_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, goto inval;if (attr_mask &IB_QP_AV ) { -if (attr->ah_attr.dlid >=be16_to_cpu (IB_MULTICAST_LID_BASE )) +if (!opa_ah && (attr->ah_attr.dlid >= +be16_to_cpu (IB_MULTICAST_LID_BASE ))) goto inval;if (rvt_check_ah (qp->ibqp.device, &attr->ah_attr)) goto inval; }if (attr_mask &IB_QP_ALT_PATH ) { -if (attr->alt_ah_attr.dlid >= -be16_to_cpu (IB_MULTICAST_LID_BASE )) +if (!opa_ah && (attr->alt_ah_attr.dlid >= +be16_to_cpu (IB_MULTICAST_LID_BASE ))) goto inval;if (rvt_check_ah (qp->ibqp.device, &attr->alt_ah_attr)) goto inval;
Signature · 6 lines
1.8.2 -- 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
Re: [RFC PATCH 03/11] IB/sa: Modify SM Address handle to program GRH when using large lids
In reply to a message not in the archiveQuoted 5 lines · On Fri, Sep 23, 2016 at 01:44:26PM -0400…
From: Don Hiatt <[email protected]>
When either the port lid or the sm lid is above the ib unicast lid space, the SMI creates an address handle with the revelant GRH information.
Woah, I though you were only using that horrible GID hack for the uABI.
Don't do such crazy things in the kernel. Fix the internal kernel to support your larger lid.
Jason
--
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
Bart Van Assche
Reviewed-byRe: [RFC PATCH 10/11] IB/srpt: Increase lid and sm_lid to 32 bits
In reply to a message not in the archiveQuoted 2 lines · On 09/23/2016 10:44 AM, [email protected] wrote:
srpt contains lid and
sm_lidfields which are 16 bits in length, increase them to 32 bits.
--
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
Re: [RFC PATCH 03/11] IB/sa: Modify SM Address handle to program GRH when using large lids
In reply to a message not in the archiveThe reason for doing this in the kernel was that we wanted a more uniform approach in specifying extended LIDs across the user and the kernel space. This also meant we could leave the ah_attr.dlid field in the kernel to be 16 bits.
We will extend ah_attr.dlid to 32 bits in the kernel per your suggestion. This should make specifying extended LID information in the GRH of the address handle unnecessary.
Thanks,
Dasa
Quoted 7 lines · Jason Gunthorpe
Quoted 5 lines · On Fri, Sep 23, 2016 at 01:44:26PM -0400…
From: Don Hiatt <[email protected]>
When either the port lid or the sm lid is above the ib unicast lid space, the SMI creates an address handle with the revelant GRH information.
Quoted 8 lines
Woah, I though you were only using that horrible GID hack for the uABI.
Don't do such crazy things in the kernel. Fix the internal kernel to support your larger lid.
Jason
--
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