All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Jayamohan Kallickal <jayamohank@gmail.com>
Cc: jbottomley@parallels.com, linux-scsi@vger.kernel.org,
	Jayamohan Kallickal <Jayamohan.Kallickal@emulex.com>,
	Minh Tran <minhduc.tran@emulex.com>,
	John Soni Jose <sony.john-n@emulex.com>
Subject: Re: [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading.
Date: Sun, 30 Mar 2014 23:53:42 -0500	[thread overview]
Message-ID: <5338F4D6.9000303@cs.wisc.edu> (raw)
In-Reply-To: <1395938371-2149-5-git-send-email-Jayamohan.Kallickal@emulex.com>

On 03/27/2014 11:39 AM, Jayamohan Kallickal wrote:
> +int mgmt_open_connection_v1(struct beiscsi_hba *phba,
> +			     struct sockaddr *dst_addr,
> +			     struct beiscsi_endpoint *beiscsi_ep,
> +			     struct be_dma_mem *nonemb_cmd)
> +{
> +	struct hwi_controller *phwi_ctrlr;
> +	struct hwi_context_memory *phwi_context;
> +	struct sockaddr_in *daddr_in = (struct sockaddr_in *)dst_addr;
> +	struct sockaddr_in6 *daddr_in6 = (struct sockaddr_in6 *)dst_addr;
> +	struct be_ctrl_info *ctrl = &phba->ctrl;
> +	struct be_mcc_wrb *wrb;
> +	struct tcp_connect_and_offload_in_v1 *req;
> +	unsigned short def_hdr_id;
> +	unsigned short def_data_id;
> +	struct phys_addr template_address = { 0, 0 };
> +	struct phys_addr *ptemplate_address;
> +	unsigned int tag = 0;
> +	unsigned int i, ulp_num;
> +	unsigned short cid = beiscsi_ep->ep_cid;
> +	struct be_sge *sge;
> +
> +	phwi_ctrlr = phba->phwi_ctrlr;
> +	phwi_context = phwi_ctrlr->phwi_ctxt;
> +
> +	ulp_num = phwi_ctrlr->wrb_context[BE_GET_CRI_FROM_CID(cid)].ulp_num;
> +
> +	def_hdr_id = (unsigned short)HWI_GET_DEF_HDRQ_ID(phba, ulp_num);
> +	def_data_id = (unsigned short)HWI_GET_DEF_BUFQ_ID(phba, ulp_num);
> +
> +	ptemplate_address = &template_address;
> +	ISCSI_GET_PDU_TEMPLATE_ADDRESS(phba, ptemplate_address);
> +	spin_lock(&ctrl->mbox_lock);
> +	tag = alloc_mcc_tag(phba);
> +	if (!tag) {
> +		spin_unlock(&ctrl->mbox_lock);
> +		return tag;
> +	}
> +	wrb = wrb_from_mccq(phba);
> +	sge = nonembedded_sgl(wrb);
> +
> +	req = nonemb_cmd->va;
> +	memset(req, 0, sizeof(*req));
> +	wrb->tag0 |= tag;
> +
> +	be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1);
> +	be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI,
> +			   OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD,
> +			   sizeof(*req));
> +	if (dst_addr->sa_family == PF_INET) {
> +		__be32 s_addr = daddr_in->sin_addr.s_addr;
> +		req->ip_address.ip_type = BE2_IPV4;
> +		req->ip_address.addr[0] = s_addr & 0x000000ff;
> +		req->ip_address.addr[1] = (s_addr & 0x0000ff00) >> 8;
> +		req->ip_address.addr[2] = (s_addr & 0x00ff0000) >> 16;
> +		req->ip_address.addr[3] = (s_addr & 0xff000000) >> 24;
> +		req->tcp_port = ntohs(daddr_in->sin_port);
> +		beiscsi_ep->dst_addr = daddr_in->sin_addr.s_addr;
> +		beiscsi_ep->dst_tcpport = ntohs(daddr_in->sin_port);
> +		beiscsi_ep->ip_type = BE2_IPV4;
> +	} else if (dst_addr->sa_family == PF_INET6) {
> +		req->ip_address.ip_type = BE2_IPV6;
> +		memcpy(&req->ip_address.addr,
> +		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> +		req->tcp_port = ntohs(daddr_in6->sin6_port);
> +		beiscsi_ep->dst_tcpport = ntohs(daddr_in6->sin6_port);
> +		memcpy(&beiscsi_ep->dst6_addr,
> +		       &daddr_in6->sin6_addr.in6_u.u6_addr8, 16);
> +		beiscsi_ep->ip_type = BE2_IPV6;
> +	} else{
> +		beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG,
> +			    "BG_%d : unknown addr family %d\n",
> +			    dst_addr->sa_family);
> +		spin_unlock(&ctrl->mbox_lock);
> +		free_mcc_tag(&phba->ctrl, tag);
> +		return -EINVAL;
> +
> +	}
> +	req->cid = cid;
> +	i = phba->nxt_cqid++;
> +	if (phba->nxt_cqid == phba->num_cpus)
> +		phba->nxt_cqid = 0;
> +	req->cq_id = phwi_context->be_cq[i].id;
> +	beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_CONFIG,
> +		    "BG_%d : i=%d cq_id=%d\n", i, req->cq_id);
> +	req->defq_id = def_hdr_id;
> +	req->hdr_ring_id = def_hdr_id;
> +	req->data_ring_id = def_data_id;
> +	req->do_offload = 1;
> +	req->dataout_template_pa.lo = ptemplate_address->lo;
> +	req->dataout_template_pa.hi = ptemplate_address->hi;
> +	sge->pa_hi = cpu_to_le32(upper_32_bits(nonemb_cmd->dma));
> +	sge->pa_lo = cpu_to_le32(nonemb_cmd->dma & 0xFFFFFFFF);
> +	sge->len = cpu_to_le32(nonemb_cmd->size);
> +
> +	req->hdr.version = 1;
> +	req->tcp_window_size = 0;
> +	req->tcp_window_scale_count = 2;

Is this approx 100 lines exactly the same as mgmt_open_connection except
these 3 lines? Maybe a lib/helper function that does the common 100
lines then some v1 function over that which does the extra 3 lines.

  reply	other threads:[~2014-03-31  4:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-27 16:39 [PATCH 1/6] be2iscsi: Fix retrieving MCCQ_WRB in non-embedded Mbox path Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 2/6] be2iscsi: relinquishing control after processing 512 CQE Jayamohan Kallickal
2014-03-31  5:25   ` Mike Christie
2014-04-03  5:02     ` Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 3/6] be2iscsi: Fix MCCQ posting for Mbx-Cmd after driver initialization is complete Jayamohan Kallickal
2014-03-28  0:45   ` Mike Christie
2014-04-03  5:02     ` Jayamohan Kallickal
2014-04-03 18:30       ` Mike Christie
2014-04-03 18:39         ` Mike Christie
2014-03-27 16:39 ` [PATCH 4/6] be2iscsi: Fix interrupt Coalescing mechanism Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 5/6] be2iscsi: Fix TCP parameters while connection offloading Jayamohan Kallickal
2014-03-31  4:53   ` Mike Christie [this message]
2014-04-03  5:02     ` Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 6/6] be2iscsi: Bump the driver version Jayamohan Kallickal
2014-03-27 16:39 ` [PATCH 0/6] be2iscsi: Update to 10.2.218.0 Jayamohan Kallickal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5338F4D6.9000303@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=Jayamohan.Kallickal@emulex.com \
    --cc=jayamohank@gmail.com \
    --cc=jbottomley@parallels.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=minhduc.tran@emulex.com \
    --cc=sony.john-n@emulex.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.