Commit ce7242b8 authored by Krishna Gudipati's avatar Krishna Gudipati Committed by James Bottomley

[SCSI] bfa: Add support to register node symbolic name with name server

- Changes to register node symbolic name with name server on the fabric
  by sending CT commands RNN_ID and RSNN_NN.
Signed-off-by: default avatarVijaya Mohan Guvva <vmohan@brocade.com>
Signed-off-by: default avatarKrishna Gudipati <kgudipat@brocade.com>
Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
parent 9aec0249
...@@ -93,6 +93,7 @@ struct bfa_lport_cfg_s { ...@@ -93,6 +93,7 @@ struct bfa_lport_cfg_s {
wwn_t pwwn; /* port wwn */ wwn_t pwwn; /* port wwn */
wwn_t nwwn; /* node wwn */ wwn_t nwwn; /* node wwn */
struct bfa_lport_symname_s sym_name; /* vm port symbolic name */ struct bfa_lport_symname_s sym_name; /* vm port symbolic name */
struct bfa_lport_symname_s node_sym_name; /* Node symbolic name */
enum bfa_lport_role roles; /* FCS port roles */ enum bfa_lport_role roles; /* FCS port roles */
u32 rsvd; u32 rsvd;
bfa_boolean_t preboot_vp; /* vport created from PBC */ bfa_boolean_t preboot_vp; /* vport created from PBC */
...@@ -192,6 +193,18 @@ struct bfa_lport_stats_s { ...@@ -192,6 +193,18 @@ struct bfa_lport_stats_s {
u32 ns_gidft_unknown_rsp; u32 ns_gidft_unknown_rsp;
u32 ns_gidft_alloc_wait; u32 ns_gidft_alloc_wait;
u32 ns_rnnid_sent;
u32 ns_rnnid_accepts;
u32 ns_rnnid_rsp_err;
u32 ns_rnnid_rejects;
u32 ns_rnnid_alloc_wait;
u32 ns_rsnn_nn_sent;
u32 ns_rsnn_nn_accepts;
u32 ns_rsnn_nn_rsp_err;
u32 ns_rsnn_nn_rejects;
u32 ns_rsnn_nn_alloc_wait;
/* /*
* Mgmt Server stats * Mgmt Server stats
*/ */
......
...@@ -1279,6 +1279,7 @@ enum { ...@@ -1279,6 +1279,7 @@ enum {
GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */ GS_GSPN_ID = 0x0118, /* Get symbolic PN on ID */
GS_RFT_ID = 0x0217, /* Register fc4type on ID */ GS_RFT_ID = 0x0217, /* Register fc4type on ID */
GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */ GS_RSPN_ID = 0x0218, /* Register symbolic PN on ID */
GS_RSNN_NN = 0x0239, /* Register symbolic NN on NN */
GS_RPN_ID = 0x0212, /* Register port name */ GS_RPN_ID = 0x0212, /* Register port name */
GS_RNN_ID = 0x0213, /* Register node name */ GS_RNN_ID = 0x0213, /* Register node name */
GS_RCS_ID = 0x0214, /* Register class of service */ GS_RCS_ID = 0x0214, /* Register class of service */
...@@ -1356,6 +1357,15 @@ struct fcgs_rspnid_req_s { ...@@ -1356,6 +1357,15 @@ struct fcgs_rspnid_req_s {
u8 spn[256]; /* symbolic port name */ u8 spn[256]; /* symbolic port name */
}; };
/*
* RSNN_NN
*/
struct fcgs_rsnn_nn_req_s {
wwn_t node_name; /* Node name */
u8 snn_len; /* symbolic node name length */
u8 snn[256]; /* symbolic node name */
};
/* /*
* RPN_ID * RPN_ID
*/ */
......
...@@ -1251,6 +1251,27 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id, ...@@ -1251,6 +1251,27 @@ fc_rspnid_build(struct fchs_s *fchs, void *pyld, u32 s_id, u16 ox_id,
return sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s); return sizeof(struct fcgs_rspnid_req_s) + sizeof(struct ct_hdr_s);
} }
u16
fc_rsnn_nn_build(struct fchs_s *fchs, void *pyld, u32 s_id,
wwn_t node_name, u8 *name)
{
struct ct_hdr_s *cthdr = (struct ct_hdr_s *) pyld;
struct fcgs_rsnn_nn_req_s *rsnn_nn =
(struct fcgs_rsnn_nn_req_s *) (cthdr + 1);
u32 d_id = bfa_hton3b(FC_NAME_SERVER);
fc_gs_fchdr_build(fchs, d_id, s_id, 0);
fc_gs_cthdr_build(cthdr, s_id, GS_RSNN_NN);
memset(rsnn_nn, 0, sizeof(struct fcgs_rsnn_nn_req_s));
rsnn_nn->node_name = node_name;
rsnn_nn->snn_len = (u8) strlen((char *)name);
strncpy((char *)rsnn_nn->snn, (char *)name, rsnn_nn->snn_len);
return sizeof(struct fcgs_rsnn_nn_req_s) + sizeof(struct ct_hdr_s);
}
u16 u16
fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id, u8 fc4_type) fc_gid_ft_build(struct fchs_s *fchs, void *pyld, u32 s_id, u8 fc4_type)
{ {
......
...@@ -166,6 +166,8 @@ enum fc_parse_status fc_rrq_rsp_parse(struct fchs_s *buf, int len); ...@@ -166,6 +166,8 @@ enum fc_parse_status fc_rrq_rsp_parse(struct fchs_s *buf, int len);
u16 fc_rspnid_build(struct fchs_s *fchs, void *pld, u32 s_id, u16 fc_rspnid_build(struct fchs_s *fchs, void *pld, u32 s_id,
u16 ox_id, u8 *name); u16 ox_id, u8 *name);
u16 fc_rsnn_nn_build(struct fchs_s *fchs, void *pld, u32 s_id,
wwn_t node_name, u8 *name);
u16 fc_rftid_build(struct fchs_s *fchs, void *pld, u32 s_id, u16 fc_rftid_build(struct fchs_s *fchs, void *pld, u32 s_id,
u16 ox_id, enum bfa_lport_role role); u16 ox_id, enum bfa_lport_role role);
......
...@@ -165,6 +165,7 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs, ...@@ -165,6 +165,7 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
fcs->driver_info = *driver_info; fcs->driver_info = *driver_info;
bfa_fcs_fabric_psymb_init(&fcs->fabric); bfa_fcs_fabric_psymb_init(&fcs->fabric);
bfa_fcs_fabric_nsymb_init(&fcs->fabric);
} }
/* /*
...@@ -842,6 +843,44 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) ...@@ -842,6 +843,44 @@ bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
port_cfg->sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0; port_cfg->sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0;
} }
/*
* Node Symbolic Name Creation for base port and all vports
*/
void
bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric)
{
struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
char model[BFA_ADAPTER_MODEL_NAME_LEN] = {0};
struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info;
bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
/* Model name/number */
strncpy((char *)&port_cfg->node_sym_name, model,
BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
strncat((char *)&port_cfg->node_sym_name,
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
/* Driver Version */
strncat((char *)&port_cfg->node_sym_name, (char *)driver_info->version,
BFA_FCS_PORT_SYMBNAME_VERSION_SZ);
strncat((char *)&port_cfg->node_sym_name,
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
/* Host machine name */
strncat((char *)&port_cfg->node_sym_name,
(char *)driver_info->host_machine_name,
BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ);
strncat((char *)&port_cfg->node_sym_name,
BFA_FCS_PORT_SYMBNAME_SEPARATOR,
sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
/* null terminate */
port_cfg->node_sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0;
}
/* /*
* bfa lps login completion callback * bfa lps login completion callback
*/ */
......
...@@ -62,6 +62,7 @@ struct bfa_fcs_s; ...@@ -62,6 +62,7 @@ struct bfa_fcs_s;
#define N2N_LOCAL_PID 0x010000 #define N2N_LOCAL_PID 0x010000
#define N2N_REMOTE_PID 0x020000 #define N2N_REMOTE_PID 0x020000
#define BFA_FCS_RETRY_TIMEOUT 2000 #define BFA_FCS_RETRY_TIMEOUT 2000
#define BFA_FCS_MAX_NS_RETRIES 5
#define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0) #define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
...@@ -72,6 +73,8 @@ struct bfa_fcs_lport_ns_s { ...@@ -72,6 +73,8 @@ struct bfa_fcs_lport_ns_s {
struct bfa_fcs_lport_s *port; /* parent port */ struct bfa_fcs_lport_s *port; /* parent port */
struct bfa_fcxp_s *fcxp; struct bfa_fcxp_s *fcxp;
struct bfa_fcxp_wqe_s fcxp_wqe; struct bfa_fcxp_wqe_s fcxp_wqe;
u8 num_rnnid_retries;
u8 num_rsnn_nn_retries;
}; };
...@@ -265,6 +268,7 @@ struct bfa_fcs_fabric_s; ...@@ -265,6 +268,7 @@ struct bfa_fcs_fabric_s;
#define bfa_fcs_lport_get_pwwn(_lport) ((_lport)->port_cfg.pwwn) #define bfa_fcs_lport_get_pwwn(_lport) ((_lport)->port_cfg.pwwn)
#define bfa_fcs_lport_get_nwwn(_lport) ((_lport)->port_cfg.nwwn) #define bfa_fcs_lport_get_nwwn(_lport) ((_lport)->port_cfg.nwwn)
#define bfa_fcs_lport_get_psym_name(_lport) ((_lport)->port_cfg.sym_name) #define bfa_fcs_lport_get_psym_name(_lport) ((_lport)->port_cfg.sym_name)
#define bfa_fcs_lport_get_nsym_name(_lport) ((_lport)->port_cfg.node_sym_name)
#define bfa_fcs_lport_is_initiator(_lport) \ #define bfa_fcs_lport_is_initiator(_lport) \
((_lport)->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM) ((_lport)->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
#define bfa_fcs_lport_get_nrports(_lport) \ #define bfa_fcs_lport_get_nrports(_lport) \
...@@ -780,6 +784,7 @@ void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs); ...@@ -780,6 +784,7 @@ void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs);
void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric,
struct fchs_s *fchs, u16 len); struct fchs_s *fchs, u16 len);
void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric); void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric);
void bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric);
void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
wwn_t fabric_name); wwn_t fabric_name);
u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric); u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric);
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment