Merge branches '4.7-rc-misc', 'hfi1-fixes', 'i40iw-rc-fixes' and 'mellanox-rc-fixes...
authorDoug Ledford <dledford@redhat.com>
Thu, 23 Jun 2016 16:22:33 +0000 (12:22 -0400)
committerDoug Ledford <dledford@redhat.com>
Thu, 23 Jun 2016 16:22:33 +0000 (12:22 -0400)
1  2  3  4 
drivers/infiniband/core/cma.c

@@@@@ -708,6 -708,17 -708,17 -708,17 +708,6 @@@@@ static void cma_deref_id(struct rdma_id
                complete(&id_priv->comp);
    }
    
 ---static int cma_disable_callback(struct rdma_id_private *id_priv,
 ---                            enum rdma_cm_state state)
 ---{
 ---    mutex_lock(&id_priv->handler_mutex);
 ---    if (id_priv->state != state) {
 ---            mutex_unlock(&id_priv->handler_mutex);
 ---            return -EINVAL;
 ---    }
 ---    return 0;
 ---}
 ---
    struct rdma_cm_id *rdma_create_id(struct net *net,
                                  rdma_cm_event_handler event_handler,
                                  void *context, enum rdma_port_space ps,
@@@@@ -1660,12 -1671,11 -1671,11 -1671,11 +1660,12 @@@@@ static int cma_ib_handler(struct ib_cm_
        struct rdma_cm_event event;
        int ret = 0;
    
 +++    mutex_lock(&id_priv->handler_mutex);
        if ((ib_event->event != IB_CM_TIMEWAIT_EXIT &&
 ---            cma_disable_callback(id_priv, RDMA_CM_CONNECT)) ||
 +++         id_priv->state != RDMA_CM_CONNECT) ||
            (ib_event->event == IB_CM_TIMEWAIT_EXIT &&
 ---            cma_disable_callback(id_priv, RDMA_CM_DISCONNECT)))
 ---            return 0;
 +++         id_priv->state != RDMA_CM_DISCONNECT))
 +++            goto out;
    
        memset(&event, 0, sizeof event);
        switch (ib_event->event) {
@@@@@ -1860,7 -1870,7 -1870,7 -1870,7 +1860,7 @@@@@ static int cma_check_req_qp_type(struc
    
    static int cma_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *ib_event)
    {
 ---    struct rdma_id_private *listen_id, *conn_id;
 +++    struct rdma_id_private *listen_id, *conn_id = NULL;
        struct rdma_cm_event event;
        struct net_device *net_dev;
        int offset, ret;
                goto net_dev_put;
        }
    
 ---    if (cma_disable_callback(listen_id, RDMA_CM_LISTEN)) {
 +++    mutex_lock(&listen_id->handler_mutex);
 +++    if (listen_id->state != RDMA_CM_LISTEN) {
                ret = -ECONNABORTED;
 ---            goto net_dev_put;
 +++            goto err1;
        }
    
        memset(&event, 0, sizeof event);
@@@@@ -1967,9 -1976,8 -1976,8 -1976,8 +1967,9 @@@@@ static int cma_iw_handler(struct iw_cm_
        struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr;
        struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr;
    
 ---    if (cma_disable_callback(id_priv, RDMA_CM_CONNECT))
 ---            return 0;
 +++    mutex_lock(&id_priv->handler_mutex);
 +++    if (id_priv->state != RDMA_CM_CONNECT)
 +++            goto out;
    
        memset(&event, 0, sizeof event);
        switch (iw_event->event) {
                return ret;
        }
    
 +++out:
        mutex_unlock(&id_priv->handler_mutex);
        return ret;
    }
@@@@@ -2032,15 -2039,13 -2039,13 -2039,13 +2032,15 @@@@@ static int iw_conn_req_handler(struct i
        struct rdma_cm_id *new_cm_id;
        struct rdma_id_private *listen_id, *conn_id;
        struct rdma_cm_event event;
 ---    int ret;
 +++    int ret = -ECONNABORTED;
        struct sockaddr *laddr = (struct sockaddr *)&iw_event->local_addr;
        struct sockaddr *raddr = (struct sockaddr *)&iw_event->remote_addr;
    
        listen_id = cm_id->context;
 ---    if (cma_disable_callback(listen_id, RDMA_CM_LISTEN))
 ---            return -ECONNABORTED;
 +++
 +++    mutex_lock(&listen_id->handler_mutex);
 +++    if (listen_id->state != RDMA_CM_LISTEN)
 +++            goto out;
    
        /* Create a new RDMA id for the new IW CM ID */
        new_cm_id = rdma_create_id(listen_id->id.route.addr.dev_addr.net,
@@@@@ -3211,9 -3216,8 -3216,8 -3216,8 +3211,9 @@@@@ static int cma_sidr_rep_handler(struct 
        struct ib_cm_sidr_rep_event_param *rep = &ib_event->param.sidr_rep_rcvd;
        int ret = 0;
    
 ---    if (cma_disable_callback(id_priv, RDMA_CM_CONNECT))
 ---            return 0;
 +++    mutex_lock(&id_priv->handler_mutex);
 +++    if (id_priv->state != RDMA_CM_CONNECT)
 +++            goto out;
    
        memset(&event, 0, sizeof event);
        switch (ib_event->event) {
@@@@@ -3669,13 -3673,12 -3673,12 -3673,12 +3669,13 @@@@@ static int cma_ib_mc_handler(int status
        struct rdma_id_private *id_priv;
        struct cma_multicast *mc = multicast->context;
        struct rdma_cm_event event;
 ---    int ret;
 +++    int ret = 0;
    
        id_priv = mc->id_priv;
 ---    if (cma_disable_callback(id_priv, RDMA_CM_ADDR_BOUND) &&
 ---        cma_disable_callback(id_priv, RDMA_CM_ADDR_RESOLVED))
 ---            return 0;
 +++    mutex_lock(&id_priv->handler_mutex);
 +++    if (id_priv->state != RDMA_CM_ADDR_BOUND &&
 +++        id_priv->state != RDMA_CM_ADDR_RESOLVED)
 +++            goto out;
    
        if (!status)
                status = cma_set_qkey(id_priv, be32_to_cpu(multicast->rec.qkey));
                return 0;
        }
    
 +++out:
        mutex_unlock(&id_priv->handler_mutex);
        return 0;
    }
@@@@@ -3876,12 -3878,12 -3878,12 -3878,12 +3876,12 @@@@@ static int cma_iboe_join_multicast(stru
        gid_type = id_priv->cma_dev->default_gid_type[id_priv->id.port_num -
                   rdma_start_port(id_priv->cma_dev->device)];
        if (addr->sa_family == AF_INET) {
---             if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)
+++             if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP) {
+++                     mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT;
                        err = cma_igmp_send(ndev, &mc->multicast.ib->rec.mgid,
                                            true);
---             if (!err) {
---                     mc->igmp_joined = true;
---                     mc->multicast.ib->rec.hop_limit = IPV6_DEFAULT_HOPLIMIT;
+++                     if (!err)
+++                             mc->igmp_joined = true;
                }
        } else {
                if (gid_type == IB_GID_TYPE_ROCE_UDP_ENCAP)