diff options
Diffstat (limited to 'drivers/scsi/cxgb3i')
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_ddp.c | 1 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_ddp.h | 1 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_iscsi.c | 22 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_offload.c | 66 | ||||
-rw-r--r-- | drivers/scsi/cxgb3i/cxgb3i_pdu.c | 11 |
5 files changed, 74 insertions, 27 deletions
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.c b/drivers/scsi/cxgb3i/cxgb3i_ddp.c index 344fd53b9954..b58d9134ac1b 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_ddp.c +++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.c | |||
@@ -10,6 +10,7 @@ | |||
10 | * Written by: Karen Xie (kxie@chelsio.com) | 10 | * Written by: Karen Xie (kxie@chelsio.com) |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/slab.h> | ||
13 | #include <linux/skbuff.h> | 14 | #include <linux/skbuff.h> |
14 | #include <linux/scatterlist.h> | 15 | #include <linux/scatterlist.h> |
15 | 16 | ||
diff --git a/drivers/scsi/cxgb3i/cxgb3i_ddp.h b/drivers/scsi/cxgb3i/cxgb3i_ddp.h index 87dd56b422bf..6761b329124d 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_ddp.h +++ b/drivers/scsi/cxgb3i/cxgb3i_ddp.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #ifndef __CXGB3I_ULP2_DDP_H__ | 13 | #ifndef __CXGB3I_ULP2_DDP_H__ |
14 | #define __CXGB3I_ULP2_DDP_H__ | 14 | #define __CXGB3I_ULP2_DDP_H__ |
15 | 15 | ||
16 | #include <linux/slab.h> | ||
16 | #include <linux/vmalloc.h> | 17 | #include <linux/vmalloc.h> |
17 | 18 | ||
18 | /** | 19 | /** |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c index 2631bddd255e..7b686abaae64 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_iscsi.c +++ b/drivers/scsi/cxgb3i/cxgb3i_iscsi.c | |||
@@ -12,6 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/inet.h> | 14 | #include <linux/inet.h> |
15 | #include <linux/slab.h> | ||
15 | #include <linux/crypto.h> | 16 | #include <linux/crypto.h> |
16 | #include <linux/if_vlan.h> | 17 | #include <linux/if_vlan.h> |
17 | #include <net/dst.h> | 18 | #include <net/dst.h> |
@@ -591,8 +592,7 @@ static int cxgb3i_conn_bind(struct iscsi_cls_session *cls_session, | |||
591 | cxgb3i_conn_max_recv_dlength(conn); | 592 | cxgb3i_conn_max_recv_dlength(conn); |
592 | 593 | ||
593 | spin_lock_bh(&conn->session->lock); | 594 | spin_lock_bh(&conn->session->lock); |
594 | sprintf(conn->portal_address, NIPQUAD_FMT, | 595 | sprintf(conn->portal_address, "%pI4", &c3cn->daddr.sin_addr.s_addr); |
595 | NIPQUAD(c3cn->daddr.sin_addr.s_addr)); | ||
596 | conn->portal_port = ntohs(c3cn->daddr.sin_port); | 596 | conn->portal_port = ntohs(c3cn->daddr.sin_port); |
597 | spin_unlock_bh(&conn->session->lock); | 597 | spin_unlock_bh(&conn->session->lock); |
598 | 598 | ||
@@ -709,6 +709,12 @@ static int cxgb3i_host_set_param(struct Scsi_Host *shost, | |||
709 | { | 709 | { |
710 | struct cxgb3i_hba *hba = iscsi_host_priv(shost); | 710 | struct cxgb3i_hba *hba = iscsi_host_priv(shost); |
711 | 711 | ||
712 | if (!hba->ndev) { | ||
713 | shost_printk(KERN_ERR, shost, "Could not set host param. " | ||
714 | "Netdev for host not set.\n"); | ||
715 | return -ENODEV; | ||
716 | } | ||
717 | |||
712 | cxgb3i_api_debug("param %d, buf %s.\n", param, buf); | 718 | cxgb3i_api_debug("param %d, buf %s.\n", param, buf); |
713 | 719 | ||
714 | switch (param) { | 720 | switch (param) { |
@@ -739,6 +745,12 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost, | |||
739 | struct cxgb3i_hba *hba = iscsi_host_priv(shost); | 745 | struct cxgb3i_hba *hba = iscsi_host_priv(shost); |
740 | int len = 0; | 746 | int len = 0; |
741 | 747 | ||
748 | if (!hba->ndev) { | ||
749 | shost_printk(KERN_ERR, shost, "Could not set host param. " | ||
750 | "Netdev for host not set.\n"); | ||
751 | return -ENODEV; | ||
752 | } | ||
753 | |||
742 | cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param); | 754 | cxgb3i_api_debug("hba %s, param %d.\n", hba->ndev->name, param); |
743 | 755 | ||
744 | switch (param) { | 756 | switch (param) { |
@@ -753,7 +765,7 @@ static int cxgb3i_host_get_param(struct Scsi_Host *shost, | |||
753 | __be32 addr; | 765 | __be32 addr; |
754 | 766 | ||
755 | addr = cxgb3i_get_private_ipv4addr(hba->ndev); | 767 | addr = cxgb3i_get_private_ipv4addr(hba->ndev); |
756 | len = sprintf(buf, NIPQUAD_FMT, NIPQUAD(addr)); | 768 | len = sprintf(buf, "%pI4", &addr); |
757 | break; | 769 | break; |
758 | } | 770 | } |
759 | default: | 771 | default: |
@@ -904,7 +916,7 @@ static struct scsi_host_template cxgb3i_host_template = { | |||
904 | .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, | 916 | .cmd_per_lun = ISCSI_DEF_CMD_PER_LUN, |
905 | .eh_abort_handler = iscsi_eh_abort, | 917 | .eh_abort_handler = iscsi_eh_abort, |
906 | .eh_device_reset_handler = iscsi_eh_device_reset, | 918 | .eh_device_reset_handler = iscsi_eh_device_reset, |
907 | .eh_target_reset_handler = iscsi_eh_target_reset, | 919 | .eh_target_reset_handler = iscsi_eh_recover_target, |
908 | .target_alloc = iscsi_target_alloc, | 920 | .target_alloc = iscsi_target_alloc, |
909 | .use_clustering = DISABLE_CLUSTERING, | 921 | .use_clustering = DISABLE_CLUSTERING, |
910 | .this_id = -1, | 922 | .this_id = -1, |
@@ -937,7 +949,7 @@ static struct iscsi_transport cxgb3i_iscsi_transport = { | |||
937 | ISCSI_USERNAME | ISCSI_PASSWORD | | 949 | ISCSI_USERNAME | ISCSI_PASSWORD | |
938 | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | | 950 | ISCSI_USERNAME_IN | ISCSI_PASSWORD_IN | |
939 | ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | | 951 | ISCSI_FAST_ABORT | ISCSI_ABORT_TMO | |
940 | ISCSI_LU_RESET_TMO | | 952 | ISCSI_LU_RESET_TMO | ISCSI_TGT_RESET_TMO | |
941 | ISCSI_PING_TMO | ISCSI_RECV_TMO | | 953 | ISCSI_PING_TMO | ISCSI_RECV_TMO | |
942 | ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME, | 954 | ISCSI_IFACE_NAME | ISCSI_INITIATOR_NAME, |
943 | .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | | 955 | .host_param_mask = ISCSI_HOST_HWADDRESS | ISCSI_HOST_IPADDRESS | |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_offload.c b/drivers/scsi/cxgb3i/cxgb3i_offload.c index c1d5be4adf9c..a175be9c496f 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_offload.c +++ b/drivers/scsi/cxgb3i/cxgb3i_offload.c | |||
@@ -13,6 +13,7 @@ | |||
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/if_vlan.h> | 15 | #include <linux/if_vlan.h> |
16 | #include <linux/slab.h> | ||
16 | #include <linux/version.h> | 17 | #include <linux/version.h> |
17 | 18 | ||
18 | #include "cxgb3_defs.h" | 19 | #include "cxgb3_defs.h" |
@@ -291,7 +292,7 @@ static void act_open_req_arp_failure(struct t3cdev *dev, struct sk_buff *skb) | |||
291 | c3cn_hold(c3cn); | 292 | c3cn_hold(c3cn); |
292 | spin_lock_bh(&c3cn->lock); | 293 | spin_lock_bh(&c3cn->lock); |
293 | if (c3cn->state == C3CN_STATE_CONNECTING) | 294 | if (c3cn->state == C3CN_STATE_CONNECTING) |
294 | fail_act_open(c3cn, EHOSTUNREACH); | 295 | fail_act_open(c3cn, -EHOSTUNREACH); |
295 | spin_unlock_bh(&c3cn->lock); | 296 | spin_unlock_bh(&c3cn->lock); |
296 | c3cn_put(c3cn); | 297 | c3cn_put(c3cn); |
297 | __kfree_skb(skb); | 298 | __kfree_skb(skb); |
@@ -792,18 +793,18 @@ static int act_open_rpl_status_to_errno(int status) | |||
792 | { | 793 | { |
793 | switch (status) { | 794 | switch (status) { |
794 | case CPL_ERR_CONN_RESET: | 795 | case CPL_ERR_CONN_RESET: |
795 | return ECONNREFUSED; | 796 | return -ECONNREFUSED; |
796 | case CPL_ERR_ARP_MISS: | 797 | case CPL_ERR_ARP_MISS: |
797 | return EHOSTUNREACH; | 798 | return -EHOSTUNREACH; |
798 | case CPL_ERR_CONN_TIMEDOUT: | 799 | case CPL_ERR_CONN_TIMEDOUT: |
799 | return ETIMEDOUT; | 800 | return -ETIMEDOUT; |
800 | case CPL_ERR_TCAM_FULL: | 801 | case CPL_ERR_TCAM_FULL: |
801 | return ENOMEM; | 802 | return -ENOMEM; |
802 | case CPL_ERR_CONN_EXIST: | 803 | case CPL_ERR_CONN_EXIST: |
803 | cxgb3i_log_error("ACTIVE_OPEN_RPL: 4-tuple in use\n"); | 804 | cxgb3i_log_error("ACTIVE_OPEN_RPL: 4-tuple in use\n"); |
804 | return EADDRINUSE; | 805 | return -EADDRINUSE; |
805 | default: | 806 | default: |
806 | return EIO; | 807 | return -EIO; |
807 | } | 808 | } |
808 | } | 809 | } |
809 | 810 | ||
@@ -817,7 +818,7 @@ static void act_open_retry_timer(unsigned long data) | |||
817 | spin_lock_bh(&c3cn->lock); | 818 | spin_lock_bh(&c3cn->lock); |
818 | skb = alloc_skb(sizeof(struct cpl_act_open_req), GFP_ATOMIC); | 819 | skb = alloc_skb(sizeof(struct cpl_act_open_req), GFP_ATOMIC); |
819 | if (!skb) | 820 | if (!skb) |
820 | fail_act_open(c3cn, ENOMEM); | 821 | fail_act_open(c3cn, -ENOMEM); |
821 | else { | 822 | else { |
822 | skb->sk = (struct sock *)c3cn; | 823 | skb->sk = (struct sock *)c3cn; |
823 | set_arp_failure_handler(skb, act_open_req_arp_failure); | 824 | set_arp_failure_handler(skb, act_open_req_arp_failure); |
@@ -966,14 +967,14 @@ static int abort_status_to_errno(struct s3_conn *c3cn, int abort_reason, | |||
966 | case CPL_ERR_BAD_SYN: /* fall through */ | 967 | case CPL_ERR_BAD_SYN: /* fall through */ |
967 | case CPL_ERR_CONN_RESET: | 968 | case CPL_ERR_CONN_RESET: |
968 | return c3cn->state > C3CN_STATE_ESTABLISHED ? | 969 | return c3cn->state > C3CN_STATE_ESTABLISHED ? |
969 | EPIPE : ECONNRESET; | 970 | -EPIPE : -ECONNRESET; |
970 | case CPL_ERR_XMIT_TIMEDOUT: | 971 | case CPL_ERR_XMIT_TIMEDOUT: |
971 | case CPL_ERR_PERSIST_TIMEDOUT: | 972 | case CPL_ERR_PERSIST_TIMEDOUT: |
972 | case CPL_ERR_FINWAIT2_TIMEDOUT: | 973 | case CPL_ERR_FINWAIT2_TIMEDOUT: |
973 | case CPL_ERR_KEEPALIVE_TIMEDOUT: | 974 | case CPL_ERR_KEEPALIVE_TIMEDOUT: |
974 | return ETIMEDOUT; | 975 | return -ETIMEDOUT; |
975 | default: | 976 | default: |
976 | return EIO; | 977 | return -EIO; |
977 | } | 978 | } |
978 | } | 979 | } |
979 | 980 | ||
@@ -1440,6 +1441,10 @@ void cxgb3i_c3cn_release(struct s3_conn *c3cn) | |||
1440 | static int is_cxgb3_dev(struct net_device *dev) | 1441 | static int is_cxgb3_dev(struct net_device *dev) |
1441 | { | 1442 | { |
1442 | struct cxgb3i_sdev_data *cdata; | 1443 | struct cxgb3i_sdev_data *cdata; |
1444 | struct net_device *ndev = dev; | ||
1445 | |||
1446 | if (dev->priv_flags & IFF_802_1Q_VLAN) | ||
1447 | ndev = vlan_dev_real_dev(dev); | ||
1443 | 1448 | ||
1444 | write_lock(&cdata_rwlock); | 1449 | write_lock(&cdata_rwlock); |
1445 | list_for_each_entry(cdata, &cdata_list, list) { | 1450 | list_for_each_entry(cdata, &cdata_list, list) { |
@@ -1447,7 +1452,7 @@ static int is_cxgb3_dev(struct net_device *dev) | |||
1447 | int i; | 1452 | int i; |
1448 | 1453 | ||
1449 | for (i = 0; i < ports->nports; i++) | 1454 | for (i = 0; i < ports->nports; i++) |
1450 | if (dev == ports->lldevs[i]) { | 1455 | if (ndev == ports->lldevs[i]) { |
1451 | write_unlock(&cdata_rwlock); | 1456 | write_unlock(&cdata_rwlock); |
1452 | return 1; | 1457 | return 1; |
1453 | } | 1458 | } |
@@ -1563,9 +1568,29 @@ free_tid: | |||
1563 | s3_free_atid(cdev, c3cn->tid); | 1568 | s3_free_atid(cdev, c3cn->tid); |
1564 | c3cn->tid = 0; | 1569 | c3cn->tid = 0; |
1565 | out_err: | 1570 | out_err: |
1566 | return -1; | 1571 | return -EINVAL; |
1567 | } | 1572 | } |
1568 | 1573 | ||
1574 | /** | ||
1575 | * cxgb3i_find_dev - find the interface associated with the given address | ||
1576 | * @ipaddr: ip address | ||
1577 | */ | ||
1578 | static struct net_device * | ||
1579 | cxgb3i_find_dev(struct net_device *dev, __be32 ipaddr) | ||
1580 | { | ||
1581 | struct flowi fl; | ||
1582 | int err; | ||
1583 | struct rtable *rt; | ||
1584 | |||
1585 | memset(&fl, 0, sizeof(fl)); | ||
1586 | fl.nl_u.ip4_u.daddr = ipaddr; | ||
1587 | |||
1588 | err = ip_route_output_key(dev ? dev_net(dev) : &init_net, &rt, &fl); | ||
1589 | if (!err) | ||
1590 | return (&rt->u.dst)->dev; | ||
1591 | |||
1592 | return NULL; | ||
1593 | } | ||
1569 | 1594 | ||
1570 | /** | 1595 | /** |
1571 | * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address | 1596 | * cxgb3i_c3cn_connect - initiates an iscsi tcp connection to a given address |
@@ -1581,6 +1606,7 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn, | |||
1581 | struct cxgb3i_sdev_data *cdata; | 1606 | struct cxgb3i_sdev_data *cdata; |
1582 | struct t3cdev *cdev; | 1607 | struct t3cdev *cdev; |
1583 | __be32 sipv4; | 1608 | __be32 sipv4; |
1609 | struct net_device *dstdev; | ||
1584 | int err; | 1610 | int err; |
1585 | 1611 | ||
1586 | c3cn_conn_debug("c3cn 0x%p, dev 0x%p.\n", c3cn, dev); | 1612 | c3cn_conn_debug("c3cn 0x%p, dev 0x%p.\n", c3cn, dev); |
@@ -1591,6 +1617,13 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn, | |||
1591 | c3cn->daddr.sin_port = usin->sin_port; | 1617 | c3cn->daddr.sin_port = usin->sin_port; |
1592 | c3cn->daddr.sin_addr.s_addr = usin->sin_addr.s_addr; | 1618 | c3cn->daddr.sin_addr.s_addr = usin->sin_addr.s_addr; |
1593 | 1619 | ||
1620 | dstdev = cxgb3i_find_dev(dev, usin->sin_addr.s_addr); | ||
1621 | if (!dstdev || !is_cxgb3_dev(dstdev)) | ||
1622 | return -ENETUNREACH; | ||
1623 | |||
1624 | if (dstdev->priv_flags & IFF_802_1Q_VLAN) | ||
1625 | dev = dstdev; | ||
1626 | |||
1594 | rt = find_route(dev, c3cn->saddr.sin_addr.s_addr, | 1627 | rt = find_route(dev, c3cn->saddr.sin_addr.s_addr, |
1595 | c3cn->daddr.sin_addr.s_addr, | 1628 | c3cn->daddr.sin_addr.s_addr, |
1596 | c3cn->saddr.sin_port, | 1629 | c3cn->saddr.sin_port, |
@@ -1643,10 +1676,11 @@ int cxgb3i_c3cn_connect(struct net_device *dev, struct s3_conn *c3cn, | |||
1643 | } else | 1676 | } else |
1644 | c3cn->saddr.sin_addr.s_addr = sipv4; | 1677 | c3cn->saddr.sin_addr.s_addr = sipv4; |
1645 | 1678 | ||
1646 | c3cn_conn_debug("c3cn 0x%p, %u.%u.%u.%u,%u-%u.%u.%u.%u,%u SYN_SENT.\n", | 1679 | c3cn_conn_debug("c3cn 0x%p, %pI4,%u-%pI4,%u SYN_SENT.\n", |
1647 | c3cn, NIPQUAD(c3cn->saddr.sin_addr.s_addr), | 1680 | c3cn, |
1681 | &c3cn->saddr.sin_addr.s_addr, | ||
1648 | ntohs(c3cn->saddr.sin_port), | 1682 | ntohs(c3cn->saddr.sin_port), |
1649 | NIPQUAD(c3cn->daddr.sin_addr.s_addr), | 1683 | &c3cn->daddr.sin_addr.s_addr, |
1650 | ntohs(c3cn->daddr.sin_port)); | 1684 | ntohs(c3cn->daddr.sin_port)); |
1651 | 1685 | ||
1652 | c3cn_set_state(c3cn, C3CN_STATE_CONNECTING); | 1686 | c3cn_set_state(c3cn, C3CN_STATE_CONNECTING); |
diff --git a/drivers/scsi/cxgb3i/cxgb3i_pdu.c b/drivers/scsi/cxgb3i/cxgb3i_pdu.c index 709105071177..dc5e3e77a351 100644 --- a/drivers/scsi/cxgb3i/cxgb3i_pdu.c +++ b/drivers/scsi/cxgb3i/cxgb3i_pdu.c | |||
@@ -12,6 +12,7 @@ | |||
12 | * Written by: Karen Xie (kxie@chelsio.com) | 12 | * Written by: Karen Xie (kxie@chelsio.com) |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/slab.h> | ||
15 | #include <linux/skbuff.h> | 16 | #include <linux/skbuff.h> |
16 | #include <linux/crypto.h> | 17 | #include <linux/crypto.h> |
17 | #include <scsi/scsi_cmnd.h> | 18 | #include <scsi/scsi_cmnd.h> |
@@ -388,8 +389,8 @@ int cxgb3i_conn_xmit_pdu(struct iscsi_task *task) | |||
388 | if (err > 0) { | 389 | if (err > 0) { |
389 | int pdulen = err; | 390 | int pdulen = err; |
390 | 391 | ||
391 | cxgb3i_tx_debug("task 0x%p, skb 0x%p, len %u/%u, rv %d.\n", | 392 | cxgb3i_tx_debug("task 0x%p, skb 0x%p, len %u/%u, rv %d.\n", |
392 | task, skb, skb->len, skb->data_len, err); | 393 | task, skb, skb->len, skb->data_len, err); |
393 | 394 | ||
394 | if (task->conn->hdrdgst_en) | 395 | if (task->conn->hdrdgst_en) |
395 | pdulen += ISCSI_DIGEST_SIZE; | 396 | pdulen += ISCSI_DIGEST_SIZE; |
@@ -461,10 +462,8 @@ void cxgb3i_conn_pdu_ready(struct s3_conn *c3cn) | |||
461 | skb = skb_peek(&c3cn->receive_queue); | 462 | skb = skb_peek(&c3cn->receive_queue); |
462 | } | 463 | } |
463 | read_unlock(&c3cn->callback_lock); | 464 | read_unlock(&c3cn->callback_lock); |
464 | if (c3cn) { | 465 | c3cn->copied_seq += read; |
465 | c3cn->copied_seq += read; | 466 | cxgb3i_c3cn_rx_credits(c3cn, read); |
466 | cxgb3i_c3cn_rx_credits(c3cn, read); | ||
467 | } | ||
468 | conn->rxdata_octets += read; | 467 | conn->rxdata_octets += read; |
469 | 468 | ||
470 | if (err) { | 469 | if (err) { |