aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJayamohan Kallickal <jayamohan.kallickal@emulex.com>2014-05-05 21:41:27 -0400
committerChristoph Hellwig <hch@lst.de>2014-05-28 12:13:15 -0400
commitb3c202dc57607174468b3ea6b4220b7ca5643f05 (patch)
tree243066fdd53267107236aed2387edf01e24ef91f
parent73af08e11c6638e2abd6b1fa13cdab58c2bbdbf8 (diff)
be2iscsi: Fix TCP parameters while connection offloading.
SKH-R adapter, TCP Window Size/Scale parameters are passed in TCP Connection Offload Mbx Command. Signed-off-by: Minh Tran <minhduc.tran@emulex.com> Signed-off-by: John Soni Jose <sony.john-n@emulex.com> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--drivers/scsi/be2iscsi/be_cmds.h21
-rw-r--r--drivers/scsi/be2iscsi/be_iscsi.c12
-rw-r--r--drivers/scsi/be2iscsi/be_mgmt.c13
3 files changed, 40 insertions, 6 deletions
diff --git a/drivers/scsi/be2iscsi/be_cmds.h b/drivers/scsi/be2iscsi/be_cmds.h
index cd4410f934c7..cc7405c0eca0 100644
--- a/drivers/scsi/be2iscsi/be_cmds.h
+++ b/drivers/scsi/be2iscsi/be_cmds.h
@@ -71,6 +71,7 @@ struct be_mcc_wrb {
71#define BEISCSI_FW_MBX_TIMEOUT 100 71#define BEISCSI_FW_MBX_TIMEOUT 100
72 72
73/* MBOX Command VER */ 73/* MBOX Command VER */
74#define MBX_CMD_VER1 0x01
74#define MBX_CMD_VER2 0x02 75#define MBX_CMD_VER2 0x02
75 76
76struct be_mcc_compl { 77struct be_mcc_compl {
@@ -1013,6 +1014,26 @@ struct tcp_connect_and_offload_in {
1013 u8 rsvd0[3]; 1014 u8 rsvd0[3];
1014} __packed; 1015} __packed;
1015 1016
1017struct tcp_connect_and_offload_in_v1 {
1018 struct be_cmd_req_hdr hdr;
1019 struct ip_addr_format ip_address;
1020 u16 tcp_port;
1021 u16 cid;
1022 u16 cq_id;
1023 u16 defq_id;
1024 struct phys_addr dataout_template_pa;
1025 u16 hdr_ring_id;
1026 u16 data_ring_id;
1027 u8 do_offload;
1028 u8 ifd_state;
1029 u8 rsvd0[2];
1030 u16 tcp_window_size;
1031 u8 tcp_window_scale_count;
1032 u8 rsvd1;
1033 u32 tcp_mss:24;
1034 u8 rsvd2;
1035} __packed;
1036
1016struct tcp_connect_and_offload_out { 1037struct tcp_connect_and_offload_out {
1017 struct be_cmd_resp_hdr hdr; 1038 struct be_cmd_resp_hdr hdr;
1018 u32 connection_handle; 1039 u32 connection_handle;
diff --git a/drivers/scsi/be2iscsi/be_iscsi.c b/drivers/scsi/be2iscsi/be_iscsi.c
index a3df43324c98..fd284ff36ecf 100644
--- a/drivers/scsi/be2iscsi/be_iscsi.c
+++ b/drivers/scsi/be2iscsi/be_iscsi.c
@@ -1106,7 +1106,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
1106 struct beiscsi_hba *phba = beiscsi_ep->phba; 1106 struct beiscsi_hba *phba = beiscsi_ep->phba;
1107 struct tcp_connect_and_offload_out *ptcpcnct_out; 1107 struct tcp_connect_and_offload_out *ptcpcnct_out;
1108 struct be_dma_mem nonemb_cmd; 1108 struct be_dma_mem nonemb_cmd;
1109 unsigned int tag; 1109 unsigned int tag, req_memsize;
1110 int ret = -ENOMEM; 1110 int ret = -ENOMEM;
1111 1111
1112 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG, 1112 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
@@ -1127,8 +1127,14 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
1127 (beiscsi_ep->ep_cid)] = ep; 1127 (beiscsi_ep->ep_cid)] = ep;
1128 1128
1129 beiscsi_ep->cid_vld = 0; 1129 beiscsi_ep->cid_vld = 0;
1130
1131 if (is_chip_be2_be3r(phba))
1132 req_memsize = sizeof(struct tcp_connect_and_offload_in);
1133 else
1134 req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);
1135
1130 nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, 1136 nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
1131 sizeof(struct tcp_connect_and_offload_in), 1137 req_memsize,
1132 &nonemb_cmd.dma); 1138 &nonemb_cmd.dma);
1133 if (nonemb_cmd.va == NULL) { 1139 if (nonemb_cmd.va == NULL) {
1134 1140
@@ -1139,7 +1145,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
1139 beiscsi_free_ep(beiscsi_ep); 1145 beiscsi_free_ep(beiscsi_ep);
1140 return -ENOMEM; 1146 return -ENOMEM;
1141 } 1147 }
1142 nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in); 1148 nonemb_cmd.size = req_memsize;
1143 memset(nonemb_cmd.va, 0, nonemb_cmd.size); 1149 memset(nonemb_cmd.va, 0, nonemb_cmd.size);
1144 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd); 1150 tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
1145 if (tag <= 0) { 1151 if (tag <= 0) {
diff --git a/drivers/scsi/be2iscsi/be_mgmt.c b/drivers/scsi/be2iscsi/be_mgmt.c
index 52a36fba1e2b..6045aa78986a 100644
--- a/drivers/scsi/be2iscsi/be_mgmt.c
+++ b/drivers/scsi/be2iscsi/be_mgmt.c
@@ -712,7 +712,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
712 struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr; 712 struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
713 struct be_ctrl_info *ctrl = &phba->ctrl; 713 struct be_ctrl_info *ctrl = &phba->ctrl;
714 struct be_mcc_wrb *wrb; 714 struct be_mcc_wrb *wrb;
715 struct tcp_connect_and_offload_in *req; 715 struct tcp_connect_and_offload_in_v1 *req;
716 unsigned short def_hdr_id; 716 unsigned short def_hdr_id;
717 unsigned short def_data_id; 717 unsigned short def_data_id;
718 struct phys_addr template_address = { 0, 0 }; 718 struct phys_addr template_address = { 0, 0 };
@@ -745,10 +745,10 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
745 memset(req, 0, sizeof(*req)); 745 memset(req, 0, sizeof(*req));
746 wrb->tag0 |= tag; 746 wrb->tag0 |= tag;
747 747
748 be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1); 748 be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1);
749 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, 749 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
750 OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD, 750 OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
751 sizeof(*req)); 751 nonemb_cmd->size);
752 if (dst_addr->sa_family == PF_INET) { 752 if (dst_addr->sa_family == PF_INET) {
753 __be32 s_addr = daddr_in->sin_addr.s_addr; 753 __be32 s_addr = daddr_in->sin_addr.s_addr;
754 req->ip_address.ip_type = BE2_IPV4; 754 req->ip_address.ip_type = BE2_IPV4;
@@ -794,6 +794,13 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
794 sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma)); 794 sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
795 sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF); 795 sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
796 sge->len = cpu_to_le32(nonemb_cmd->size); 796 sge->len = cpu_to_le32(nonemb_cmd->size);
797
798 if (!is_chip_be2_be3r(phba)) {
799 req->hdr.version = MBX_CMD_VER1;
800 req->tcp_window_size = 0;
801 req->tcp_window_scale_count = 2;
802 }
803
797 be_mcc_notify(phba); 804 be_mcc_notify(phba);
798 spin_unlock(&ctrl->mbox_lock); 805 spin_unlock(&ctrl->mbox_lock);
799 return tag; 806 return tag;