Add OPA extended LID support
Subsystems (6)
v3 cover Add OPA extended LID support
This patch series primarily increases sizes of variables that hold lid values from 16 to 32 bits. Additionally, it adds a check in the IB mad stack to verify a properly formatted MAD when OPA extended LIDs are used.
Changes from v2:
---------------
* Remove 'IB/mad: Ensure DR MADs are correctly specified when using OPA devices' as this will be handled in a lower layer.
Changes from v1:
---------------
* Remove extraneous slid set.
* Replace slid casts with helper function.
* Return default subnet prefix on rdma_ah_conv_opa_to_ib() failure.
The patches are origanized as follows:
* Patch 1 converts an OPA ah_attr to an IB ah_attr when copying from kernel to user. Since OPA ah_attr is only defined in the kernel, the function takes care of adding OPA GIDs that contain the extended LID before copying to user.
* Patch 2 increases the lid and sm_lid variables in srpt to 32 bits.
* Patch 3 increases the local_lid variable in IPoIB to 32 bits.
* Patch 4 increases the slid variable in MAD RMPP to 32 bits.
* Patch 5 increases the lid field in struct ib_port_attr from 16 to 32 bits.
* Patch 6 increases the sm_lid field in struct ib_port_attr from 16 to 32 bits.
* Patch 7 increases the slid field in struct ib_wc from 16 to 32 bits.
Dasaratharaman Chandramouli (6):
IB/core: Convert ah_attr from OPA to IB when copying to user IB/srpt: Increase lid and sm_lid to 32 bits IB/IPoIB: Increase local_lid to 32 bits
IB/mad: Change slid in RMPP recv from 16 to 32 bits IB/core: Change port_attr.lid size from 16 to 32 bits IB/core: Change port_attr.sm_lid from 16 to 32 bits
Don Hiatt (1):
IB/core: Change wc.slid from 16 to 32 bits
drivers/infiniband/core/cm.c | 4 +-- drivers/infiniband/core/core_priv.h | 1 + drivers/infiniband/core/mad_rmpp.c | 2 +- drivers/infiniband/core/ucm.c | 2 +- drivers/infiniband/core/ucma.c | 10 ++++--- drivers/infiniband/core/user_mad.c | 2 +- drivers/infiniband/core/uverbs_cmd.c | 19 ++++++++---- drivers/infiniband/core/uverbs_marshall.c | 48 +++++++++++++++++++++++++++---- drivers/infiniband/hw/hfi1/mad.c | 2 +- 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/sw/rdmavt/cq.c | 2 +- drivers/infiniband/ulp/ipoib/ipoib.h | 2 +- drivers/infiniband/ulp/srpt/ib_srpt.h | 4 +-- include/rdma/ib_marshall.h | 6 ++-- include/rdma/ib_verbs.h | 18 ++++++++++-- include/rdma/opa_addr.h | 3 +- 20 files changed, 105 insertions(+), 40 deletions(-)
Signature · 6 lines
1.8.3.1 -- 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
PATCH v3 1/7 IB/core: Convert ah_attr from OPA to IB when copying to user
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
OPA address handle atttibutes that have 32 bit LIDs would have to be converted to IB address handle attribute with the LID field programmed in the GID before copying to user space.
--- drivers/infiniband/core/ucm.c | 2 +- drivers/infiniband/core/ucma.c | 10 ++++--- drivers/infiniband/core/uverbs_marshall.c | 48 +++++++++++++++++++++++++++---- include/rdma/ib_marshall.h | 6 ++-- 4 files changed, 54 insertions(+), 12 deletions(-)
drivers/infiniband/core/ucm.c +1 -1
@@ -618,7 +618,7 @@ static ssize_t ib_ucm_init_qp_attr(struct ib_ucm_file *file,if (result) goto out; -ib_copy_qp_attr_to_user (&resp, &qp_attr); +ib_copy_qp_attr_to_user (ctx->cm_id->device, &resp, &qp_attr);if (copy_to_user ((void __user *)(unsigned long )cmd.response, &resp,sizeof (resp)))
drivers/infiniband/core/ucma.c +6 -4
@@ -248,14 +248,15 @@ static void ucma_copy_conn_event(struct rdma_ucm_conn_param *dst, dst->qp_num = src->qp_num; } -static void ucma_copy_ud_event (struct rdma_ucm_ud_param *dst, +static void ucma_copy_ud_event (struct ib_device *device, +struct rdma_ucm_ud_param *dst,struct rdma_ud_param *src) {if (src->private_data_len)memcpy (dst->private_data, src->private_data, src->private_data_len); dst->private_data_len = src->private_data_len; -ib_copy_ah_attr_to_user (&dst->ah_attr, &src->ah_attr); +ib_copy_ah_attr_to_user (device, &dst->ah_attr, &src->ah_attr); dst->qp_num = src->qp_num; dst->qkey = src->qkey; }
@@ -335,7 +336,8 @@ static int ucma_event_handler(struct rdma_cm_id *cm_id, uevent->resp.event = event->event; uevent->resp.status = event->status;if (cm_id->qp_type ==IB_QPT_UD ) -ucma_copy_ud_event (&uevent->resp.param.ud, &event->param.ud); +ucma_copy_ud_event (cm_id->device, &uevent->resp.param.ud, + &event->param.ud);else ucma_copy_conn_event (&uevent->resp.param.conn, &event->param.conn);
@@ -1157,7 +1159,7 @@ static ssize_t ucma_init_qp_attr(struct ucma_file *file,if (ret) goto out; -ib_copy_qp_attr_to_user (&resp, &qp_attr); +ib_copy_qp_attr_to_user (ctx->cm_id->device, &resp, &qp_attr);if (copy_to_user ((void __user *)(unsigned long )cmd.response, &resp,sizeof (resp))) ret = -EFAULT ;
drivers/infiniband/core/uverbs_marshall.c +43 -5
68 lines not on this page · raw message
include/rdma/ib_marshall.h +4 -2
@@ -38,10 +38,12 @@#include <rdma/ib_user_verbs.h> #include <rdma/ib_user_sa.h> -void ib_copy_qp_attr_to_user (struct ib_uverbs_qp_attr *dst, +void ib_copy_qp_attr_to_user (struct ib_device *device, +struct ib_uverbs_qp_attr *dst,struct ib_qp_attr *src); -void ib_copy_ah_attr_to_user (struct ib_uverbs_ah_attr *dst, +void ib_copy_ah_attr_to_user (struct ib_device *device, +struct ib_uverbs_ah_attr *dst,struct rdma_ah_attr *src); void ib_copy_path_rec_to_user(struct ib_user_path_rec *dst,
Signature · 6 lines
1.8.3.1 -- 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
PATCH v3 2/7 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.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/ulp/srpt/ib_srpt.h +2 -2
@@ -328,8 +328,8 @@ struct srpt_port {u8 port_guid[24 ];u8 port_gid[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_guid_tpg;
Signature · 6 lines
1.8.3.1 -- 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
PATCH v3 3/7 IB/IPoIB: Increase local_lid to 32 bits
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
IPoIB contains local_lid field which is 16 bits in length, increase it to 32 bits.
--- drivers/infiniband/ulp/ipoib/ipoib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/ulp/ipoib/ipoib.h +1 -1
@@ -366,7 +366,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;
Signature · 6 lines
1.8.3.1 -- 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
PATCH v3 4/7 IB/mad: Change slid in RMPP recv from 16 to 32 bits
In reply to a message not in the archiveFrom: Dasaratharaman Chandramouli <dasaratharaman.chandramouli-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
MAD RMPP contains slid field which is 16 bits in
length, increase it to 32 bits.
--- drivers/infiniband/core/mad_rmpp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/core/mad_rmpp.c +1 -1
@@ -64,7 +64,7 @@ struct mad_rmpp_recv {__be64 tid;u32 src_qp; -u16 slid; +u32 slid;u8 mgmt_class;u8 class_version;u8 method;
Signature · 6 lines
1.8.3.1 -- 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
PATCH v3 5/7 IB/core: Change port_attr.lid size 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 struct ib_port_attr is increased to 32 bits. This enables core components to use larger LIDs if needed.
The user ABI is unchanged and return 16 bit values when queried.
--- drivers/infiniband/core/core_priv.h | 1 + drivers/infiniband/core/uverbs_cmd.c | 5 ++++- drivers/infiniband/hw/mlx4/alias_GUID.c | 2 +- drivers/infiniband/hw/mlx4/mad.c | 2 +- drivers/infiniband/hw/mthca/mthca_mad.c | 2 +- include/rdma/ib_verbs.h | 2 +- include/rdma/opa_addr.h | 3 ++- 7 files changed, 11 insertions(+), 6 deletions(-)
drivers/infiniband/core/core_priv.h +1 -0
@@ -38,6 +38,7 @@#include <linux/cgroup_rdma.h> #include <rdma/ib_verbs.h> +#include <rdma/opa_addr.h> #if IS_ENABLED (CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS )int cma_configfs_init (void );
drivers/infiniband/core/uverbs_cmd.c +4 -1
@@ -275,8 +275,11 @@ 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; resp.sm_lid = attr.sm_lid; +if (rdma_cap_opa_ah (ib_dev, cmd.port_num)) + resp.lid =OPA_TO_IB_UCAST_LID (attr.lid); +else + 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
@@ -528,7 +528,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
@@ -860,7 +860,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
@@ -256,7 +256,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,
include/rdma/ib_verbs.h +1 -1
@@ -548,8 +548,8 @@ struct ib_port_attr {u32 bad_pkey_cntr;u32 qkey_viol_cntr;u16 pkey_tbl_len; -u16 lid;u16 sm_lid; +u32 lid;u8 lmc;u8 max_vl_num;u8 sm_sl;
include/rdma/opa_addr.h +2 -1
@@ -50,7 +50,8 @@#define OPA_SPECIAL_OUI (0x00066AULL)#define OPA_MAKE_ID (x) (cpu_to_be64(OPA_SPECIAL_OUI << 40 | (x))) - +#define OPA_TO_IB_UCAST_LID (x) (((x) >= be16_to_cpu(IB_MULTICAST_LID_BASE)) \ + ? 0 : x)/** * ib_is_opa_gid: Returns true if the top 24 bits of the gid * contains the OPA_STL_OUI identifier. This identifies that
Signature · 6 lines
1.8.3.1 -- 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
PATCH v3 6/7 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 struct ib_port_attr is increased to 32 bits. This enables core components to use larger LIDs if needed. The user ABI is unchanged and return 16 bit values when queried.
--- drivers/infiniband/core/uverbs_cmd.c | 8 +++++--- include/rdma/ib_verbs.h | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +5 -3
@@ -275,11 +275,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.sm_lid = attr.sm_lid; -if (rdma_cap_opa_ah (ib_dev, cmd.port_num)) +if (rdma_cap_opa_ah (ib_dev, cmd.port_num)) { resp.lid =OPA_TO_IB_UCAST_LID (attr.lid); -else + resp.sm_lid =OPA_TO_IB_UCAST_LID (attr.sm_lid); + }else { resp.lid = (u16 )attr.lid; + 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;
include/rdma/ib_verbs.h +1 -1
@@ -548,7 +548,7 @@ struct ib_port_attr {u32 bad_pkey_cntr;u32 qkey_viol_cntr;u16 pkey_tbl_len; -u16 sm_lid; +u32 sm_lid;u32 lid;u8 lmc;u8 max_vl_num;
Signature · 6 lines
1.8.3.1 -- 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
PATCH v3 7/7 IB/core: Change wc.slid from 16 to 32 bits
In reply to a message not in the archiveslid field in struct ib_wc is increased to 32 bits. This enables core components to use larger LIDs if needed. The user ABI is unchanged and return 16 bit values when queried.
--- drivers/infiniband/core/cm.c | 4 ++-- drivers/infiniband/core/user_mad.c | 2 +- drivers/infiniband/core/uverbs_cmd.c | 10 +++++++--- 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 | 14 +++++++++++++- 10 files changed, 32 insertions(+), 16 deletions(-)
drivers/infiniband/core/cm.c +2 -2
@@ -1703,7 +1703,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 =ib_slid_be16 (wc->slid);cm_req_set_primary_sl (req_msg, wc->sl); }
@@ -1713,7 +1713,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 =ib_slid_be16 (wc->slid);cm_req_set_alt_sl (req_msg, wc->sl); }
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 =ib_slid_be16 (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 +7 -3
@@ -1190,7 +1190,8 @@ ssize_t ib_uverbs_resize_cq(struct ib_uverbs_file *file,return ret ? ret : in_len; } -static int copy_wc_to_user (void __user *dest,struct ib_wc *wc) +static int copy_wc_to_user (struct ib_device *ib_dev,void __user *dest, +struct ib_wc *wc) {struct ib_uverbs_wc tmp;
@@ -1204,7 +1205,10 @@ 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; +if (rdma_cap_opa_ah (ib_dev, wc->port_num)) + tmp.slid =OPA_TO_IB_UCAST_LID (wc->slid); +else + tmp.slid =ib_slid_cpu16 (wc->slid); tmp.sl = wc->sl; tmp.dlid_path_bits = wc->dlid_path_bits; tmp.port_num = wc->port_num;
@@ -1248,7 +1252,7 @@ ssize_t ib_uverbs_poll_cq(struct ib_uverbs_file *file,if (!ret)break ; - ret =copy_wc_to_user (data_ptr, &wc); + ret =copy_wc_to_user (ib_dev, data_ptr, &wc);if (ret) goto out_put;
drivers/infiniband/hw/hfi1/mad.c +1 -1
@@ -4022,7 +4022,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; +u16 slid =ib_slid_cpu16 (in_wc->slid);u16 pkey;if (in_wc->pkey_index >=ARRAY_SIZE (ppd->pkeys))
drivers/infiniband/hw/mlx4/mad.c +3 -3
@@ -169,7 +169,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 |=ib_slid_cpu16 (in_wc->slid) <<16 ; } err = mlx4_cmd_box(dev->dev, inmailbox->dma, outmailbox->dma, in_modifier,
@@ -625,7 +625,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 =ib_slid_be16 (wc->slid); } ib_dma_sync_single_for_device(&dev->ib_dev,
@@ -826,7 +826,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 ?ib_slid_cpu16 (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
@@ -78,7 +78,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 ?ib_slid_cpu16 (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
@@ -1921,7 +1921,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,ib_slid_cpu16 (in_wc->slid),MAD_IFC_RLID_OFFSET );MTHCA_PUT (inbox, in_wc->pkey_index,MAD_IFC_PKEY_OFFSET );if (in_grh)
@@ -1929,7 +1929,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 |=ib_slid_cpu16 (in_wc->slid) <<16 ; } err = mthca_cmd_box(dev, inmailbox->dma, outmailbox->dma,
drivers/infiniband/hw/mthca/mthca_mad.c +1 -1
@@ -205,7 +205,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 ?ib_slid_cpu16 (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
@@ -107,7 +107,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 =ib_slid_cpu16 (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 +13 -1
@@ -950,7 +950,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 */
@@ -3643,4 +3643,16 @@ static inline enum rdma_ah_attr_type rdma_ah_find_type(struct ib_device *dev, else return RDMA_AH_ATTR_TYPE_IB; } + +/* Return slid in 16bit CPU encoding */ +static inline u16 ib_slid_cpu16 (u32 slid) +{ +return (u16 )slid; +} + +/* Return slid in 16bit BE encoding */ +static inline u16 ib_slid_be16 (u32 slid) +{ +return cpu_to_be16 ((u16 )slid); +}#endif /* IB_VERBS_H */
Signature · 6 lines
1.8.3.1 -- 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: [PATCH rdma-next v3 7/7] IB/core: Change wc.slid from 16 to 32 bits
In reply to a message not in the archiveQuoted 3 lines · Don Hiatt
slid field in struct
ib_wcis increased to 32 bits. This enables core components to use larger LIDs if needed. The user ABI is unchanged and return 16 bit values when queried.
Hi Don,
My comments here are not really about this particular patch, I just grabbed it from the pile as one to respond to. But my question is this:
Multiple of these patch say the user ABI is unchanged and return 16 bit values when queried. What's your plan for a long term solution to this? Eventually, the user ABI will need to be extended to support 32bit LIDs, yes? Or do you plan to try and hide this forever?
As for the kernel to user space driver API, I waffled a bit about whether we shouldn't go ahead and return the 32bit value to the driver and let it do the conversion to 16 bit for the user ABI, then decided this method provides a cleaner means of supporting newer kernels with older verbs OPA drivers and so didn't object, but it still leaves the question about the long term plans here.
Signature · 8 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- 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: [PATCH rdma-next v3 7/7] IB/core: Change wc.slid from 16 to 32 bits
In reply to a message not in the archiveQuoted 15 lines · Doug Ledford
Quoted 3 lines · Don Hiatt
slid field in struct
ib_wcis increased to 32 bits. This enables core components to use larger LIDs if needed. The user ABI is unchanged and return 16 bit values when queried.Hi Don,
My comments here are not really about this particular patch, I just grabbed it from the pile as one to respond to. But my question is this:
Multiple of these patch say the user ABI is unchanged and return 16 bit values when queried. What's your plan for a long term solution to this? Eventually, the user ABI will need to be extended to support 32bit LIDs, yes? Or do you plan to try and hide this forever?
Quoted 7 lines
As for the kernel to user space driver API, I waffled a bit about whether we shouldn't go ahead and return the 32bit value to the driver and let it do the conversion to 16 bit for the user ABI, then decided this method provides a cleaner means of supporting newer kernels with older verbs OPA drivers and so didn't object, but it still leaves the question about the long term plans here.
Hi Doug,
Our long term plan is to use the new verbs 2 API for extending the LID size. We do not plan to keep this hidden forever and plan to use the new API once it's available.
Thanks.
don
--
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: [PATCH rdma-next v3 7/7] IB/core: Change wc.slid from 16 to 32 bits
In reply to a message not in the archiveQuoted 23 lines · Don Hiatt
Quoted 15 lines · Doug Ledford
Quoted 3 lines · Don Hiatt
slid field in struct
ib_wcis increased to 32 bits. This enables core components to use larger LIDs if needed. The user ABI is unchanged and return 16 bit values when queried.Hi Don,
My comments here are not really about this particular patch, I just grabbed it from the pile as one to respond to. But my question is this:
Multiple of these patch say the user ABI is unchanged and return 16 bit values when queried. What's your plan for a long term solution to this? Eventually, the user ABI will need to be extended to support 32bit LIDs, yes? Or do you plan to try and hide this forever?
Quoted 7 lines
As for the kernel to user space driver API, I waffled a bit about whether we shouldn't go ahead and return the 32bit value to the driver and let it do the conversion to 16 bit for the user ABI, then decided this method provides a cleaner means of supporting newer kernels with older verbs OPA drivers and so didn't object, but it still leaves the question about the long term plans here.
Quoted 5 lines
Hi Doug,
Our long term plan is to use the new verbs 2 API for extending the LID size. We do not plan to keep this hidden forever and plan to use the new API once it's available.
Good. That's more or less what I wanted to hear ;-). Thanks.
Signature · 3 lines
Doug Ledford <[email protected]> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD
Quoted 9 lines · Don Hiatt
This patch series primarily increases sizes of variables that hold lid values from 16 to 32 bits. Additionally, it adds a check in the IB mad stack to verify a properly formatted MAD when OPA extended LIDs are used.
Changes from v2:
---------------
* Remove 'IB/mad: Ensure DR MADs are correctly specified when using OPA devices' as this will be handled in a lower layer.
Hi Don,
Thanks, series applied.
Signature · 8 lines
Doug Ledford <[email protected]> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- 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