Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / net / sunrpc / xprtrdma / svc_rdma_transport.c
index 90668969d5596b199c9fad0c188a3d72dccc99e6..dd9440137834c7b1a55b433a1a91bb52efa26acc 100644 (file)
@@ -789,7 +789,7 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
        int ret;
 
        dprintk("svcrdma: Creating RDMA socket\n");
-       if (sa->sa_family != AF_INET) {
+       if ((sa->sa_family != AF_INET) && (sa->sa_family != AF_INET6)) {
                dprintk("svcrdma: Address family %d is not supported.\n", sa->sa_family);
                return ERR_PTR(-EAFNOSUPPORT);
        }
@@ -805,6 +805,16 @@ static struct svc_xprt *svc_rdma_create(struct svc_serv *serv,
                goto err0;
        }
 
+       /* Allow both IPv4 and IPv6 sockets to bind a single port
+        * at the same time.
+        */
+#if IS_ENABLED(CONFIG_IPV6)
+       ret = rdma_set_afonly(listen_id, 1);
+       if (ret) {
+               dprintk("svcrdma: rdma_set_afonly failed = %d\n", ret);
+               goto err1;
+       }
+#endif
        ret = rdma_bind_addr(listen_id, sa);
        if (ret) {
                dprintk("svcrdma: rdma_bind_addr failed = %d\n", ret);
@@ -1073,7 +1083,7 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
                newxprt->sc_dev_caps |= SVCRDMA_DEVCAP_READ_W_INV;
 
        /* Post receive buffers */
-       for (i = 0; i < newxprt->sc_rq_depth; i++) {
+       for (i = 0; i < newxprt->sc_max_requests; i++) {
                ret = svc_rdma_post_recv(newxprt, GFP_KERNEL);
                if (ret) {
                        dprintk("svcrdma: failure posting receive buffers\n");
@@ -1170,6 +1180,9 @@ static void __svc_rdma_free(struct work_struct *work)
 
        dprintk("svcrdma: %s(%p)\n", __func__, rdma);
 
+       if (rdma->sc_qp && !IS_ERR(rdma->sc_qp))
+               ib_drain_qp(rdma->sc_qp);
+
        /* We should only be called from kref_put */
        if (atomic_read(&xprt->xpt_ref.refcount) != 0)
                pr_err("svcrdma: sc_xprt still in use? (%d)\n",