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

IB/mad: Support alternate Base Versions when creating MADs

In preparation to support the new OPA MAD Base version, add a base version
parameter to ib_create_send_mad and set it to IB_MGMT_BASE_VERSION for current
users.

Definition of the new base version and it's processing will occur in later
patches.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>

authored by

Ira Weiny and committed by
Doug Ledford
da2dfaa3 29869eaf

+29 -14
+2 -1
drivers/infiniband/core/agent.c
··· 108 108 109 109 send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0, 110 110 IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, 111 - GFP_KERNEL); 111 + GFP_KERNEL, 112 + IB_MGMT_BASE_VERSION); 112 113 if (IS_ERR(send_buf)) { 113 114 dev_err(&device->dev, "ib_create_send_mad error\n"); 114 115 goto err1;
+4 -2
drivers/infiniband/core/cm.c
··· 267 267 m = ib_create_send_mad(mad_agent, cm_id_priv->id.remote_cm_qpn, 268 268 cm_id_priv->av.pkey_index, 269 269 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, 270 - GFP_ATOMIC); 270 + GFP_ATOMIC, 271 + IB_MGMT_BASE_VERSION); 271 272 if (IS_ERR(m)) { 272 273 ib_destroy_ah(ah); 273 274 return PTR_ERR(m); ··· 298 297 299 298 m = ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index, 300 299 0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA, 301 - GFP_ATOMIC); 300 + GFP_ATOMIC, 301 + IB_MGMT_BASE_VERSION); 302 302 if (IS_ERR(m)) { 303 303 ib_destroy_ah(ah); 304 304 return PTR_ERR(m);
+2 -1
drivers/infiniband/core/mad.c
··· 920 920 u32 remote_qpn, u16 pkey_index, 921 921 int rmpp_active, 922 922 int hdr_len, int data_len, 923 - gfp_t gfp_mask) 923 + gfp_t gfp_mask, 924 + u8 base_version) 924 925 { 925 926 struct ib_mad_agent_private *mad_agent_priv; 926 927 struct ib_mad_send_wr_private *mad_send_wr;
+4 -2
drivers/infiniband/core/mad_rmpp.c
··· 139 139 hdr_len = ib_get_mad_data_offset(recv_wc->recv_buf.mad->mad_hdr.mgmt_class); 140 140 msg = ib_create_send_mad(&rmpp_recv->agent->agent, recv_wc->wc->src_qp, 141 141 recv_wc->wc->pkey_index, 1, hdr_len, 142 - 0, GFP_KERNEL); 142 + 0, GFP_KERNEL, 143 + IB_MGMT_BASE_VERSION); 143 144 if (IS_ERR(msg)) 144 145 return; 145 146 ··· 166 165 hdr_len = ib_get_mad_data_offset(recv_wc->recv_buf.mad->mad_hdr.mgmt_class); 167 166 msg = ib_create_send_mad(agent, recv_wc->wc->src_qp, 168 167 recv_wc->wc->pkey_index, 1, 169 - hdr_len, 0, GFP_KERNEL); 168 + hdr_len, 0, GFP_KERNEL, 169 + IB_MGMT_BASE_VERSION); 170 170 if (IS_ERR(msg)) 171 171 ib_destroy_ah(ah); 172 172 else {
+2 -1
drivers/infiniband/core/sa_query.c
··· 583 583 query->mad_buf = ib_create_send_mad(query->port->agent, 1, 584 584 query->sm_ah->pkey_index, 585 585 0, IB_MGMT_SA_HDR, IB_MGMT_SA_DATA, 586 - gfp_mask); 586 + gfp_mask, 587 + IB_MGMT_BASE_VERSION); 587 588 if (IS_ERR(query->mad_buf)) { 588 589 kref_put(&query->sm_ah->ref, free_sm_ah); 589 590 return -ENOMEM;
+2 -1
drivers/infiniband/core/user_mad.c
··· 520 520 packet->msg = ib_create_send_mad(agent, 521 521 be32_to_cpu(packet->mad.hdr.qpn), 522 522 packet->mad.hdr.pkey_index, rmpp_active, 523 - hdr_len, data_len, GFP_KERNEL); 523 + hdr_len, data_len, GFP_KERNEL, 524 + IB_MGMT_BASE_VERSION); 524 525 if (IS_ERR(packet->msg)) { 525 526 ret = PTR_ERR(packet->msg); 526 527 goto err_ah;
+2 -1
drivers/infiniband/hw/mlx4/mad.c
··· 367 367 368 368 if (agent) { 369 369 send_buf = ib_create_send_mad(agent, qpn, 0, 0, IB_MGMT_MAD_HDR, 370 - IB_MGMT_MAD_DATA, GFP_ATOMIC); 370 + IB_MGMT_MAD_DATA, GFP_ATOMIC, 371 + IB_MGMT_BASE_VERSION); 371 372 if (IS_ERR(send_buf)) 372 373 return; 373 374 /*
+2 -1
drivers/infiniband/hw/mthca/mthca_mad.c
··· 170 170 171 171 if (agent) { 172 172 send_buf = ib_create_send_mad(agent, qpn, 0, 0, IB_MGMT_MAD_HDR, 173 - IB_MGMT_MAD_DATA, GFP_ATOMIC); 173 + IB_MGMT_MAD_DATA, GFP_ATOMIC, 174 + IB_MGMT_BASE_VERSION); 174 175 if (IS_ERR(send_buf)) 175 176 return; 176 177 /*
+2 -1
drivers/infiniband/hw/qib/qib_iba7322.c
··· 5502 5502 goto retry; 5503 5503 5504 5504 send_buf = ib_create_send_mad(agent, 0, 0, 0, IB_MGMT_MAD_HDR, 5505 - IB_MGMT_MAD_DATA, GFP_ATOMIC); 5505 + IB_MGMT_MAD_DATA, GFP_ATOMIC, 5506 + IB_MGMT_BASE_VERSION); 5506 5507 if (IS_ERR(send_buf)) 5507 5508 goto retry; 5508 5509
+2 -1
drivers/infiniband/hw/qib/qib_mad.c
··· 83 83 return; 84 84 85 85 send_buf = ib_create_send_mad(agent, 0, 0, 0, IB_MGMT_MAD_HDR, 86 - IB_MGMT_MAD_DATA, GFP_ATOMIC); 86 + IB_MGMT_MAD_DATA, GFP_ATOMIC, 87 + IB_MGMT_BASE_VERSION); 87 88 if (IS_ERR(send_buf)) 88 89 return; 89 90
+2 -1
drivers/infiniband/ulp/srpt/ib_srpt.c
··· 476 476 rsp = ib_create_send_mad(mad_agent, mad_wc->wc->src_qp, 477 477 mad_wc->wc->pkey_index, 0, 478 478 IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA, 479 - GFP_KERNEL); 479 + GFP_KERNEL, 480 + IB_MGMT_BASE_VERSION); 480 481 if (IS_ERR(rsp)) 481 482 goto err_rsp; 482 483
+3 -1
include/rdma/ib_mad.h
··· 618 618 * automatically adjust the allocated buffer size to account for any 619 619 * additional padding that may be necessary. 620 620 * @gfp_mask: GFP mask used for the memory allocation. 621 + * @base_version: Base Version of this MAD 621 622 * 622 623 * This routine allocates a MAD for sending. The returned MAD send buffer 623 624 * will reference a data buffer usable for sending a MAD, along ··· 634 633 u32 remote_qpn, u16 pkey_index, 635 634 int rmpp_active, 636 635 int hdr_len, int data_len, 637 - gfp_t gfp_mask); 636 + gfp_t gfp_mask, 637 + u8 base_version); 638 638 639 639 /** 640 640 * ib_is_mad_class_rmpp - returns whether given management class