]> git.karo-electronics.de Git - linux-beck.git/commitdiff
IB/ehca: Add check for max #SGE to create_qp()
authorJoachim Fenkes <fenkes@de.ibm.com>
Tue, 11 Sep 2007 13:33:40 +0000 (15:33 +0200)
committerRoland Dreier <rolandd@cisco.com>
Wed, 10 Oct 2007 02:59:10 +0000 (19:59 -0700)
Signed-off-by: Joachim Fenkes <fenkes@de.ibm.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ehca/ehca_qp.c

index 88d7dd94603313abd43e0f312dc5c88bc92f6005..f95403cb523dd3c577ffafc97f56a1da45fcdec3 100644 (file)
@@ -513,7 +513,7 @@ static struct ehca_qp *internal_create_qp(
                        } else if (init_attr->cap.max_send_wr > 255) {
                                ehca_err(pd->device,
                                         "Invalid Number of "
-                                        "ax_send_wr=%x for UD QP_TYPE=%x",
+                                        "max_send_wr=%x for UD QP_TYPE=%x",
                                         init_attr->cap.max_send_wr, qp_type);
                                return ERR_PTR(-EINVAL);
                        }
@@ -524,6 +524,18 @@ static struct ehca_qp *internal_create_qp(
                        return ERR_PTR(-EINVAL);
                        break;
                }
+       } else {
+               int max_sge = (qp_type == IB_QPT_UD || qp_type == IB_QPT_SMI
+                              || qp_type == IB_QPT_GSI) ? 250 : 252;
+
+               if (init_attr->cap.max_send_sge > max_sge
+                   || init_attr->cap.max_recv_sge > max_sge) {
+                       ehca_err(pd->device, "Invalid number of SGEs requested "
+                                "send_sge=%x recv_sge=%x max_sge=%x",
+                                init_attr->cap.max_send_sge,
+                                init_attr->cap.max_recv_sge, max_sge);
+                       return ERR_PTR(-EINVAL);
+               }
        }
 
        if (pd->uobject && udata)