History

IB/uverbs: Enable QP creation with a given source QP number

Enable QP creation with a given source QP number, the created QP will use the source QPN as its wire QP number. To create such a QP, root privileges (i.e. CAP_NET_RAW) are required from the user application. This comes as a pre-patch for downstream patches in this series to allow user space applications to accelerate traffic which is typically handled by IPoIB ULP.

Yishai Hadas committed 9 years ago

Commit 2dee0e51 parent 02984cc2 files · +15 −4Browse files

Unified · Split

2 files
  1. drivers/infiniband/core/uverbs_cmd.c +14 −3
  2. include/uapi/rdma/ib_user_verbs.h +1 −1
drivers/infiniband/core/uverbs_cmd.c+14−3
@@ -1383,8 +1383,9 @@ static int create_qp(struct ib_uverbs_file *file, · 1382 unmodified lines
13831383 attr.rwq_ind_tbl = ind_tbl;
13841384 }
13851385
1386− if ((cmd_sz >= offsetof(typeof(*cmd), reserved1) +
1387− sizeof(cmd->reserved1)) && cmd->reserved1) {
1386+ if (cmd_sz > sizeof(*cmd) &&
1387+ !ib_is_udata_cleared(ucore, sizeof(*cmd),
1388+ cmd_sz - sizeof(*cmd))) {
13881389 ret = -EOPNOTSUPP;
13891390 goto err_put;
13901391 }
@@ -1482,11 +1483,21 @@ static int create_qp(struct ib_uverbs_file *file, · 91 unmodified lines
14821483 IB_QP_CREATE_MANAGED_SEND |
14831484 IB_QP_CREATE_MANAGED_RECV |
14841485 IB_QP_CREATE_SCATTER_FCS |
1485− IB_QP_CREATE_CVLAN_STRIPPING)) {
1486+ IB_QP_CREATE_CVLAN_STRIPPING |
1487+ IB_QP_CREATE_SOURCE_QPN)) {
14861488 ret = -EINVAL;
14871489 goto err_put;
14881490 }
14891491
1492+ if (attr.create_flags & IB_QP_CREATE_SOURCE_QPN) {
1493+ if (!capable(CAP_NET_RAW)) {
1494+ ret = -EPERM;
1495+ goto err_put;
1496+ }
1497+
1498+ attr.source_qpn = cmd->source_qpn;
1499+ }
1500+
14901501 buf = (void *)cmd + sizeof(*cmd);
14911502 if (cmd_sz > sizeof(*cmd))
14921503 if (!(buf[0] == 0 && !memcmp(buf, buf + 1,
include/uapi/rdma/ib_user_verbs.h+1−1
@@ -578,7 +578,7 @@ struct ib_uverbs_ex_create_qp { · 577 unmodified lines
578578 __u32 comp_mask;
579579 __u32 create_flags;
580580 __u32 rwq_ind_tbl_handle;
581− __u32 reserved1;
581+ __u32 source_qpn;
582582 };
583583
584584 struct ib_uverbs_open_qp {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t