Merge branch 'exynos-drm' of git://git.infradead.org/users/kmpark/linux-samsung into...
[pandora-kernel.git] / drivers / net / ethernet / broadcom / cnic.c
index 7698161..6f10c69 100644 (file)
@@ -1177,7 +1177,7 @@ static int cnic_alloc_bnx2x_resc(struct cnic_dev *dev)
        cp->fcoe_start_cid = start_cid + MAX_ISCSI_TBL_SZ;
 
        if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {
-               cp->max_cid_space += BNX2X_FCOE_NUM_CONNECTIONS;
+               cp->max_cid_space += dev->max_fcoe_conn;
                cp->fcoe_init_cid = ethdev->fcoe_init_cid;
                if (!cp->fcoe_init_cid)
                        cp->fcoe_init_cid = 0x10;
@@ -1875,12 +1875,12 @@ static int cnic_bnx2x_destroy_ramrod(struct cnic_dev *dev, u32 l5_cid)
                                  hw_cid, NONE_CONNECTION_TYPE, &l5_data);
 
        if (ret == 0) {
-               wait_event(ctx->waitq, ctx->wait_cond);
+               wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO);
                if (unlikely(test_bit(CTX_FL_CID_ERROR, &ctx->ctx_flags)))
                        return -EBUSY;
        }
 
-       return ret;
+       return 0;
 }
 
 static int cnic_bnx2x_iscsi_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
@@ -2280,7 +2280,7 @@ static int cnic_bnx2x_fcoe_ofld1(struct cnic_dev *dev, struct kwqe *wqes[],
        *work = 4;
 
        l5_cid = req1->fcoe_conn_id;
-       if (l5_cid >= BNX2X_FCOE_NUM_CONNECTIONS)
+       if (l5_cid >= dev->max_fcoe_conn)
                goto err_reply;
 
        l5_cid += BNX2X_FCOE_L5_CID_BASE;
@@ -2384,7 +2384,7 @@ static int cnic_bnx2x_fcoe_disable(struct cnic_dev *dev, struct kwqe *kwqe)
        req = (struct fcoe_kwqe_conn_enable_disable *) kwqe;
        cid = req->context_id;
        l5_cid = req->conn_id;
-       if (l5_cid >= BNX2X_FCOE_NUM_CONNECTIONS)
+       if (l5_cid >= dev->max_fcoe_conn)
                return -EINVAL;
 
        l5_cid += BNX2X_FCOE_L5_CID_BASE;
@@ -2418,7 +2418,7 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
        req = (struct fcoe_kwqe_conn_destroy *) kwqe;
        cid = req->context_id;
        l5_cid = req->conn_id;
-       if (l5_cid >= BNX2X_FCOE_NUM_CONNECTIONS)
+       if (l5_cid >= dev->max_fcoe_conn)
                return -EINVAL;
 
        l5_cid += BNX2X_FCOE_L5_CID_BASE;
@@ -2428,17 +2428,20 @@ static int cnic_bnx2x_fcoe_destroy(struct cnic_dev *dev, struct kwqe *kwqe)
        init_waitqueue_head(&ctx->waitq);
        ctx->wait_cond = 0;
 
+       memset(&kcqe, 0, sizeof(kcqe));
+       kcqe.completion_status = FCOE_KCQE_COMPLETION_STATUS_ERROR;
        memset(&l5_data, 0, sizeof(l5_data));
        ret = cnic_submit_kwqe_16(dev, FCOE_RAMROD_CMD_ID_TERMINATE_CONN, cid,
                                  FCOE_CONNECTION_TYPE, &l5_data);
        if (ret == 0) {
-               wait_event(ctx->waitq, ctx->wait_cond);
-               set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags);
-               queue_delayed_work(cnic_wq, &cp->delete_task,
-                                  msecs_to_jiffies(2000));
+               wait_event_timeout(ctx->waitq, ctx->wait_cond, CNIC_RAMROD_TMO);
+               if (ctx->wait_cond)
+                       kcqe.completion_status = 0;
        }
 
-       memset(&kcqe, 0, sizeof(kcqe));
+       set_bit(CTX_FL_DELETE_WAIT, &ctx->ctx_flags);
+       queue_delayed_work(cnic_wq, &cp->delete_task, msecs_to_jiffies(2000));
+
        kcqe.op_code = FCOE_KCQE_OPCODE_DESTROY_CONN;
        kcqe.fcoe_conn_id = req->conn_id;
        kcqe.fcoe_conn_context_id = cid;
@@ -4850,8 +4853,7 @@ static int cnic_start_bnx2x_hw(struct cnic_dev *dev)
                return -ENOMEM;
 
        if (BNX2X_CHIP_IS_E2_PLUS(cp->chip_id)) {
-               ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl,
-                                       BNX2X_FCOE_NUM_CONNECTIONS,
+               ret = cnic_init_id_tbl(&cp->fcoe_cid_tbl, dev->max_fcoe_conn,
                                        cp->fcoe_start_cid, 0);
 
                if (ret)
@@ -5292,6 +5294,9 @@ static struct cnic_dev *init_bnx2x_cnic(struct net_device *dev)
            !(ethdev->drv_state & CNIC_DRV_STATE_NO_FCOE))
                cdev->max_fcoe_conn = ethdev->max_fcoe_conn;
 
+       if (cdev->max_fcoe_conn > BNX2X_FCOE_NUM_CONNECTIONS)
+               cdev->max_fcoe_conn = BNX2X_FCOE_NUM_CONNECTIONS;
+
        memcpy(cdev->mac_addr, ethdev->iscsi_mac, 6);
 
        cp->cnic_ops = &cnic_bnx2x_ops;