Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb74dacb authored by Ralph Campbell's avatar Ralph Campbell Committed by Roland Dreier
Browse files

IB/ipath: Fix offset returned to ibv_resize_cq()



The wrong offset was being returned to libipathverbs so that when
ibv_resize_cq() calls mmap(), it always fails.

Signed-off-by: default avatarRalph Campbell <ralph.campbell@qlogic.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 2ffbb837
Loading
Loading
Loading
Loading
+14 −5
Original line number Original line Diff line number Diff line
@@ -395,12 +395,9 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
		goto bail;
		goto bail;
	}
	}


	/*
	/* Check that we can write the offset to mmap. */
	 * Return the address of the WC as the offset to mmap.
	 * See ipath_mmap() for details.
	 */
	if (udata && udata->outlen >= sizeof(__u64)) {
	if (udata && udata->outlen >= sizeof(__u64)) {
		__u64 offset = (__u64) wc;
		__u64 offset = 0;


		ret = ib_copy_to_udata(udata, &offset, sizeof(offset));
		ret = ib_copy_to_udata(udata, &offset, sizeof(offset));
		if (ret)
		if (ret)
@@ -450,6 +447,18 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata)
		struct ipath_mmap_info *ip = cq->ip;
		struct ipath_mmap_info *ip = cq->ip;


		ipath_update_mmap_info(dev, ip, sz, wc);
		ipath_update_mmap_info(dev, ip, sz, wc);

		/*
		 * Return the offset to mmap.
		 * See ipath_mmap() for details.
		 */
		if (udata && udata->outlen >= sizeof(__u64)) {
			ret = ib_copy_to_udata(udata, &ip->offset,
					       sizeof(ip->offset));
			if (ret)
				goto bail;
		}

		spin_lock_irq(&dev->pending_lock);
		spin_lock_irq(&dev->pending_lock);
		if (list_empty(&ip->pending_mmaps))
		if (list_empty(&ip->pending_mmaps))
			list_add(&ip->pending_mmaps, &dev->pending_mmaps);
			list_add(&ip->pending_mmaps, &dev->pending_mmaps);