Ejemplo n.º 1
0
u16
fc_rnid_acc_build(struct fchs_s *fchs, struct fc_rnid_acc_s *rnid_acc, u32 d_id,
		  u32 s_id, __be16 ox_id, u32 data_format,
		  struct fc_rnid_common_id_data_s *common_id_data,
		  struct fc_rnid_general_topology_data_s *gen_topo_data)
{
	memset(rnid_acc, 0, sizeof(struct fc_rnid_acc_s));

	fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	rnid_acc->els_cmd.els_code = FC_ELS_ACC;
	rnid_acc->node_id_data_format = data_format;
	rnid_acc->common_id_data_length =
			sizeof(struct fc_rnid_common_id_data_s);
	rnid_acc->common_id_data = *common_id_data;

	if (data_format == RNID_NODEID_DATA_FORMAT_DISCOVERY) {
		rnid_acc->specific_id_data_length =
			sizeof(struct fc_rnid_general_topology_data_s);
		rnid_acc->gen_topology_data = *gen_topo_data;
		return sizeof(struct fc_rnid_acc_s);
	} else {
		return sizeof(struct fc_rnid_acc_s) -
			sizeof(struct fc_rnid_general_topology_data_s);
	}

}
Ejemplo n.º 2
0
static          u16
fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
		 __be16 ox_id, wwn_t port_name, wwn_t node_name,
		 u16 pdu_size, u16 bb_cr, u8 els_code)
{
	struct fc_logi_s *plogi = (struct fc_logi_s *) (pld);

	memcpy(plogi, &plogi_tmpl, sizeof(struct fc_logi_s));

	/* For FC AL bb_cr is 0 and altbbcred is 1 */
	if (!bb_cr)
		plogi->csp.altbbcred = 1;

	plogi->els_cmd.els_code = els_code;
	if (els_code == FC_ELS_PLOGI)
		fc_els_req_build(fchs, d_id, s_id, ox_id);
	else
		fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	plogi->csp.rxsz = plogi->class3.rxsz = cpu_to_be16(pdu_size);
	plogi->csp.bbcred  = cpu_to_be16(bb_cr);

	memcpy(&plogi->port_name, &port_name, sizeof(wwn_t));
	memcpy(&plogi->node_name, &node_name, sizeof(wwn_t));

	return sizeof(struct fc_logi_s);
}
Ejemplo n.º 3
0
u16
fc_ls_acc_build(struct fchs_s *fchs, struct fc_els_cmd_s *els_cmd, u32 d_id,
		u32 s_id, __be16 ox_id)
{
	fc_els_rsp_build(fchs, d_id, s_id, ox_id);
	memset(els_cmd, 0, sizeof(struct fc_els_cmd_s));
	els_cmd->els_code = FC_ELS_ACC;

	return sizeof(struct fc_els_cmd_s);
}
Ejemplo n.º 4
0
u16
fc_logo_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
		  __be16 ox_id)
{
	struct fc_els_cmd_s *acc = pld;

	fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	memset(acc, 0, sizeof(struct fc_els_cmd_s));
	acc->els_code = FC_ELS_ACC;

	return sizeof(struct fc_els_cmd_s);
}
Ejemplo n.º 5
0
u16
fc_ls_rjt_build(struct fchs_s *fchs, struct fc_ls_rjt_s *ls_rjt, u32 d_id,
		u32 s_id, __be16 ox_id, u8 reason_code,
		u8 reason_code_expl)
{
	fc_els_rsp_build(fchs, d_id, s_id, ox_id);
	memset(ls_rjt, 0, sizeof(struct fc_ls_rjt_s));

	ls_rjt->els_cmd.els_code = FC_ELS_LS_RJT;
	ls_rjt->reason_code = reason_code;
	ls_rjt->reason_code_expl = reason_code_expl;
	ls_rjt->vendor_unique = 0x00;

	return sizeof(struct fc_ls_rjt_s);
}
Ejemplo n.º 6
0
u16
fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
		  __be16 ox_id, enum bfa_lport_role role)
{
	struct fc_prli_s *prli = (struct fc_prli_s *) (pld);

	fc_els_rsp_build(fchs, d_id, s_id, ox_id);
	memcpy(prli, &prli_tmpl, sizeof(struct fc_prli_s));

	prli->command = FC_ELS_ACC;

	prli->parampage.servparams.initiator = 1;

	prli->parampage.rspcode = FC_PRLI_ACC_XQTD;

	return sizeof(struct fc_prli_s);
}
Ejemplo n.º 7
0
u16
fc_flogi_acc_build(struct fchs_s *fchs, struct fc_logi_s *flogi, u32 s_id,
		   __be16 ox_id, wwn_t port_name, wwn_t node_name,
		   u16 pdu_size, u16 local_bb_credits)
{
	u32        d_id = 0;

	memcpy(flogi, &plogi_tmpl, sizeof(struct fc_logi_s));
	fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	flogi->els_cmd.els_code = FC_ELS_ACC;
	flogi->csp.rxsz = flogi->class3.rxsz = cpu_to_be16(pdu_size);
	flogi->port_name = port_name;
	flogi->node_name = node_name;

	flogi->csp.bbcred = cpu_to_be16(local_bb_credits);

	return sizeof(struct fc_logi_s);
}
Ejemplo n.º 8
0
u16
fc_rpsc_acc_build(struct fchs_s *fchs, struct fc_rpsc_acc_s *rpsc_acc,
		u32 d_id, u32 s_id, __be16 ox_id,
		  struct fc_rpsc_speed_info_s *oper_speed)
{
	memset(rpsc_acc, 0, sizeof(struct fc_rpsc_acc_s));

	fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	rpsc_acc->command = FC_ELS_ACC;
	rpsc_acc->num_entries = cpu_to_be16(1);

	rpsc_acc->speed_info[0].port_speed_cap =
		cpu_to_be16(oper_speed->port_speed_cap);

	rpsc_acc->speed_info[0].port_op_speed =
		cpu_to_be16(oper_speed->port_op_speed);

	return sizeof(struct fc_rpsc_acc_s);
}
Ejemplo n.º 9
0
u16
fc_prli_acc_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
		  u16 ox_id, enum bfa_port_role role)
{
	struct fc_prli_s      *prli = (struct fc_prli_s *) (pld);

	fc_els_rsp_build(fchs, d_id, s_id, ox_id);
	bfa_os_memcpy(prli, &prli_tmpl, sizeof(struct fc_prli_s));

	prli->command = FC_ELS_ACC;

	if ((role & BFA_PORT_ROLE_FCP_TM) == BFA_PORT_ROLE_FCP_TM)
		prli->parampage.servparams.target = 1;
	else
		prli->parampage.servparams.initiator = 1;

	prli->parampage.rspcode = FC_PRLI_ACC_XQTD;

	return sizeof(struct fc_prli_s);
}
Ejemplo n.º 10
0
static u16
fc_adisc_x_build(struct fchs_s *fchs, struct fc_adisc_s *adisc, u32 d_id,
		 u32 s_id, __be16 ox_id, wwn_t port_name,
		 wwn_t node_name, u8 els_code)
{
	memset(adisc, '\0', sizeof(struct fc_adisc_s));

	adisc->els_cmd.els_code = els_code;

	if (els_code == FC_ELS_ADISC)
		fc_els_req_build(fchs, d_id, s_id, ox_id);
	else
		fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	adisc->orig_HA = 0;
	adisc->orig_port_name = port_name;
	adisc->orig_node_name = node_name;
	adisc->nport_id = (s_id);

	return sizeof(struct fc_adisc_s);
}
Ejemplo n.º 11
0
static          u16
fc_plogi_x_build(struct fchs_s *fchs, void *pld, u32 d_id, u32 s_id,
		 u16 ox_id, wwn_t port_name, wwn_t node_name,
		 u16 pdu_size, u8 els_code)
{
	struct fc_logi_s     *plogi = (struct fc_logi_s *) (pld);

	bfa_os_memcpy(plogi, &plogi_tmpl, sizeof(struct fc_logi_s));

	plogi->els_cmd.els_code = els_code;
	if (els_code == FC_ELS_PLOGI)
		fc_els_req_build(fchs, d_id, s_id, ox_id);
	else
		fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	plogi->csp.rxsz = plogi->class3.rxsz = bfa_os_htons(pdu_size);

	bfa_os_memcpy(&plogi->port_name, &port_name, sizeof(wwn_t));
	bfa_os_memcpy(&plogi->node_name, &node_name, sizeof(wwn_t));

	return sizeof(struct fc_logi_s);
}
Ejemplo n.º 12
0
u16
fc_prlo_acc_build(struct fchs_s *fchs, struct fc_prlo_acc_s *prlo_acc, u32 d_id,
		  u32 s_id, __be16 ox_id, int num_pages)
{
	int             page;

	fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	memset(prlo_acc, 0, (num_pages * 16) + 4);
	prlo_acc->command = FC_ELS_ACC;
	prlo_acc->page_len = 0x10;
	prlo_acc->payload_len = cpu_to_be16((num_pages * 16) + 4);

	for (page = 0; page < num_pages; page++) {
		prlo_acc->prlo_acc_params[page].opa_valid = 0;
		prlo_acc->prlo_acc_params[page].rpa_valid = 0;
		prlo_acc->prlo_acc_params[page].fc4type_csp = FC_TYPE_FCP;
		prlo_acc->prlo_acc_params[page].orig_process_assc = 0;
		prlo_acc->prlo_acc_params[page].resp_process_assc = 0;
	}

	return be16_to_cpu(prlo_acc->payload_len);
}
Ejemplo n.º 13
0
u16
fc_tprlo_acc_build(struct fchs_s *fchs, struct fc_tprlo_acc_s *tprlo_acc,
			u32 d_id, u32 s_id, u16 ox_id,
			int num_pages)
{
	int             page;

	fc_els_rsp_build(fchs, d_id, s_id, ox_id);

	memset(tprlo_acc, 0, (num_pages * 16) + 4);
	tprlo_acc->command = FC_ELS_ACC;

	tprlo_acc->page_len = 0x10;
	tprlo_acc->payload_len = bfa_os_htons((num_pages * 16) + 4);

	for (page = 0; page < num_pages; page++) {
		tprlo_acc->tprlo_acc_params[page].opa_valid = 0;
		tprlo_acc->tprlo_acc_params[page].rpa_valid = 0;
		tprlo_acc->tprlo_acc_params[page].fc4type_csp = FC_TYPE_FCP;
		tprlo_acc->tprlo_acc_params[page].orig_process_assc = 0;
		tprlo_acc->tprlo_acc_params[page].resp_process_assc = 0;
	}
	return bfa_os_ntohs(tprlo_acc->payload_len);
}