From patchwork Mon Dec 6 07:37:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aleksey Senin X-Patchwork-Id: 377262 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oB67aEah026442 for ; Mon, 6 Dec 2010 07:37:22 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751222Ab0LFHhV (ORCPT ); Mon, 6 Dec 2010 02:37:21 -0500 Received: from fwil.voltaire.com ([193.47.165.2]:32977 "EHLO Exil2010.voltaire.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751101Ab0LFHhV (ORCPT ); Mon, 6 Dec 2010 02:37:21 -0500 Received: from exil.voltaire.com (172.25.0.55) by Exil2010.voltaire.com (172.25.0.11) with Microsoft SMTP Server id 14.1.255.0; Mon, 6 Dec 2010 09:37:19 +0200 Received: from [172.25.5.190] ([172.25.5.190]) by exil.voltaire.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 6 Dec 2010 09:37:19 +0200 Message-ID: <4CFC92AF.8070009@voltaire.com> Date: Mon, 6 Dec 2010 09:37:19 +0200 From: Aleksey Senin User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: Roland Dreier CC: , Moni Shoua , Nir Muchtar , Or Gerlitz Subject: [PATCH v3 3/4] Add RAW_PACKET to verbs attach/detach multicast References: <4CFC918D.1090708@voltaire.com> <4CFC921D.3000907@voltaire.com> <4CFC926B.8060305@voltaire.com> In-Reply-To: <4CFC926B.8060305@voltaire.com> X-OriginalArrivalTime: 06 Dec 2010 07:37:19.0573 (UTC) FILETIME=[69B9D050:01CB9518] Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 06 Dec 2010 07:37:22 +0000 (UTC) diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 611c13c..9e4998c 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -904,7 +904,10 @@ int ib_attach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) { if (!qp->device->attach_mcast) return -ENOSYS; - if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) + if (qp->qp_type == IB_QPT_RAW_PACKET) { + if (gid->global.subnet_prefix & cpu_to_be64(~1ULL)) + return -EINVAL; + } else if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) return -EINVAL; return qp->device->attach_mcast(qp, gid, lid); @@ -915,7 +918,10 @@ int ib_detach_mcast(struct ib_qp *qp, union ib_gid *gid, u16 lid) { if (!qp->device->detach_mcast) return -ENOSYS; - if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) + if (qp->qp_type == IB_QPT_RAW_PACKET) { + if (gid->global.subnet_prefix & cpu_to_be64(~1ULL)) + return -EINVAL; + } else if (gid->raw[0] != 0xff || qp->qp_type != IB_QPT_UD) return -EINVAL; return qp->device->detach_mcast(qp, gid, lid);