From patchwork Thu May 17 10:39:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yishai Hadas X-Patchwork-Id: 10406317 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6E46360230 for ; Thu, 17 May 2018 10:40:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5718E28A6D for ; Thu, 17 May 2018 10:40:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5543928AAF; Thu, 17 May 2018 10:40:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6444928AB8 for ; Thu, 17 May 2018 10:40:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751520AbeEQKkE (ORCPT ); Thu, 17 May 2018 06:40:04 -0400 Received: from mail-il-dmz.mellanox.com ([193.47.165.129]:44997 "EHLO mellanox.co.il" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751595AbeEQKkD (ORCPT ); Thu, 17 May 2018 06:40:03 -0400 Received: from Internal Mail-Server by MTLPINE1 (envelope-from yishaih@mellanox.com) with ESMTPS (AES256-SHA encrypted); 17 May 2018 13:41:47 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [10.7.2.17]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id w4HAduU5002336; Thu, 17 May 2018 13:39:56 +0300 Received: from vnc17.mtl.labs.mlnx (vnc17.mtl.labs.mlnx [127.0.0.1]) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8) with ESMTP id w4HAduJI032403; Thu, 17 May 2018 13:39:56 +0300 Received: (from yishaih@localhost) by vnc17.mtl.labs.mlnx (8.13.8/8.13.8/Submit) id w4HAdu2c032402; Thu, 17 May 2018 13:39:56 +0300 From: Yishai Hadas To: linux-rdma@vger.kernel.org Cc: yishaih@mellanox.com, raeds@mellanox.com Subject: [PATCH rdma-core 06/11] Expand create flow to take provider internal data Date: Thu, 17 May 2018 13:39:32 +0300 Message-Id: <1526553577-32273-7-git-send-email-yishaih@mellanox.com> X-Mailer: git-send-email 1.8.2.3 In-Reply-To: <1526553577-32273-1-git-send-email-yishaih@mellanox.com> References: <1526553577-32273-1-git-send-email-yishaih@mellanox.com> Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Raed Salem Downstream patch will use this to pass counters mapping as provider internal data when creating a flow. Signed-off-by: Raed Salem Signed-off-by: Yishai Hadas --- libibverbs/cmd.c | 16 ++++++++++++---- libibverbs/driver.h | 4 +++- providers/mlx4/verbs.c | 3 ++- providers/mlx5/verbs.c | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 0f102b4..9cd1ba5 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -1803,7 +1803,9 @@ static int ib_spec_to_kern_spec(struct ibv_flow_spec *ib_spec, int ibv_cmd_create_flow(struct ibv_qp *qp, struct ibv_flow *flow_id, - struct ibv_flow_attr *flow_attr) + struct ibv_flow_attr *flow_attr, + void *ucmd, + size_t ucmd_size) { struct ibv_create_flow *cmd; struct ib_uverbs_destroy_flow resp; @@ -1815,8 +1817,8 @@ int ibv_cmd_create_flow(struct ibv_qp *qp, cmd_size = sizeof(*cmd) + (flow_attr->num_of_specs * sizeof(struct ibv_kern_spec)); - cmd = alloca(cmd_size); - memset(cmd, 0, cmd_size); + cmd = alloca(cmd_size + ucmd_size); + memset(cmd, 0, cmd_size + ucmd_size); cmd->qp_handle = qp->handle; @@ -1841,7 +1843,13 @@ int ibv_cmd_create_flow(struct ibv_qp *qp, } written_size = sizeof(*cmd) + cmd->flow_attr.size; - IBV_INIT_CMD_RESP_EX_VCMD(cmd, written_size, written_size, CREATE_FLOW, + if (ucmd) { + memcpy((char *)cmd + written_size, ucmd, ucmd_size); + written_size += ucmd_size; + } + + IBV_INIT_CMD_RESP_EX_VCMD(cmd, written_size - ucmd_size, + written_size, CREATE_FLOW, &resp, sizeof(resp)); if (write(qp->context->cmd_fd, cmd, written_size) != written_size) goto err; diff --git a/libibverbs/driver.h b/libibverbs/driver.h index f296c6b..2780a56 100644 --- a/libibverbs/driver.h +++ b/libibverbs/driver.h @@ -514,7 +514,9 @@ int ibv_cmd_detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid, uint16_t l int ibv_cmd_create_flow(struct ibv_qp *qp, struct ibv_flow *flow_id, - struct ibv_flow_attr *flow_attr); + struct ibv_flow_attr *flow_attr, + void *ucmd, + size_t ucmd_size); int ibv_cmd_destroy_flow(struct ibv_flow *flow_id); int ibv_cmd_create_wq(struct ibv_context *context, struct ibv_wq_init_attr *wq_init_attr, diff --git a/providers/mlx4/verbs.c b/providers/mlx4/verbs.c index 495f84e..4b5c06f 100644 --- a/providers/mlx4/verbs.c +++ b/providers/mlx4/verbs.c @@ -1543,7 +1543,8 @@ struct ibv_flow *mlx4_create_flow(struct ibv_qp *qp, struct ibv_flow_attr *flow_ if (!flow_id) return NULL; - ret = ibv_cmd_create_flow(qp, flow_id, flow_attr); + ret = ibv_cmd_create_flow(qp, flow_id, flow_attr, + NULL, 0); if (!ret) return flow_id; diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index 71728c8..851493c 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -2942,7 +2942,8 @@ struct ibv_flow *mlx5_create_flow(struct ibv_qp *qp, struct ibv_flow_attr *flow_ if (!flow_id) return NULL; - ret = ibv_cmd_create_flow(qp, flow_id, flow_attr); + ret = ibv_cmd_create_flow(qp, flow_id, flow_attr, + NULL, 0); if (!ret) return flow_id;