~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/scsi/bnx2i/bnx2i_iscsi.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
379
379
{
380
380
        struct iscsi_endpoint *ep;
381
381
        struct bnx2i_endpoint *bnx2i_ep;
 
382
        u32 ec_div;
382
383
 
383
384
        ep = iscsi_create_endpoint(sizeof(*bnx2i_ep));
384
385
        if (!ep) {
393
394
        bnx2i_ep->ep_iscsi_cid = (u16) -1;
394
395
        bnx2i_ep->hba = hba;
395
396
        bnx2i_ep->hba_age = hba->age;
 
397
 
 
398
        ec_div = event_coal_div;
 
399
        while (ec_div >>= 1)
 
400
                bnx2i_ep->ec_shift += 1;
 
401
 
396
402
        hba->ofld_conns_active++;
397
403
        init_waitqueue_head(&bnx2i_ep->ofld_wait);
398
404
        return ep;
858
864
        mutex_init(&hba->net_dev_lock);
859
865
        init_waitqueue_head(&hba->eh_wait);
860
866
        if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) {
861
 
                hba->hba_shutdown_tmo = 20 * HZ;
 
867
                hba->hba_shutdown_tmo = 30 * HZ;
862
868
                hba->conn_teardown_tmo = 20 * HZ;
863
869
                hba->conn_ctx_destroy_tmo = 6 * HZ;
864
870
        } else {        /* 5706/5708/5709 */
1092
1098
        case ISCSI_OP_SCSI_TMFUNC:
1093
1099
                rc = bnx2i_send_iscsi_tmf(bnx2i_conn, task);
1094
1100
                break;
 
1101
        case ISCSI_OP_TEXT:
 
1102
                rc = bnx2i_send_iscsi_text(bnx2i_conn, task);
 
1103
                break;
1095
1104
        default:
1096
1105
                iscsi_conn_printk(KERN_ALERT, bnx2i_conn->cls_conn->dd_data,
1097
1106
                                  "send_gen: unsupported op 0x%x\n",
1205
1214
        struct bnx2i_cmd *cmd = task->dd_data;
1206
1215
        struct iscsi_cmd *hdr = (struct iscsi_cmd *) task->hdr;
1207
1216
 
 
1217
        if (bnx2i_conn->ep->num_active_cmds + 1 > hba->max_sqes)
 
1218
                return -ENOMEM;
 
1219
 
1208
1220
        /*
1209
1221
         * If there is no scsi_cmnd this must be a mgmt task
1210
1222
         */
1455
1467
 
1456
1468
 
1457
1469
/**
1458
 
 * bnx2i_conn_get_param - return iscsi connection parameter to caller
1459
 
 * @cls_conn:   pointer to iscsi cls conn
 
1470
 * bnx2i_ep_get_param - return iscsi ep parameter to caller
 
1471
 * @ep:         pointer to iscsi endpoint
1460
1472
 * @param:      parameter type identifier
1461
1473
 * @buf:        buffer pointer
1462
1474
 *
1463
 
 * returns iSCSI connection parameters
 
1475
 * returns iSCSI ep parameters
1464
1476
 */
1465
 
static int bnx2i_conn_get_param(struct iscsi_cls_conn *cls_conn,
1466
 
                                enum iscsi_param param, char *buf)
 
1477
static int bnx2i_ep_get_param(struct iscsi_endpoint *ep,
 
1478
                              enum iscsi_param param, char *buf)
1467
1479
{
1468
 
        struct iscsi_conn *conn = cls_conn->dd_data;
1469
 
        struct bnx2i_conn *bnx2i_conn = conn->dd_data;
1470
 
        int len = 0;
 
1480
        struct bnx2i_endpoint *bnx2i_ep = ep->dd_data;
 
1481
        struct bnx2i_hba *hba = bnx2i_ep->hba;
 
1482
        int len = -ENOTCONN;
1471
1483
 
1472
 
        if (!(bnx2i_conn && bnx2i_conn->ep && bnx2i_conn->ep->hba))
1473
 
                goto out;
 
1484
        if (!hba)
 
1485
                return -ENOTCONN;
1474
1486
 
1475
1487
        switch (param) {
1476
1488
        case ISCSI_PARAM_CONN_PORT:
1477
 
                mutex_lock(&bnx2i_conn->ep->hba->net_dev_lock);
1478
 
                if (bnx2i_conn->ep->cm_sk)
1479
 
                        len = sprintf(buf, "%hu\n",
1480
 
                                      bnx2i_conn->ep->cm_sk->dst_port);
1481
 
                mutex_unlock(&bnx2i_conn->ep->hba->net_dev_lock);
 
1489
                mutex_lock(&hba->net_dev_lock);
 
1490
                if (bnx2i_ep->cm_sk)
 
1491
                        len = sprintf(buf, "%hu\n", bnx2i_ep->cm_sk->dst_port);
 
1492
                mutex_unlock(&hba->net_dev_lock);
1482
1493
                break;
1483
1494
        case ISCSI_PARAM_CONN_ADDRESS:
1484
 
                mutex_lock(&bnx2i_conn->ep->hba->net_dev_lock);
1485
 
                if (bnx2i_conn->ep->cm_sk)
1486
 
                        len = sprintf(buf, "%pI4\n",
1487
 
                                      &bnx2i_conn->ep->cm_sk->dst_ip);
1488
 
                mutex_unlock(&bnx2i_conn->ep->hba->net_dev_lock);
 
1495
                mutex_lock(&hba->net_dev_lock);
 
1496
                if (bnx2i_ep->cm_sk)
 
1497
                        len = sprintf(buf, "%pI4\n", &bnx2i_ep->cm_sk->dst_ip);
 
1498
                mutex_unlock(&hba->net_dev_lock);
1489
1499
                break;
1490
1500
        default:
1491
 
                return iscsi_conn_get_param(cls_conn, param, buf);
 
1501
                return -ENOSYS;
1492
1502
        }
1493
 
out:
 
1503
 
1494
1504
        return len;
1495
1505
}
1496
1506
 
1935
1945
                cnic_dev_10g = 1;
1936
1946
 
1937
1947
        switch (bnx2i_ep->state) {
1938
 
        case EP_STATE_CONNECT_FAILED:
1939
1948
        case EP_STATE_CLEANUP_FAILED:
1940
1949
        case EP_STATE_OFLD_FAILED:
1941
1950
        case EP_STATE_DISCONN_TIMEDOUT:
1942
1951
                ret = 0;
1943
1952
                break;
1944
1953
        case EP_STATE_CONNECT_START:
 
1954
        case EP_STATE_CONNECT_FAILED:
1945
1955
        case EP_STATE_CONNECT_COMPL:
1946
1956
        case EP_STATE_ULP_UPDATE_START:
1947
1957
        case EP_STATE_ULP_UPDATE_COMPL:
2155
2165
        .change_queue_depth     = iscsi_change_queue_depth,
2156
2166
        .can_queue              = 1024,
2157
2167
        .max_sectors            = 127,
2158
 
        .cmd_per_lun            = 32,
 
2168
        .cmd_per_lun            = 24,
2159
2169
        .this_id                = -1,
2160
2170
        .use_clustering         = ENABLE_CLUSTERING,
2161
2171
        .sg_tablesize           = ISCSI_MAX_BDS_PER_CMD,
2167
2177
        .name                   = "bnx2i",
2168
2178
        .caps                   = CAP_RECOVERY_L0 | CAP_HDRDGST |
2169
2179
                                  CAP_MULTI_R2T | CAP_DATADGST |
2170
 
                                  CAP_DATA_PATH_OFFLOAD,
 
2180
                                  CAP_DATA_PATH_OFFLOAD |
 
2181
                                  CAP_TEXT_NEGO,
2171
2182
        .param_mask             = ISCSI_MAX_RECV_DLENGTH |
2172
2183
                                  ISCSI_MAX_XMIT_DLENGTH |
2173
2184
                                  ISCSI_HDRDGST_EN |
2200
2211
        .bind_conn              = bnx2i_conn_bind,
2201
2212
        .destroy_conn           = bnx2i_conn_destroy,
2202
2213
        .set_param              = iscsi_set_param,
2203
 
        .get_conn_param         = bnx2i_conn_get_param,
 
2214
        .get_conn_param         = iscsi_conn_get_param,
2204
2215
        .get_session_param      = iscsi_session_get_param,
2205
2216
        .get_host_param         = bnx2i_host_get_param,
2206
2217
        .start_conn             = bnx2i_conn_start,
2209
2220
        .xmit_task              = bnx2i_task_xmit,
2210
2221
        .get_stats              = bnx2i_conn_get_stats,
2211
2222
        /* TCP connect - disconnect - option-2 interface calls */
 
2223
        .get_ep_param           = bnx2i_ep_get_param,
2212
2224
        .ep_connect             = bnx2i_ep_connect,
2213
2225
        .ep_poll                = bnx2i_ep_poll,
2214
2226
        .ep_disconnect          = bnx2i_ep_disconnect,