From patchwork Thu Nov 2 21:50:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Gunthorpe X-Patchwork-Id: 10039339 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 7F0E26032D for ; Thu, 2 Nov 2017 21:50:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6833229372 for ; Thu, 2 Nov 2017 21:50:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 59CDC293C9; Thu, 2 Nov 2017 21:50:36 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 C393629372 for ; Thu, 2 Nov 2017 21:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752158AbdKBVue (ORCPT ); Thu, 2 Nov 2017 17:50:34 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:49826 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751830AbdKBVue (ORCPT ); Thu, 2 Nov 2017 17:50:34 -0400 Received: by mail-io0-f193.google.com with SMTP id n137so2197310iod.6 for ; Thu, 02 Nov 2017 14:50:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=BcaLmfhtOyatpqEAwVHnVJlG/uW+ui4tM/ElshiUyAU=; b=h3Tsdb5advj9FkR5hxxwt54XFKrGFnqTji8tIwihkA8HfLsaP6X7nRfKwh1WIdQs6S XzipAIi0rD7Qs2wiAhc61bCyM/39frZbisG2HOeBgbwWvRi+NSLnomJbBxjqgxSh2k5r I1qalIzTGOux0IPpHtRPHZCSxVFd86RT1y+W7tl0v5Ihhhu+lR4EQYBzpA2YmCHqInN9 QCVCiRCvEbUO9zqdYpQbkr+LUrUiTDu+cN3apy97Q2p2eaQIam0LONdrIDMbDgPfvD2P xnhjnPrYgM+lBKOmjw3HkhCr29hu0NpMv5uFqjPzOMet3HfpO1RQm28saXNid9aatx5/ 12zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=BcaLmfhtOyatpqEAwVHnVJlG/uW+ui4tM/ElshiUyAU=; b=RCFAhZHug6g0J3j7RUT+RPSkMKBS/vAgsptjxy93IVyH0SOQYa67bT5HZBJZad6A5B HBCAFC4z2btujSAFo7binvZmPHsdVMxWUvX/Jwrzkw8IhnVA1QKqPkSmhKdsE7hlTaZ/ YcNENtANzZwBiQqG3DnPP4lspIcsA6yGIt61lMAzUZZBACiBTDqX0vAR9ztKXof6MAsI z3Xgwm/n2V5jgfBPuQzxtzZ6CIMhWw4pkyQa3fb+BK9DslLP9XZwYIsQU7SBb7kBiBen notT6Vy4dy/SnFVbwhtnl9tOkGDQRYTG/EjJzwtygnnbn/o3F+V0Mh7sz+Meef4WEB/M wcPg== X-Gm-Message-State: AJaThX4UZRiFCkQVkwmIoaim0qQ4Jv/A5xuBQ0rYMI/3LOo7e6p7Fuxh Y3aSsQxLjtmvmdhTk3YMEOpaTQ== X-Google-Smtp-Source: ABhQp+R3jKVpLBePybFKfN6MdJ2pmXf2/oxKPP9dj6VhPk1qH8ncuZ5Rorbzto97wMKjD/9b+pkOsQ== X-Received: by 10.107.175.28 with SMTP id y28mr6377075ioe.216.1509659433489; Thu, 02 Nov 2017 14:50:33 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [70.74.179.152]) by smtp.gmail.com with ESMTPSA id f70sm330680itc.23.2017.11.02.14.50.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 14:50:33 -0700 (PDT) Received: from jgg by wakko.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1eANNf-00062p-Ne; Thu, 02 Nov 2017 15:50:31 -0600 Date: Thu, 2 Nov 2017 15:50:31 -0600 From: Jason Gunthorpe To: "Amrani, Ram" Cc: Yishai Hadas , "linux-rdma@vger.kernel.org" , "Elior, Ariel" , "Kalderon, Michal" , Matan Barak , Bodong Wang , Yishai Hadas Subject: [PATCH rdma-core] verbs: Do not block QP attr_masks used by older kernels Message-ID: <20171102215031.GY18874@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) 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 At least the RDMA CM in 4.3 will give user space structs with these bits set. Those kernels require user space to pass those set bits back to the kernel. Blocking them causes RDMA CM to be unusable on older kernels. Fixes: 3ca7a1031486 ("ibverbs: Add support for packet pacing") Reported-by: Ram Amrani Signed-off-by: Jason Gunthorpe --- libibverbs/cmd.c | 12 ++++++------ libibverbs/verbs.h | 9 +++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c index 713a13c0f272b3..fbe822324c9dd5 100644 --- a/libibverbs/cmd.c +++ b/libibverbs/cmd.c @@ -1182,10 +1182,10 @@ int ibv_cmd_query_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, struct ibv_query_qp_resp resp; /* - * Masks over IBV_QP_DEST_QPN are not supported by - * that not extended command. + * Starting with IB_QP_RATE_LIMIT the attribute must go through the + * _ex path. */ - if (attr_mask & ~((IBV_QP_DEST_QPN << 1) - 1)) + if (attr_mask & ~(IBV_QP_RATE_LIMIT - 1)) return EOPNOTSUPP; IBV_INIT_CMD_RESP(cmd, cmd_size, QUERY_QP, &resp, sizeof resp); @@ -1352,10 +1352,10 @@ int ibv_cmd_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr, struct ibv_modify_qp *cmd, size_t cmd_size) { /* - * Masks over IBV_QP_DEST_QPN are only supported by - * ibv_cmd_modify_qp_ex. + * Starting with IB_QP_RATE_LIMIT the attribute must go through the + * _ex path. */ - if (attr_mask & ~((IBV_QP_DEST_QPN << 1) - 1)) + if (attr_mask & ~(IBV_QP_RATE_LIMIT - 1)) return EOPNOTSUPP; IBV_INIT_CMD(cmd, cmd_size, MODIFY_QP); diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 1ab747bb757cf3..2a2264d300e1ca 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h @@ -909,6 +909,15 @@ enum ibv_qp_attr_mask { IBV_QP_PATH_MIG_STATE = 1 << 18, IBV_QP_CAP = 1 << 19, IBV_QP_DEST_QPN = 1 << 20, +#if 0 + /* These bits were supported on older kernels, but never exposed to + * user space: + */ + _IBV_QP_COMPAT1 = 1 << 21, + _IBV_QP_COMPAT2 = 1 << 22, + _IBV_QP_COMPAT3 = 1 << 23, + _IBV_QP_COMPAT3 = 1 << 24, +#endif IBV_QP_RATE_LIMIT = 1 << 25, };