IB/core: Add creation flags to struct ib_qp_init_attr

Add a create_flags member to struct ib_qp_init_attr that will allow a
kernel verbs consumer to create a pass special flags when creating a QP.
Add a flag value for telling low-level drivers that a QP will be used
for IPoIB UD LSO.  The create_flags member will also be useful for XRC
and ehca low-latency QP support.

Since no create_flags handling is implemented yet, add code to all
low-level drivers to return -EINVAL if create_flags is non-zero.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
Eli Cohen 2008-04-16 21:09:27 -07:00 committed by Roland Dreier
parent d84e0b28d3
commit b846f25aa2
8 changed files with 26 additions and 0 deletions

View file

@ -1065,6 +1065,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uverbs_file *file,
attr.srq = srq; attr.srq = srq;
attr.sq_sig_type = cmd.sq_sig_all ? IB_SIGNAL_ALL_WR : IB_SIGNAL_REQ_WR; attr.sq_sig_type = cmd.sq_sig_all ? IB_SIGNAL_ALL_WR : IB_SIGNAL_REQ_WR;
attr.qp_type = cmd.qp_type; attr.qp_type = cmd.qp_type;
attr.create_flags = 0;
attr.cap.max_send_wr = cmd.max_send_wr; attr.cap.max_send_wr = cmd.max_send_wr;
attr.cap.max_recv_wr = cmd.max_recv_wr; attr.cap.max_recv_wr = cmd.max_recv_wr;

View file

@ -245,6 +245,9 @@ static struct ib_qp *c2_create_qp(struct ib_pd *pd,
pr_debug("%s:%u\n", __func__, __LINE__); pr_debug("%s:%u\n", __func__, __LINE__);
if (init_attr->create_flags)
return ERR_PTR(-EINVAL);
switch (init_attr->qp_type) { switch (init_attr->qp_type) {
case IB_QPT_RC: case IB_QPT_RC:
qp = kzalloc(sizeof(*qp), GFP_KERNEL); qp = kzalloc(sizeof(*qp), GFP_KERNEL);

View file

@ -421,6 +421,9 @@ static struct ehca_qp *internal_create_qp(
u32 swqe_size = 0, rwqe_size = 0, ib_qp_num; u32 swqe_size = 0, rwqe_size = 0, ib_qp_num;
unsigned long flags; unsigned long flags;
if (init_attr->create_flags)
return ERR_PTR(-EINVAL);
memset(&parms, 0, sizeof(parms)); memset(&parms, 0, sizeof(parms));
qp_type = init_attr->qp_type; qp_type = init_attr->qp_type;

View file

@ -747,6 +747,11 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
size_t sz; size_t sz;
struct ib_qp *ret; struct ib_qp *ret;
if (init_attr->create_flags) {
ret = ERR_PTR(-EINVAL);
goto bail;
}
if (init_attr->cap.max_send_sge > ib_ipath_max_sges || if (init_attr->cap.max_send_sge > ib_ipath_max_sges ||
init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs) { init_attr->cap.max_send_wr > ib_ipath_max_qp_wrs) {
ret = ERR_PTR(-EINVAL); ret = ERR_PTR(-EINVAL);

View file

@ -673,6 +673,9 @@ struct ib_qp *mlx4_ib_create_qp(struct ib_pd *pd,
struct mlx4_ib_qp *qp; struct mlx4_ib_qp *qp;
int err; int err;
if (init_attr->create_flags)
return ERR_PTR(-EINVAL);
switch (init_attr->qp_type) { switch (init_attr->qp_type) {
case IB_QPT_RC: case IB_QPT_RC:
case IB_QPT_UC: case IB_QPT_UC:

View file

@ -540,6 +540,9 @@ static struct ib_qp *mthca_create_qp(struct ib_pd *pd,
struct mthca_qp *qp; struct mthca_qp *qp;
int err; int err;
if (init_attr->create_flags)
return ERR_PTR(-EINVAL);
switch (init_attr->qp_type) { switch (init_attr->qp_type) {
case IB_QPT_RC: case IB_QPT_RC:
case IB_QPT_UC: case IB_QPT_UC:

View file

@ -1252,6 +1252,9 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
u8 rq_encoded_size; u8 rq_encoded_size;
/* int counter; */ /* int counter; */
if (init_attr->create_flags)
return ERR_PTR(-EINVAL);
atomic_inc(&qps_created); atomic_inc(&qps_created);
switch (init_attr->qp_type) { switch (init_attr->qp_type) {
case IB_QPT_RC: case IB_QPT_RC:

View file

@ -495,6 +495,10 @@ enum ib_qp_type {
IB_QPT_RAW_ETY IB_QPT_RAW_ETY
}; };
enum ib_qp_create_flags {
IB_QP_CREATE_IPOIB_UD_LSO = 1 << 0,
};
struct ib_qp_init_attr { struct ib_qp_init_attr {
void (*event_handler)(struct ib_event *, void *); void (*event_handler)(struct ib_event *, void *);
void *qp_context; void *qp_context;
@ -504,6 +508,7 @@ struct ib_qp_init_attr {
struct ib_qp_cap cap; struct ib_qp_cap cap;
enum ib_sig_type sq_sig_type; enum ib_sig_type sq_sig_type;
enum ib_qp_type qp_type; enum ib_qp_type qp_type;
enum ib_qp_create_flags create_flags;
u8 port_num; /* special QP types only */ u8 port_num; /* special QP types only */
}; };