Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b3c202dc authored by Jayamohan Kallickal's avatar Jayamohan Kallickal Committed by Christoph Hellwig
Browse files

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: default avatarMinh Tran <minhduc.tran@emulex.com>
Signed-off-by: default avatarJohn Soni Jose <sony.john-n@emulex.com>
Signed-off-by: default avatarJayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 73af08e1
Loading
Loading
Loading
Loading
+21 −0
Original line number Original line Diff line number Diff line
@@ -71,6 +71,7 @@ struct be_mcc_wrb {
#define BEISCSI_FW_MBX_TIMEOUT	100
#define BEISCSI_FW_MBX_TIMEOUT	100


/* MBOX Command VER */
/* MBOX Command VER */
#define MBX_CMD_VER1	0x01
#define MBX_CMD_VER2	0x02
#define MBX_CMD_VER2	0x02


struct be_mcc_compl {
struct be_mcc_compl {
@@ -1013,6 +1014,26 @@ struct tcp_connect_and_offload_in {
	u8 rsvd0[3];
	u8 rsvd0[3];
} __packed;
} __packed;


struct tcp_connect_and_offload_in_v1 {
	struct be_cmd_req_hdr hdr;
	struct ip_addr_format ip_address;
	u16 tcp_port;
	u16 cid;
	u16 cq_id;
	u16 defq_id;
	struct phys_addr dataout_template_pa;
	u16 hdr_ring_id;
	u16 data_ring_id;
	u8 do_offload;
	u8 ifd_state;
	u8 rsvd0[2];
	u16 tcp_window_size;
	u8 tcp_window_scale_count;
	u8 rsvd1;
	u32 tcp_mss:24;
	u8 rsvd2;
} __packed;

struct tcp_connect_and_offload_out {
struct tcp_connect_and_offload_out {
	struct be_cmd_resp_hdr hdr;
	struct be_cmd_resp_hdr hdr;
	u32 connection_handle;
	u32 connection_handle;
+9 −3
Original line number Original line Diff line number Diff line
@@ -1106,7 +1106,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
	struct beiscsi_hba *phba = beiscsi_ep->phba;
	struct beiscsi_hba *phba = beiscsi_ep->phba;
	struct tcp_connect_and_offload_out *ptcpcnct_out;
	struct tcp_connect_and_offload_out *ptcpcnct_out;
	struct be_dma_mem nonemb_cmd;
	struct be_dma_mem nonemb_cmd;
	unsigned int tag;
	unsigned int tag, req_memsize;
	int ret = -ENOMEM;
	int ret = -ENOMEM;


	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
@@ -1127,8 +1127,14 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
		       (beiscsi_ep->ep_cid)] = ep;
		       (beiscsi_ep->ep_cid)] = ep;


	beiscsi_ep->cid_vld = 0;
	beiscsi_ep->cid_vld = 0;

	if (is_chip_be2_be3r(phba))
		req_memsize = sizeof(struct tcp_connect_and_offload_in);
	else
		req_memsize = sizeof(struct tcp_connect_and_offload_in_v1);

	nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
	nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev,
				sizeof(struct tcp_connect_and_offload_in),
				req_memsize,
				&nonemb_cmd.dma);
				&nonemb_cmd.dma);
	if (nonemb_cmd.va == NULL) {
	if (nonemb_cmd.va == NULL) {


@@ -1139,7 +1145,7 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,
		beiscsi_free_ep(beiscsi_ep);
		beiscsi_free_ep(beiscsi_ep);
		return -ENOMEM;
		return -ENOMEM;
	}
	}
	nonemb_cmd.size = sizeof(struct tcp_connect_and_offload_in);
	nonemb_cmd.size = req_memsize;
	memset(nonemb_cmd.va, 0, nonemb_cmd.size);
	memset(nonemb_cmd.va, 0, nonemb_cmd.size);
	tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
	tag = mgmt_open_connection(phba, dst_addr, beiscsi_ep, &nonemb_cmd);
	if (tag <= 0) {
	if (tag <= 0) {
+10 −3
Original line number Original line Diff line number Diff line
@@ -712,7 +712,7 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
	struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
	struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
	struct be_ctrl_info *ctrl = &phba->ctrl;
	struct be_ctrl_info *ctrl = &phba->ctrl;
	struct be_mcc_wrb *wrb;
	struct be_mcc_wrb *wrb;
	struct tcp_connect_and_offload_in *req;
	struct tcp_connect_and_offload_in_v1 *req;
	unsigned short def_hdr_id;
	unsigned short def_hdr_id;
	unsigned short def_data_id;
	unsigned short def_data_id;
	struct phys_addr template_address = { 0, 0 };
	struct phys_addr template_address = { 0, 0 };
@@ -745,10 +745,10 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
	memset(req, 0, sizeof(*req));
	memset(req, 0, sizeof(*req));
	wrb->tag0 |= tag;
	wrb->tag0 |= tag;


	be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
	be_wrb_hdr_prepare(wrb, nonemb_cmd->size, false, 1);
	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
			   OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
			   OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
			   sizeof(*req));
			   nonemb_cmd->size);
	if (dst_addr->sa_family == PF_INET) {
	if (dst_addr->sa_family == PF_INET) {
		__be32 s_addr = daddr_in->sin_addr.s_addr;
		__be32 s_addr = daddr_in->sin_addr.s_addr;
		req->ip_address.ip_type = BE2_IPV4;
		req->ip_address.ip_type = BE2_IPV4;
@@ -794,6 +794,13 @@ int mgmt_open_connection(struct beiscsi_hba *phba,
	sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
	sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
	sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
	sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
	sge->len = cpu_to_le32(nonemb_cmd->size);
	sge->len = cpu_to_le32(nonemb_cmd->size);

	if (!is_chip_be2_be3r(phba)) {
		req->hdr.version = MBX_CMD_VER1;
		req->tcp_window_size = 0;
		req->tcp_window_scale_count = 2;
	}

	be_mcc_notify(phba);
	be_mcc_notify(phba);
	spin_unlock(&ctrl->mbox_lock);
	spin_unlock(&ctrl->mbox_lock);
	return tag;
	return tag;