aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/cxgbi/libcxgbi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/cxgbi/libcxgbi.c')
-rw-r--r--drivers/scsi/cxgbi/libcxgbi.c66
1 files changed, 27 insertions, 39 deletions
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index a24dff9f9163..de764ea7419d 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -530,6 +530,7 @@ static struct cxgbi_sock *cxgbi_check_route(struct sockaddr *dst_addr)
530 csk->dst = dst; 530 csk->dst = dst;
531 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr; 531 csk->daddr.sin_addr.s_addr = daddr->sin_addr.s_addr;
532 csk->daddr.sin_port = daddr->sin_port; 532 csk->daddr.sin_port = daddr->sin_port;
533 csk->daddr.sin_family = daddr->sin_family;
533 csk->saddr.sin_addr.s_addr = rt->rt_src; 534 csk->saddr.sin_addr.s_addr = rt->rt_src;
534 535
535 return csk; 536 return csk;
@@ -1264,12 +1265,6 @@ static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid,
1264 return idx; 1265 return idx;
1265 } 1266 }
1266 1267
1267 if (cdev->csk_ddp_alloc_gl_skb) {
1268 err = cdev->csk_ddp_alloc_gl_skb(ddp, idx, npods, gfp);
1269 if (err < 0)
1270 goto unmark_entries;
1271 }
1272
1273 tag = cxgbi_ddp_tag_base(tformat, sw_tag); 1268 tag = cxgbi_ddp_tag_base(tformat, sw_tag);
1274 tag |= idx << PPOD_IDX_SHIFT; 1269 tag |= idx << PPOD_IDX_SHIFT;
1275 1270
@@ -1280,11 +1275,8 @@ static int ddp_tag_reserve(struct cxgbi_sock *csk, unsigned int tid,
1280 hdr.page_offset = htonl(gl->offset); 1275 hdr.page_offset = htonl(gl->offset);
1281 1276
1282 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl); 1277 err = cdev->csk_ddp_set(csk, &hdr, idx, npods, gl);
1283 if (err < 0) { 1278 if (err < 0)
1284 if (cdev->csk_ddp_free_gl_skb)
1285 cdev->csk_ddp_free_gl_skb(ddp, idx, npods);
1286 goto unmark_entries; 1279 goto unmark_entries;
1287 }
1288 1280
1289 ddp->idx_last = idx; 1281 ddp->idx_last = idx;
1290 log_debug(1 << CXGBI_DBG_DDP, 1282 log_debug(1 << CXGBI_DBG_DDP,
@@ -1350,8 +1342,6 @@ static void ddp_destroy(struct kref *kref)
1350 >> PPOD_PAGES_SHIFT; 1342 >> PPOD_PAGES_SHIFT;
1351 pr_info("cdev 0x%p, ddp %d + %d.\n", cdev, i, npods); 1343 pr_info("cdev 0x%p, ddp %d + %d.\n", cdev, i, npods);
1352 kfree(gl); 1344 kfree(gl);
1353 if (cdev->csk_ddp_free_gl_skb)
1354 cdev->csk_ddp_free_gl_skb(ddp, i, npods);
1355 i += npods; 1345 i += npods;
1356 } else 1346 } else
1357 i++; 1347 i++;
@@ -1394,8 +1384,6 @@ int cxgbi_ddp_init(struct cxgbi_device *cdev,
1394 return -ENOMEM; 1384 return -ENOMEM;
1395 } 1385 }
1396 ddp->gl_map = (struct cxgbi_gather_list **)(ddp + 1); 1386 ddp->gl_map = (struct cxgbi_gather_list **)(ddp + 1);
1397 ddp->gl_skb = (struct sk_buff **)(((char *)ddp->gl_map) +
1398 ppmax * sizeof(struct cxgbi_gather_list *));
1399 cdev->ddp = ddp; 1387 cdev->ddp = ddp;
1400 1388
1401 spin_lock_init(&ddp->map_lock); 1389 spin_lock_init(&ddp->map_lock);
@@ -1895,13 +1883,16 @@ EXPORT_SYMBOL_GPL(cxgbi_conn_alloc_pdu);
1895 1883
1896static inline void tx_skb_setmode(struct sk_buff *skb, int hcrc, int dcrc) 1884static inline void tx_skb_setmode(struct sk_buff *skb, int hcrc, int dcrc)
1897{ 1885{
1898 u8 submode = 0; 1886 if (hcrc || dcrc) {
1887 u8 submode = 0;
1899 1888
1900 if (hcrc) 1889 if (hcrc)
1901 submode |= 1; 1890 submode |= 1;
1902 if (dcrc) 1891 if (dcrc)
1903 submode |= 2; 1892 submode |= 2;
1904 cxgbi_skcb_ulp_mode(skb) = (ULP2_MODE_ISCSI << 4) | submode; 1893 cxgbi_skcb_ulp_mode(skb) = (ULP2_MODE_ISCSI << 4) | submode;
1894 } else
1895 cxgbi_skcb_ulp_mode(skb) = 0;
1905} 1896}
1906 1897
1907int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset, 1898int cxgbi_conn_init_pdu(struct iscsi_task *task, unsigned int offset,
@@ -2197,32 +2188,34 @@ int cxgbi_set_conn_param(struct iscsi_cls_conn *cls_conn,
2197} 2188}
2198EXPORT_SYMBOL_GPL(cxgbi_set_conn_param); 2189EXPORT_SYMBOL_GPL(cxgbi_set_conn_param);
2199 2190
2200int cxgbi_get_conn_param(struct iscsi_cls_conn *cls_conn, 2191int cxgbi_get_ep_param(struct iscsi_endpoint *ep, enum iscsi_param param,
2201 enum iscsi_param param, char *buf) 2192 char *buf)
2202{ 2193{
2203 struct iscsi_conn *iconn = cls_conn->dd_data; 2194 struct cxgbi_endpoint *cep = ep->dd_data;
2195 struct cxgbi_sock *csk;
2204 int len; 2196 int len;
2205 2197
2206 log_debug(1 << CXGBI_DBG_ISCSI, 2198 log_debug(1 << CXGBI_DBG_ISCSI,
2207 "cls_conn 0x%p, param %d.\n", cls_conn, param); 2199 "cls_conn 0x%p, param %d.\n", ep, param);
2208 2200
2209 switch (param) { 2201 switch (param) {
2210 case ISCSI_PARAM_CONN_PORT: 2202 case ISCSI_PARAM_CONN_PORT:
2211 spin_lock_bh(&iconn->session->lock);
2212 len = sprintf(buf, "%hu\n", iconn->portal_port);
2213 spin_unlock_bh(&iconn->session->lock);
2214 break;
2215 case ISCSI_PARAM_CONN_ADDRESS: 2203 case ISCSI_PARAM_CONN_ADDRESS:
2216 spin_lock_bh(&iconn->session->lock); 2204 if (!cep)
2217 len = sprintf(buf, "%s\n", iconn->portal_address); 2205 return -ENOTCONN;
2218 spin_unlock_bh(&iconn->session->lock); 2206
2219 break; 2207 csk = cep->csk;
2208 if (!csk)
2209 return -ENOTCONN;
2210
2211 return iscsi_conn_get_addr_param((struct sockaddr_storage *)
2212 &csk->daddr, param, buf);
2220 default: 2213 default:
2221 return iscsi_conn_get_param(cls_conn, param, buf); 2214 return -ENOSYS;
2222 } 2215 }
2223 return len; 2216 return len;
2224} 2217}
2225EXPORT_SYMBOL_GPL(cxgbi_get_conn_param); 2218EXPORT_SYMBOL_GPL(cxgbi_get_ep_param);
2226 2219
2227struct iscsi_cls_conn * 2220struct iscsi_cls_conn *
2228cxgbi_create_conn(struct iscsi_cls_session *cls_session, u32 cid) 2221cxgbi_create_conn(struct iscsi_cls_session *cls_session, u32 cid)
@@ -2289,11 +2282,6 @@ int cxgbi_bind_conn(struct iscsi_cls_session *cls_session,
2289 cxgbi_conn_max_xmit_dlength(conn); 2282 cxgbi_conn_max_xmit_dlength(conn);
2290 cxgbi_conn_max_recv_dlength(conn); 2283 cxgbi_conn_max_recv_dlength(conn);
2291 2284
2292 spin_lock_bh(&conn->session->lock);
2293 sprintf(conn->portal_address, "%pI4", &csk->daddr.sin_addr.s_addr);
2294 conn->portal_port = ntohs(csk->daddr.sin_port);
2295 spin_unlock_bh(&conn->session->lock);
2296
2297 log_debug(1 << CXGBI_DBG_ISCSI, 2285 log_debug(1 << CXGBI_DBG_ISCSI,
2298 "cls 0x%p,0x%p, ep 0x%p, cconn 0x%p, csk 0x%p.\n", 2286 "cls 0x%p,0x%p, ep 0x%p, cconn 0x%p, csk 0x%p.\n",
2299 cls_session, cls_conn, ep, cconn, csk); 2287 cls_session, cls_conn, ep, cconn, csk);