]> git.ipfire.org Git - people/ms/linux.git/commitdiff
IB/mad: Support alternate Base Versions when creating MADs
authorIra Weiny <ira.weiny@intel.com>
Sat, 6 Jun 2015 18:38:28 +0000 (14:38 -0400)
committerDoug Ledford <dledford@redhat.com>
Fri, 12 Jun 2015 18:49:17 +0000 (14:49 -0400)
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>
12 files changed:
drivers/infiniband/core/agent.c
drivers/infiniband/core/cm.c
drivers/infiniband/core/mad.c
drivers/infiniband/core/mad_rmpp.c
drivers/infiniband/core/sa_query.c
drivers/infiniband/core/user_mad.c
drivers/infiniband/hw/mlx4/mad.c
drivers/infiniband/hw/mthca/mthca_mad.c
drivers/infiniband/hw/qib/qib_iba7322.c
drivers/infiniband/hw/qib/qib_mad.c
drivers/infiniband/ulp/srpt/ib_srpt.c
include/rdma/ib_mad.h

index e51ea76c252339b48677fe5444fcc5b4e0778032..4fe1fb6b37cd67256a4408a569b2010fa0d1b893 100644 (file)
@@ -108,7 +108,8 @@ void agent_send_response(const struct ib_mad *mad, const struct ib_grh *grh,
 
        send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0,
                                      IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
-                                     GFP_KERNEL);
+                                     GFP_KERNEL,
+                                     IB_MGMT_BASE_VERSION);
        if (IS_ERR(send_buf)) {
                dev_err(&device->dev, "ib_create_send_mad error\n");
                goto err1;
index 14423c20c55b5a783eec08cfef3fc000e9ad04c2..32063add9280d15348d98bfe14046f04709d6823 100644 (file)
@@ -267,7 +267,8 @@ static int cm_alloc_msg(struct cm_id_private *cm_id_priv,
        m = ib_create_send_mad(mad_agent, cm_id_priv->id.remote_cm_qpn,
                               cm_id_priv->av.pkey_index,
                               0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
-                              GFP_ATOMIC);
+                              GFP_ATOMIC,
+                              IB_MGMT_BASE_VERSION);
        if (IS_ERR(m)) {
                ib_destroy_ah(ah);
                return PTR_ERR(m);
@@ -297,7 +298,8 @@ static int cm_alloc_response_msg(struct cm_port *port,
 
        m = ib_create_send_mad(port->mad_agent, 1, mad_recv_wc->wc->pkey_index,
                               0, IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
-                              GFP_ATOMIC);
+                              GFP_ATOMIC,
+                              IB_MGMT_BASE_VERSION);
        if (IS_ERR(m)) {
                ib_destroy_ah(ah);
                return PTR_ERR(m);
index ae36d84e45652909102a712a4be45fe87097d70e..b6d56e97bbaf32bc3301d94da79c4ed24c363b6e 100644 (file)
@@ -920,7 +920,8 @@ struct ib_mad_send_buf * ib_create_send_mad(struct ib_mad_agent *mad_agent,
                                            u32 remote_qpn, u16 pkey_index,
                                            int rmpp_active,
                                            int hdr_len, int data_len,
-                                           gfp_t gfp_mask)
+                                           gfp_t gfp_mask,
+                                           u8 base_version)
 {
        struct ib_mad_agent_private *mad_agent_priv;
        struct ib_mad_send_wr_private *mad_send_wr;
index f37878c9c06eb43812b022ba72a034418a1a238e..2379e2dfa400fb753260aea379baba9bd4384ef7 100644 (file)
@@ -139,7 +139,8 @@ static void ack_recv(struct mad_rmpp_recv *rmpp_recv,
        hdr_len = ib_get_mad_data_offset(recv_wc->recv_buf.mad->mad_hdr.mgmt_class);
        msg = ib_create_send_mad(&rmpp_recv->agent->agent, recv_wc->wc->src_qp,
                                 recv_wc->wc->pkey_index, 1, hdr_len,
-                                0, GFP_KERNEL);
+                                0, GFP_KERNEL,
+                                IB_MGMT_BASE_VERSION);
        if (IS_ERR(msg))
                return;
 
@@ -165,7 +166,8 @@ static struct ib_mad_send_buf *alloc_response_msg(struct ib_mad_agent *agent,
        hdr_len = ib_get_mad_data_offset(recv_wc->recv_buf.mad->mad_hdr.mgmt_class);
        msg = ib_create_send_mad(agent, recv_wc->wc->src_qp,
                                 recv_wc->wc->pkey_index, 1,
-                                hdr_len, 0, GFP_KERNEL);
+                                hdr_len, 0, GFP_KERNEL,
+                                IB_MGMT_BASE_VERSION);
        if (IS_ERR(msg))
                ib_destroy_ah(ah);
        else {
index 3d0b7b2f5f61bcb8bcef06b644fca672650716ef..0fae85062a65b8704ddc11a117751df62db9c9d4 100644 (file)
@@ -583,7 +583,8 @@ static int alloc_mad(struct ib_sa_query *query, gfp_t gfp_mask)
        query->mad_buf = ib_create_send_mad(query->port->agent, 1,
                                            query->sm_ah->pkey_index,
                                            0, IB_MGMT_SA_HDR, IB_MGMT_SA_DATA,
-                                           gfp_mask);
+                                           gfp_mask,
+                                           IB_MGMT_BASE_VERSION);
        if (IS_ERR(query->mad_buf)) {
                kref_put(&query->sm_ah->ref, free_sm_ah);
                return -ENOMEM;
index e58d701b779110eb29e20539b2c77ec5d96abc93..d4286712405dce80f24bc24562bbe3380eecac0f 100644 (file)
@@ -520,7 +520,8 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
        packet->msg = ib_create_send_mad(agent,
                                         be32_to_cpu(packet->mad.hdr.qpn),
                                         packet->mad.hdr.pkey_index, rmpp_active,
-                                        hdr_len, data_len, GFP_KERNEL);
+                                        hdr_len, data_len, GFP_KERNEL,
+                                        IB_MGMT_BASE_VERSION);
        if (IS_ERR(packet->msg)) {
                ret = PTR_ERR(packet->msg);
                goto err_ah;
index a790be5a7423aab4951338f488e62f8821795c6a..532818785a7f9cd5a699c393ee120d201b963926 100644 (file)
@@ -367,7 +367,8 @@ static void forward_trap(struct mlx4_ib_dev *dev, u8 port_num, const struct ib_m
 
        if (agent) {
                send_buf = ib_create_send_mad(agent, qpn, 0, 0, IB_MGMT_MAD_HDR,
-                                             IB_MGMT_MAD_DATA, GFP_ATOMIC);
+                                             IB_MGMT_MAD_DATA, GFP_ATOMIC,
+                                             IB_MGMT_BASE_VERSION);
                if (IS_ERR(send_buf))
                        return;
                /*
index d54608ca08202f077e9e84cb183181f1d141d6fa..e121e646591d2e63a764df523b9ae989945d61da 100644 (file)
@@ -170,7 +170,8 @@ static void forward_trap(struct mthca_dev *dev,
 
        if (agent) {
                send_buf = ib_create_send_mad(agent, qpn, 0, 0, IB_MGMT_MAD_HDR,
-                                             IB_MGMT_MAD_DATA, GFP_ATOMIC);
+                                             IB_MGMT_MAD_DATA, GFP_ATOMIC,
+                                             IB_MGMT_BASE_VERSION);
                if (IS_ERR(send_buf))
                        return;
                /*
index f32b4628e9913e17dfd0606e1713945ff65930f2..6c8ff10101c0cac722d2da1128c85f81b376b62f 100644 (file)
@@ -5502,7 +5502,8 @@ static void try_7322_ipg(struct qib_pportdata *ppd)
                goto retry;
 
        send_buf = ib_create_send_mad(agent, 0, 0, 0, IB_MGMT_MAD_HDR,
-                                     IB_MGMT_MAD_DATA, GFP_ATOMIC);
+                                     IB_MGMT_MAD_DATA, GFP_ATOMIC,
+                                     IB_MGMT_BASE_VERSION);
        if (IS_ERR(send_buf))
                goto retry;
 
index 6ab8ab89d058bff898ef594573fde83d7025ccfb..206b2050b247d1eb6dbcb25cbe2ec07c7622c1d0 100644 (file)
@@ -83,7 +83,8 @@ static void qib_send_trap(struct qib_ibport *ibp, void *data, unsigned len)
                return;
 
        send_buf = ib_create_send_mad(agent, 0, 0, 0, IB_MGMT_MAD_HDR,
-                                     IB_MGMT_MAD_DATA, GFP_ATOMIC);
+                                     IB_MGMT_MAD_DATA, GFP_ATOMIC,
+                                     IB_MGMT_BASE_VERSION);
        if (IS_ERR(send_buf))
                return;
 
index 783efe1a3a2857576989cfc91be356310e86c700..0b2857b1b112aa2421d9f10d08e5d1bcb679d489 100644 (file)
@@ -476,7 +476,8 @@ static void srpt_mad_recv_handler(struct ib_mad_agent *mad_agent,
        rsp = ib_create_send_mad(mad_agent, mad_wc->wc->src_qp,
                                 mad_wc->wc->pkey_index, 0,
                                 IB_MGMT_DEVICE_HDR, IB_MGMT_DEVICE_DATA,
-                                GFP_KERNEL);
+                                GFP_KERNEL,
+                                IB_MGMT_BASE_VERSION);
        if (IS_ERR(rsp))
                goto err_rsp;
 
index c0ea51f90a0387faefccc63c749710ea2bf4f618..bf03ce07c31651b526e668076e6e6bcb73519f41 100644 (file)
@@ -618,6 +618,7 @@ int ib_process_mad_wc(struct ib_mad_agent *mad_agent,
  *   automatically adjust the allocated buffer size to account for any
  *   additional padding that may be necessary.
  * @gfp_mask: GFP mask used for the memory allocation.
+ * @base_version: Base Version of this MAD
  *
  * This routine allocates a MAD for sending.  The returned MAD send buffer
  * will reference a data buffer usable for sending a MAD, along
@@ -633,7 +634,8 @@ struct ib_mad_send_buf *ib_create_send_mad(struct ib_mad_agent *mad_agent,
                                           u32 remote_qpn, u16 pkey_index,
                                           int rmpp_active,
                                           int hdr_len, int data_len,
-                                          gfp_t gfp_mask);
+                                          gfp_t gfp_mask,
+                                          u8 base_version);
 
 /**
  * ib_is_mad_class_rmpp - returns whether given management class