aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2010-03-05 22:38:07 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-03-07 02:40:13 -0500
commitca8b4327e405820966971236224db0e0724b5673 (patch)
tree26d7bc6337c6b13c25d46ae7162c724227da4c99 /drivers/scsi/bfa
parent0a4b1fc0b24fc7adbaf8413f2992ce1395991a78 (diff)
[SCSI] bfa: Modified the portstats get/clear logic
Modified the portstats get/clear logic for port physical/FCoE/QoS stats. Added more stats to FC Fixed some issues with FCoE stats collection. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_fcport.c732
-rw-r--r--drivers/scsi/bfa/bfa_port_priv.h41
-rw-r--r--drivers/scsi/bfa/bfad_attr.c5
-rw-r--r--drivers/scsi/bfa/include/bfa_svc.h24
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi.h4
-rw-r--r--drivers/scsi/bfa/include/bfi/bfi_pport.h177
-rw-r--r--drivers/scsi/bfa/include/defs/bfa_defs_pport.h128
7 files changed, 405 insertions, 706 deletions
diff --git a/drivers/scsi/bfa/bfa_fcport.c b/drivers/scsi/bfa/bfa_fcport.c
index 0da612010787..d109e651b1c5 100644
--- a/drivers/scsi/bfa/bfa_fcport.c
+++ b/drivers/scsi/bfa/bfa_fcport.c
@@ -47,16 +47,10 @@ static void bfa_fcport_callback(struct bfa_fcport_s *fcport,
47 enum bfa_pport_linkstate event); 47 enum bfa_pport_linkstate event);
48static void bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln, 48static void bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln,
49 enum bfa_pport_linkstate event); 49 enum bfa_pport_linkstate event);
50static void __bfa_cb_fcport_stats(void *cbarg, bfa_boolean_t complete);
51static void __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete); 50static void __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete);
52static void bfa_fcport_stats_timeout(void *cbarg); 51static void bfa_fcport_stats_get_timeout(void *cbarg);
53static void bfa_fcport_stats_clr_timeout(void *cbarg); 52static void bfa_fcport_stats_clr_timeout(void *cbarg);
54 53
55static void __bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete);
56static void __bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete);
57static void bfa_port_stats_timeout(void *cbarg);
58static void bfa_port_stats_clr_timeout(void *cbarg);
59
60/** 54/**
61 * bfa_pport_private 55 * bfa_pport_private
62 */ 56 */
@@ -303,7 +297,7 @@ static void
303bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport, 297bfa_fcport_sm_linkdown(struct bfa_fcport_s *fcport,
304 enum bfa_fcport_sm_event event) 298 enum bfa_fcport_sm_event event)
305{ 299{
306 struct bfi_pport_event_s *pevent = fcport->event_arg.i2hmsg.event; 300 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
307 bfa_trc(fcport->bfa, event); 301 bfa_trc(fcport->bfa, event);
308 302
309 switch (event) { 303 switch (event) {
@@ -819,8 +813,32 @@ __bfa_cb_fcport_event(void *cbarg, bfa_boolean_t complete)
819 bfa_sm_send_event(ln, BFA_FCPORT_LN_SM_NOTIFICATION); 813 bfa_sm_send_event(ln, BFA_FCPORT_LN_SM_NOTIFICATION);
820} 814}
821 815
822#define PPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_fcport_stats_u), \ 816static void
823 BFA_CACHELINE_SZ)) 817bfa_fcport_callback(struct bfa_fcport_s *fcport, enum bfa_pport_linkstate event)
818{
819 if (fcport->bfa->fcs) {
820 fcport->event_cbfn(fcport->event_cbarg, event);
821 return;
822 }
823
824 switch (event) {
825 case BFA_PPORT_LINKUP:
826 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP);
827 break;
828 case BFA_PPORT_LINKDOWN:
829 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN);
830 break;
831 default:
832 bfa_assert(0);
833 }
834}
835
836static void
837bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln, enum bfa_pport_linkstate event)
838{
839 ln->ln_event = event;
840 bfa_cb_queue(ln->fcport->bfa, &ln->ln_qe, __bfa_cb_fcport_event, ln);
841}
824 842
825#define FCPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_fcport_stats_u), \ 843#define FCPORT_STATS_DMA_SZ (BFA_ROUNDUP(sizeof(union bfa_fcport_stats_u), \
826 BFA_CACHELINE_SZ)) 844 BFA_CACHELINE_SZ))
@@ -829,8 +847,7 @@ static void
829bfa_fcport_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len, 847bfa_fcport_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *ndm_len,
830 u32 *dm_len) 848 u32 *dm_len)
831{ 849{
832 *dm_len += PPORT_STATS_DMA_SZ; 850 *dm_len += FCPORT_STATS_DMA_SZ;
833 *dm_len += PPORT_STATS_DMA_SZ;
834} 851}
835 852
836static void 853static void
@@ -852,16 +869,7 @@ bfa_fcport_mem_claim(struct bfa_fcport_s *fcport, struct bfa_meminfo_s *meminfo)
852 869
853 fcport->stats_kva = dm_kva; 870 fcport->stats_kva = dm_kva;
854 fcport->stats_pa = dm_pa; 871 fcport->stats_pa = dm_pa;
855 fcport->stats = (union bfa_pport_stats_u *)dm_kva; 872 fcport->stats = (union bfa_fcport_stats_u *)dm_kva;
856
857 dm_kva += PPORT_STATS_DMA_SZ;
858 dm_pa += PPORT_STATS_DMA_SZ;
859
860 /* FC port stats */
861
862 fcport->fcport_stats_kva = dm_kva;
863 fcport->fcport_stats_pa = dm_pa;
864 fcport->fcport_stats = (union bfa_fcport_stats_u *) dm_kva;
865 873
866 dm_kva += FCPORT_STATS_DMA_SZ; 874 dm_kva += FCPORT_STATS_DMA_SZ;
867 dm_pa += FCPORT_STATS_DMA_SZ; 875 dm_pa += FCPORT_STATS_DMA_SZ;
@@ -957,7 +965,7 @@ bfa_fcport_iocdisable(struct bfa_s *bfa)
957static void 965static void
958bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport) 966bfa_fcport_update_linkinfo(struct bfa_fcport_s *fcport)
959{ 967{
960 struct bfi_pport_event_s *pevent = fcport->event_arg.i2hmsg.event; 968 struct bfi_fcport_event_s *pevent = fcport->event_arg.i2hmsg.event;
961 969
962 fcport->speed = pevent->link_state.speed; 970 fcport->speed = pevent->link_state.speed;
963 fcport->topology = pevent->link_state.topology; 971 fcport->topology = pevent->link_state.topology;
@@ -989,7 +997,7 @@ bfa_fcport_reset_linkinfo(struct bfa_fcport_s *fcport)
989static bfa_boolean_t 997static bfa_boolean_t
990bfa_fcport_send_enable(struct bfa_fcport_s *fcport) 998bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
991{ 999{
992 struct bfi_pport_enable_req_s *m; 1000 struct bfi_fcport_enable_req_s *m;
993 1001
994 /** 1002 /**
995 * Increment message tag before queue check, so that responses to old 1003 * Increment message tag before queue check, so that responses to old
@@ -1007,15 +1015,14 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
1007 return BFA_FALSE; 1015 return BFA_FALSE;
1008 } 1016 }
1009 1017
1010 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_ENABLE_REQ, 1018 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_ENABLE_REQ,
1011 bfa_lpuid(fcport->bfa)); 1019 bfa_lpuid(fcport->bfa));
1012 m->nwwn = fcport->nwwn; 1020 m->nwwn = fcport->nwwn;
1013 m->pwwn = fcport->pwwn; 1021 m->pwwn = fcport->pwwn;
1014 m->port_cfg = fcport->cfg; 1022 m->port_cfg = fcport->cfg;
1015 m->msgtag = fcport->msgtag; 1023 m->msgtag = fcport->msgtag;
1016 m->port_cfg.maxfrsize = bfa_os_htons(fcport->cfg.maxfrsize); 1024 m->port_cfg.maxfrsize = bfa_os_htons(fcport->cfg.maxfrsize);
1017 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa); 1025 bfa_dma_be_addr_set(m->stats_dma_addr, fcport->stats_pa);
1018 bfa_dma_be_addr_set(m->fcport_stats_dma_addr, fcport->fcport_stats_pa);
1019 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo); 1026 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_lo);
1020 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi); 1027 bfa_trc(fcport->bfa, m->stats_dma_addr.a32.addr_hi);
1021 1028
@@ -1032,7 +1039,7 @@ bfa_fcport_send_enable(struct bfa_fcport_s *fcport)
1032static bfa_boolean_t 1039static bfa_boolean_t
1033bfa_fcport_send_disable(struct bfa_fcport_s *fcport) 1040bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
1034{ 1041{
1035 bfi_pport_disable_req_t *m; 1042 struct bfi_fcport_req_s *m;
1036 1043
1037 /** 1044 /**
1038 * Increment message tag before queue check, so that responses to old 1045 * Increment message tag before queue check, so that responses to old
@@ -1050,8 +1057,8 @@ bfa_fcport_send_disable(struct bfa_fcport_s *fcport)
1050 return BFA_FALSE; 1057 return BFA_FALSE;
1051 } 1058 }
1052 1059
1053 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_DISABLE_REQ, 1060 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_DISABLE_REQ,
1054 bfa_lpuid(fcport->bfa)); 1061 bfa_lpuid(fcport->bfa));
1055 m->msgtag = fcport->msgtag; 1062 m->msgtag = fcport->msgtag;
1056 1063
1057 /** 1064 /**
@@ -1077,7 +1084,7 @@ bfa_fcport_send_txcredit(void *port_cbarg)
1077{ 1084{
1078 1085
1079 struct bfa_fcport_s *fcport = port_cbarg; 1086 struct bfa_fcport_s *fcport = port_cbarg;
1080 struct bfi_pport_set_svc_params_req_s *m; 1087 struct bfi_fcport_set_svc_params_req_s *m;
1081 1088
1082 /** 1089 /**
1083 * check for room in queue to send request now 1090 * check for room in queue to send request now
@@ -1088,8 +1095,8 @@ bfa_fcport_send_txcredit(void *port_cbarg)
1088 return; 1095 return;
1089 } 1096 }
1090 1097
1091 bfi_h2i_set(m->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_SET_SVC_PARAMS_REQ, 1098 bfi_h2i_set(m->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ,
1092 bfa_lpuid(fcport->bfa)); 1099 bfa_lpuid(fcport->bfa));
1093 m->tx_bbcredit = bfa_os_htons((u16) fcport->cfg.tx_bbcredit); 1100 m->tx_bbcredit = bfa_os_htons((u16) fcport->cfg.tx_bbcredit);
1094 1101
1095 /** 1102 /**
@@ -1098,7 +1105,158 @@ bfa_fcport_send_txcredit(void *port_cbarg)
1098 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT); 1105 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1099} 1106}
1100 1107
1108static void
1109bfa_fcport_qos_stats_swap(struct bfa_qos_stats_s *d,
1110 struct bfa_qos_stats_s *s)
1111{
1112 u32 *dip = (u32 *) d;
1113 u32 *sip = (u32 *) s;
1114 int i;
1115
1116 /* Now swap the 32 bit fields */
1117 for (i = 0; i < (sizeof(struct bfa_qos_stats_s)/sizeof(u32)); ++i)
1118 dip[i] = bfa_os_ntohl(sip[i]);
1119}
1120
1121static void
1122bfa_fcport_fcoe_stats_swap(struct bfa_fcoe_stats_s *d,
1123 struct bfa_fcoe_stats_s *s)
1124{
1125 u32 *dip = (u32 *) d;
1126 u32 *sip = (u32 *) s;
1127 int i;
1128
1129 for (i = 0; i < ((sizeof(struct bfa_fcoe_stats_s))/sizeof(u32));
1130 i = i + 2) {
1131#ifdef __BIGENDIAN
1132 dip[i] = bfa_os_ntohl(sip[i]);
1133 dip[i + 1] = bfa_os_ntohl(sip[i + 1]);
1134#else
1135 dip[i] = bfa_os_ntohl(sip[i + 1]);
1136 dip[i + 1] = bfa_os_ntohl(sip[i]);
1137#endif
1138 }
1139}
1140
1141static void
1142__bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)
1143{
1144 struct bfa_fcport_s *fcport = cbarg;
1145
1146 if (complete) {
1147 if (fcport->stats_status == BFA_STATUS_OK) {
1148
1149 /* Swap FC QoS or FCoE stats */
1150 if (bfa_ioc_get_fcmode(&fcport->bfa->ioc))
1151 bfa_fcport_qos_stats_swap(
1152 &fcport->stats_ret->fcqos,
1153 &fcport->stats->fcqos);
1154 else
1155 bfa_fcport_fcoe_stats_swap(
1156 &fcport->stats_ret->fcoe,
1157 &fcport->stats->fcoe);
1158 }
1159 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1160 } else {
1161 fcport->stats_busy = BFA_FALSE;
1162 fcport->stats_status = BFA_STATUS_OK;
1163 }
1164}
1165
1166static void
1167bfa_fcport_stats_get_timeout(void *cbarg)
1168{
1169 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1170
1171 bfa_trc(fcport->bfa, fcport->stats_qfull);
1172
1173 if (fcport->stats_qfull) {
1174 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1175 fcport->stats_qfull = BFA_FALSE;
1176 }
1177
1178 fcport->stats_status = BFA_STATUS_ETIMER;
1179 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_fcport_stats_get,
1180 fcport);
1181}
1182
1183static void
1184bfa_fcport_send_stats_get(void *cbarg)
1185{
1186 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1187 struct bfi_fcport_req_s *msg;
1188
1189 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1190
1191 if (!msg) {
1192 fcport->stats_qfull = BFA_TRUE;
1193 bfa_reqq_winit(&fcport->stats_reqq_wait,
1194 bfa_fcport_send_stats_get, fcport);
1195 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1196 &fcport->stats_reqq_wait);
1197 return;
1198 }
1199 fcport->stats_qfull = BFA_FALSE;
1200
1201 bfa_os_memset(msg, 0, sizeof(struct bfi_fcport_req_s));
1202 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_GET_REQ,
1203 bfa_lpuid(fcport->bfa));
1204 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1205}
1206
1207static void
1208__bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
1209{
1210 struct bfa_fcport_s *fcport = cbarg;
1211
1212 if (complete) {
1213 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1214 } else {
1215 fcport->stats_busy = BFA_FALSE;
1216 fcport->stats_status = BFA_STATUS_OK;
1217 }
1218}
1219
1220static void
1221bfa_fcport_stats_clr_timeout(void *cbarg)
1222{
1223 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1224
1225 bfa_trc(fcport->bfa, fcport->stats_qfull);
1226
1227 if (fcport->stats_qfull) {
1228 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1229 fcport->stats_qfull = BFA_FALSE;
1230 }
1231
1232 fcport->stats_status = BFA_STATUS_ETIMER;
1233 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1234 __bfa_cb_fcport_stats_clr, fcport);
1235}
1236
1237static void
1238bfa_fcport_send_stats_clear(void *cbarg)
1239{
1240 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1241 struct bfi_fcport_req_s *msg;
1101 1242
1243 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1244
1245 if (!msg) {
1246 fcport->stats_qfull = BFA_TRUE;
1247 bfa_reqq_winit(&fcport->stats_reqq_wait,
1248 bfa_fcport_send_stats_clear, fcport);
1249 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1250 &fcport->stats_reqq_wait);
1251 return;
1252 }
1253 fcport->stats_qfull = BFA_FALSE;
1254
1255 bfa_os_memset(msg, 0, sizeof(struct bfi_fcport_req_s));
1256 bfi_h2i_set(msg->mh, BFI_MC_FCPORT, BFI_FCPORT_H2I_STATS_CLEAR_REQ,
1257 bfa_lpuid(fcport->bfa));
1258 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1259}
1102 1260
1103/** 1261/**
1104 * bfa_pport_public 1262 * bfa_pport_public
@@ -1111,23 +1269,23 @@ void
1111bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg) 1269bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
1112{ 1270{
1113 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 1271 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1114 union bfi_pport_i2h_msg_u i2hmsg; 1272 union bfi_fcport_i2h_msg_u i2hmsg;
1115 1273
1116 i2hmsg.msg = msg; 1274 i2hmsg.msg = msg;
1117 fcport->event_arg.i2hmsg = i2hmsg; 1275 fcport->event_arg.i2hmsg = i2hmsg;
1118 1276
1119 switch (msg->mhdr.msg_id) { 1277 switch (msg->mhdr.msg_id) {
1120 case BFI_PPORT_I2H_ENABLE_RSP: 1278 case BFI_FCPORT_I2H_ENABLE_RSP:
1121 if (fcport->msgtag == i2hmsg.enable_rsp->msgtag) 1279 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag)
1122 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); 1280 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
1123 break; 1281 break;
1124 1282
1125 case BFI_PPORT_I2H_DISABLE_RSP: 1283 case BFI_FCPORT_I2H_DISABLE_RSP:
1126 if (fcport->msgtag == i2hmsg.enable_rsp->msgtag) 1284 if (fcport->msgtag == i2hmsg.penable_rsp->msgtag)
1127 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); 1285 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP);
1128 break; 1286 break;
1129 1287
1130 case BFI_PPORT_I2H_EVENT: 1288 case BFI_FCPORT_I2H_EVENT:
1131 switch (i2hmsg.event->link_state.linkstate) { 1289 switch (i2hmsg.event->link_state.linkstate) {
1132 case BFA_PPORT_LINKUP: 1290 case BFA_PPORT_LINKUP:
1133 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP); 1291 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP);
@@ -1141,58 +1299,27 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
1141 } 1299 }
1142 break; 1300 break;
1143 1301
1144 case BFI_PPORT_I2H_GET_STATS_RSP: 1302 case BFI_FCPORT_I2H_STATS_GET_RSP:
1145 case BFI_PPORT_I2H_GET_QOS_STATS_RSP:
1146 /*
1147 * check for timer pop before processing the rsp
1148 */
1149 if (fcport->stats_busy == BFA_FALSE
1150 || fcport->stats_status == BFA_STATUS_ETIMER)
1151 break;
1152
1153 bfa_timer_stop(&fcport->timer);
1154 fcport->stats_status = i2hmsg.getstats_rsp->status;
1155 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_port_stats,
1156 fcport);
1157 break;
1158 case BFI_PPORT_I2H_CLEAR_STATS_RSP:
1159 case BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP:
1160 /*
1161 * check for timer pop before processing the rsp
1162 */
1163 if (fcport->stats_busy == BFA_FALSE
1164 || fcport->stats_status == BFA_STATUS_ETIMER)
1165 break;
1166
1167 bfa_timer_stop(&fcport->timer);
1168 fcport->stats_status = BFA_STATUS_OK;
1169 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1170 __bfa_cb_port_stats_clr, fcport);
1171 break;
1172
1173 case BFI_FCPORT_I2H_GET_STATS_RSP:
1174 /* 1303 /*
1175 * check for timer pop before processing the rsp 1304 * check for timer pop before processing the rsp
1176 */ 1305 */
1177 if (fcport->stats_busy == BFA_FALSE || 1306 if (fcport->stats_busy == BFA_FALSE ||
1178 fcport->stats_status == BFA_STATUS_ETIMER) { 1307 fcport->stats_status == BFA_STATUS_ETIMER)
1179 break; 1308 break;
1180 }
1181 1309
1182 bfa_timer_stop(&fcport->timer); 1310 bfa_timer_stop(&fcport->timer);
1183 fcport->stats_status = i2hmsg.getstats_rsp->status; 1311 fcport->stats_status = i2hmsg.pstatsget_rsp->status;
1184 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, 1312 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1185 __bfa_cb_fcport_stats, fcport); 1313 __bfa_cb_fcport_stats_get, fcport);
1186 break; 1314 break;
1187 1315
1188 case BFI_FCPORT_I2H_CLEAR_STATS_RSP: 1316 case BFI_FCPORT_I2H_STATS_CLEAR_RSP:
1189 /* 1317 /*
1190 * check for timer pop before processing the rsp 1318 * check for timer pop before processing the rsp
1191 */ 1319 */
1192 if (fcport->stats_busy == BFA_FALSE || 1320 if (fcport->stats_busy == BFA_FALSE ||
1193 fcport->stats_status == BFA_STATUS_ETIMER) { 1321 fcport->stats_status == BFA_STATUS_ETIMER)
1194 break; 1322 break;
1195 }
1196 1323
1197 bfa_timer_stop(&fcport->timer); 1324 bfa_timer_stop(&fcport->timer);
1198 fcport->stats_status = BFA_STATUS_OK; 1325 fcport->stats_status = BFA_STATUS_OK;
@@ -1206,8 +1333,6 @@ bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg)
1206 } 1333 }
1207} 1334}
1208 1335
1209
1210
1211/** 1336/**
1212 * bfa_pport_api 1337 * bfa_pport_api
1213 */ 1338 */
@@ -1472,329 +1597,13 @@ bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr)
1472 attr->port_state = BFA_PPORT_ST_FWMISMATCH; 1597 attr->port_state = BFA_PPORT_ST_FWMISMATCH;
1473} 1598}
1474 1599
1475static void 1600#define BFA_FCPORT_STATS_TOV 1000
1476bfa_port_stats_query(void *cbarg)
1477{
1478 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1479 bfi_pport_get_stats_req_t *msg;
1480
1481 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1482
1483 if (!msg) {
1484 fcport->stats_qfull = BFA_TRUE;
1485 bfa_reqq_winit(&fcport->stats_reqq_wait, bfa_port_stats_query,
1486 fcport);
1487 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1488 &fcport->stats_reqq_wait);
1489 return;
1490 }
1491 fcport->stats_qfull = BFA_FALSE;
1492
1493 bfa_os_memset(msg, 0, sizeof(bfi_pport_get_stats_req_t));
1494 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_GET_STATS_REQ,
1495 bfa_lpuid(fcport->bfa));
1496 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1497}
1498
1499static void
1500bfa_port_stats_clear(void *cbarg)
1501{
1502 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1503 bfi_pport_clear_stats_req_t *msg;
1504
1505 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1506
1507 if (!msg) {
1508 fcport->stats_qfull = BFA_TRUE;
1509 bfa_reqq_winit(&fcport->stats_reqq_wait, bfa_port_stats_clear,
1510 fcport);
1511 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1512 &fcport->stats_reqq_wait);
1513 return;
1514 }
1515 fcport->stats_qfull = BFA_FALSE;
1516
1517 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_stats_req_t));
1518 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_STATS_REQ,
1519 bfa_lpuid(fcport->bfa));
1520 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1521}
1522
1523static void
1524bfa_fcport_stats_query(void *cbarg)
1525{
1526 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1527 bfi_pport_get_stats_req_t *msg;
1528
1529 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1530
1531 if (!msg) {
1532 fcport->stats_qfull = BFA_TRUE;
1533 bfa_reqq_winit(&fcport->stats_reqq_wait,
1534 bfa_fcport_stats_query, fcport);
1535 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1536 &fcport->stats_reqq_wait);
1537 return;
1538 }
1539 fcport->stats_qfull = BFA_FALSE;
1540
1541 bfa_os_memset(msg, 0, sizeof(bfi_pport_get_stats_req_t));
1542 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_FCPORT_H2I_GET_STATS_REQ,
1543 bfa_lpuid(fcport->bfa));
1544 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1545}
1546
1547static void
1548bfa_fcport_stats_clear(void *cbarg)
1549{
1550 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1551 bfi_pport_clear_stats_req_t *msg;
1552
1553 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1554
1555 if (!msg) {
1556 fcport->stats_qfull = BFA_TRUE;
1557 bfa_reqq_winit(&fcport->stats_reqq_wait,
1558 bfa_fcport_stats_clear, fcport);
1559 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1560 &fcport->stats_reqq_wait);
1561 return;
1562 }
1563 fcport->stats_qfull = BFA_FALSE;
1564
1565 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_stats_req_t));
1566 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_FCPORT_H2I_CLEAR_STATS_REQ,
1567 bfa_lpuid(fcport->bfa));
1568 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1569}
1570
1571static void
1572bfa_port_qos_stats_clear(void *cbarg)
1573{
1574 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1575 bfi_pport_clear_qos_stats_req_t *msg;
1576
1577 msg = bfa_reqq_next(fcport->bfa, BFA_REQQ_PORT);
1578
1579 if (!msg) {
1580 fcport->stats_qfull = BFA_TRUE;
1581 bfa_reqq_winit(&fcport->stats_reqq_wait,
1582 bfa_port_qos_stats_clear, fcport);
1583 bfa_reqq_wait(fcport->bfa, BFA_REQQ_PORT,
1584 &fcport->stats_reqq_wait);
1585 return;
1586 }
1587 fcport->stats_qfull = BFA_FALSE;
1588
1589 bfa_os_memset(msg, 0, sizeof(bfi_pport_clear_qos_stats_req_t));
1590 bfi_h2i_set(msg->mh, BFI_MC_FC_PORT, BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ,
1591 bfa_lpuid(fcport->bfa));
1592 bfa_reqq_produce(fcport->bfa, BFA_REQQ_PORT);
1593}
1594
1595static void
1596bfa_fcport_stats_swap(union bfa_fcport_stats_u *d, union bfa_fcport_stats_u *s)
1597{
1598 u32 *dip = (u32 *) d;
1599 u32 *sip = (u32 *) s;
1600 int i;
1601
1602 /* Do 64 bit fields swap first */
1603 for (i = 0; i < ((sizeof(union bfa_fcport_stats_u) -
1604 sizeof(struct bfa_qos_stats_s))/sizeof(u32)); i = i + 2) {
1605#ifdef __BIGENDIAN
1606 dip[i] = bfa_os_ntohl(sip[i]);
1607 dip[i + 1] = bfa_os_ntohl(sip[i + 1]);
1608#else
1609 dip[i] = bfa_os_ntohl(sip[i + 1]);
1610 dip[i + 1] = bfa_os_ntohl(sip[i]);
1611#endif
1612 }
1613
1614 /* Now swap the 32 bit fields */
1615 for (; i < (sizeof(union bfa_fcport_stats_u)/sizeof(u32)); ++i)
1616 dip[i] = bfa_os_ntohl(sip[i]);
1617}
1618
1619static void
1620bfa_port_stats_swap(union bfa_pport_stats_u *d, union bfa_pport_stats_u *s)
1621{
1622 u32 *dip = (u32 *) d;
1623 u32 *sip = (u32 *) s;
1624 int i;
1625
1626 /* Do 64 bit fields swap first */
1627 for (i = 0; i < (sizeof(union bfa_pport_stats_u) / sizeof(u32));
1628 i = i + 2) {
1629#ifdef __BIGENDIAN
1630 dip[i] = bfa_os_ntohl(sip[i]);
1631 dip[i + 1] = bfa_os_ntohl(sip[i + 1]);
1632#else
1633 dip[i] = bfa_os_ntohl(sip[i + 1]);
1634 dip[i + 1] = bfa_os_ntohl(sip[i]);
1635#endif
1636 }
1637}
1638
1639static void
1640__bfa_cb_port_stats_clr(void *cbarg, bfa_boolean_t complete)
1641{
1642 struct bfa_fcport_s *fcport = cbarg;
1643
1644 if (complete) {
1645 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1646 } else {
1647 fcport->stats_busy = BFA_FALSE;
1648 fcport->stats_status = BFA_STATUS_OK;
1649 }
1650}
1651
1652static void
1653__bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
1654{
1655 struct bfa_fcport_s *fcport = cbarg;
1656
1657 if (complete) {
1658 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1659 } else {
1660 fcport->stats_busy = BFA_FALSE;
1661 fcport->stats_status = BFA_STATUS_OK;
1662 }
1663}
1664
1665static void
1666bfa_port_stats_clr_timeout(void *cbarg)
1667{
1668 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1669
1670 bfa_trc(fcport->bfa, fcport->stats_qfull);
1671
1672 if (fcport->stats_qfull) {
1673 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1674 fcport->stats_qfull = BFA_FALSE;
1675 }
1676
1677 fcport->stats_status = BFA_STATUS_ETIMER;
1678 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe,
1679 __bfa_cb_port_stats_clr, fcport);
1680}
1681
1682static void
1683bfa_fcport_callback(struct bfa_fcport_s *fcport, enum bfa_pport_linkstate event)
1684{
1685 if (fcport->bfa->fcs) {
1686 fcport->event_cbfn(fcport->event_cbarg, event);
1687 return;
1688 }
1689
1690 switch (event) {
1691 case BFA_PPORT_LINKUP:
1692 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKUP);
1693 break;
1694 case BFA_PPORT_LINKDOWN:
1695 bfa_sm_send_event(&fcport->ln, BFA_FCPORT_LN_SM_LINKDOWN);
1696 break;
1697 default:
1698 bfa_assert(0);
1699 }
1700}
1701
1702static void
1703bfa_fcport_queue_cb(struct bfa_fcport_ln_s *ln, enum bfa_pport_linkstate event)
1704{
1705 ln->ln_event = event;
1706 bfa_cb_queue(ln->fcport->bfa, &ln->ln_qe, __bfa_cb_fcport_event, ln);
1707}
1708
1709static void
1710bfa_fcport_stats_clr_timeout(void *cbarg)
1711{
1712 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1713
1714 bfa_trc(fcport->bfa, fcport->stats_qfull);
1715
1716 if (fcport->stats_qfull) {
1717 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1718 fcport->stats_qfull = BFA_FALSE;
1719 }
1720
1721 fcport->stats_status = BFA_STATUS_ETIMER;
1722 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_fcport_stats_clr,
1723 fcport);
1724}
1725
1726static void
1727__bfa_cb_port_stats(void *cbarg, bfa_boolean_t complete)
1728{
1729 struct bfa_fcport_s *fcport = cbarg;
1730
1731 if (complete) {
1732 if (fcport->stats_status == BFA_STATUS_OK)
1733 bfa_port_stats_swap(fcport->stats_ret, fcport->stats);
1734 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1735 } else {
1736 fcport->stats_busy = BFA_FALSE;
1737 fcport->stats_status = BFA_STATUS_OK;
1738 }
1739}
1740
1741static void
1742bfa_port_stats_timeout(void *cbarg)
1743{
1744 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *)cbarg;
1745
1746 bfa_trc(fcport->bfa, fcport->stats_qfull);
1747
1748 if (fcport->stats_qfull) {
1749 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1750 fcport->stats_qfull = BFA_FALSE;
1751 }
1752
1753 fcport->stats_status = BFA_STATUS_ETIMER;
1754 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_port_stats, fcport);
1755}
1756
1757static void
1758__bfa_cb_fcport_stats(void *cbarg, bfa_boolean_t complete)
1759{
1760 struct bfa_fcport_s *fcport = cbarg;
1761
1762 if (complete) {
1763 if (fcport->stats_status == BFA_STATUS_OK) {
1764 bfa_fcport_stats_swap(fcport->fcport_stats_ret,
1765 fcport->fcport_stats);
1766 }
1767 fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
1768 } else {
1769 fcport->stats_busy = BFA_FALSE;
1770 fcport->stats_status = BFA_STATUS_OK;
1771 }
1772}
1773
1774static void
1775bfa_fcport_stats_timeout(void *cbarg)
1776{
1777 struct bfa_fcport_s *fcport = (struct bfa_fcport_s *) cbarg;
1778
1779 bfa_trc(fcport->bfa, fcport->stats_qfull);
1780
1781 if (fcport->stats_qfull) {
1782 bfa_reqq_wcancel(&fcport->stats_reqq_wait);
1783 fcport->stats_qfull = BFA_FALSE;
1784 }
1785
1786 fcport->stats_status = BFA_STATUS_ETIMER;
1787 bfa_cb_queue(fcport->bfa, &fcport->hcb_qe, __bfa_cb_fcport_stats,
1788 fcport);
1789}
1790
1791#define BFA_PORT_STATS_TOV 1000
1792 1601
1793/** 1602/**
1794 * Fetch port attributes. 1603 * Fetch port attributes (FCQoS or FCoE).
1795 */ 1604 */
1796bfa_status_t 1605bfa_status_t
1797bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats, 1606bfa_fcport_get_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats,
1798 bfa_cb_pport_t cbfn, void *cbarg) 1607 bfa_cb_pport_t cbfn, void *cbarg)
1799{ 1608{
1800 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 1609 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
@@ -1804,20 +1613,23 @@ bfa_pport_get_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1804 return BFA_STATUS_DEVBUSY; 1613 return BFA_STATUS_DEVBUSY;
1805 } 1614 }
1806 1615
1807 fcport->stats_busy = BFA_TRUE; 1616 fcport->stats_busy = BFA_TRUE;
1808 fcport->stats_ret = stats; 1617 fcport->stats_ret = stats;
1809 fcport->stats_cbfn = cbfn; 1618 fcport->stats_cbfn = cbfn;
1810 fcport->stats_cbarg = cbarg; 1619 fcport->stats_cbarg = cbarg;
1811 1620
1812 bfa_port_stats_query(fcport); 1621 bfa_fcport_send_stats_get(fcport);
1813 1622
1814 bfa_timer_start(bfa, &fcport->timer, bfa_port_stats_timeout, fcport, 1623 bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_get_timeout,
1815 BFA_PORT_STATS_TOV); 1624 fcport, BFA_FCPORT_STATS_TOV);
1816 return BFA_STATUS_OK; 1625 return BFA_STATUS_OK;
1817} 1626}
1818 1627
1628/**
1629 * Reset port statistics (FCQoS or FCoE).
1630 */
1819bfa_status_t 1631bfa_status_t
1820bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) 1632bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1821{ 1633{
1822 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 1634 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1823 1635
@@ -1830,65 +1642,61 @@ bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1830 fcport->stats_cbfn = cbfn; 1642 fcport->stats_cbfn = cbfn;
1831 fcport->stats_cbarg = cbarg; 1643 fcport->stats_cbarg = cbarg;
1832 1644
1833 bfa_port_stats_clear(fcport); 1645 bfa_fcport_send_stats_clear(fcport);
1834 1646
1835 bfa_timer_start(bfa, &fcport->timer, bfa_port_stats_clr_timeout, 1647 bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_clr_timeout,
1836 fcport, BFA_PORT_STATS_TOV); 1648 fcport, BFA_FCPORT_STATS_TOV);
1837 return BFA_STATUS_OK; 1649 return BFA_STATUS_OK;
1838} 1650}
1839 1651
1840/** 1652/**
1841 * @brief 1653 * Fetch FCQoS port statistics
1842 * Fetch FCPort statistics.
1843 * Todo TBD: sharing timer,stats_busy and other resources of fcport for now -
1844 * ideally we want to create seperate ones for fcport once bfa_fcport_s is
1845 * decided.
1846 *
1847 */ 1654 */
1848bfa_status_t 1655bfa_status_t
1849bfa_fcport_get_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats, 1656bfa_fcport_get_qos_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats,
1850 bfa_cb_pport_t cbfn, void *cbarg) 1657 bfa_cb_pport_t cbfn, void *cbarg)
1851{ 1658{
1852 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 1659 /* Meaningful only for FC mode */
1853 1660 bfa_assert(bfa_ioc_get_fcmode(&bfa->ioc));
1854 if (fcport->stats_busy) {
1855 bfa_trc(bfa, fcport->stats_busy);
1856 return BFA_STATUS_DEVBUSY;
1857 }
1858
1859 fcport->stats_busy = BFA_TRUE;
1860 fcport->fcport_stats_ret = stats;
1861 fcport->stats_cbfn = cbfn;
1862 fcport->stats_cbarg = cbarg;
1863 1661
1864 bfa_fcport_stats_query(fcport); 1662 return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg);
1865
1866 bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_timeout, fcport,
1867 BFA_PORT_STATS_TOV);
1868
1869 return BFA_STATUS_OK;
1870} 1663}
1871 1664
1665/**
1666 * Reset FCoE port statistics
1667 */
1872bfa_status_t 1668bfa_status_t
1873bfa_fcport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg) 1669bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1874{ 1670{
1875 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 1671 /* Meaningful only for FC mode */
1672 bfa_assert(bfa_ioc_get_fcmode(&bfa->ioc));
1876 1673
1877 if (fcport->stats_busy) { 1674 return bfa_fcport_clear_stats(bfa, cbfn, cbarg);
1878 bfa_trc(bfa, fcport->stats_busy); 1675}
1879 return BFA_STATUS_DEVBUSY;
1880 }
1881 1676
1882 fcport->stats_busy = BFA_TRUE; 1677/**
1883 fcport->stats_cbfn = cbfn; 1678 * Fetch FCQoS port statistics
1884 fcport->stats_cbarg = cbarg; 1679 */
1680bfa_status_t
1681bfa_fcport_get_fcoe_stats(struct bfa_s *bfa, union bfa_fcport_stats_u *stats,
1682 bfa_cb_pport_t cbfn, void *cbarg)
1683{
1684 /* Meaningful only for FCoE mode */
1685 bfa_assert(!bfa_ioc_get_fcmode(&bfa->ioc));
1885 1686
1886 bfa_fcport_stats_clear(fcport); 1687 return bfa_fcport_get_stats(bfa, stats, cbfn, cbarg);
1688}
1887 1689
1888 bfa_timer_start(bfa, &fcport->timer, bfa_fcport_stats_clr_timeout, 1690/**
1889 fcport, BFA_PORT_STATS_TOV); 1691 * Reset FCoE port statistics
1692 */
1693bfa_status_t
1694bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1695{
1696 /* Meaningful only for FCoE mode */
1697 bfa_assert(!bfa_ioc_get_fcmode(&bfa->ioc));
1890 1698
1891 return BFA_STATUS_OK; 1699 return bfa_fcport_clear_stats(bfa, cbfn, cbarg);
1892} 1700}
1893 1701
1894bfa_status_t 1702bfa_status_t
@@ -1946,40 +1754,6 @@ bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
1946} 1754}
1947 1755
1948/** 1756/**
1949 * Fetch QoS Stats.
1950 */
1951bfa_status_t
1952bfa_fcport_get_qos_stats(struct bfa_s *bfa, union bfa_pport_stats_u *stats,
1953 bfa_cb_pport_t cbfn, void *cbarg)
1954{
1955 /*
1956 * QoS stats is embedded in port stats
1957 */
1958 return bfa_pport_get_stats(bfa, stats, cbfn, cbarg);
1959}
1960
1961bfa_status_t
1962bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, void *cbarg)
1963{
1964 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
1965
1966 if (fcport->stats_busy) {
1967 bfa_trc(bfa, fcport->stats_busy);
1968 return BFA_STATUS_DEVBUSY;
1969 }
1970
1971 fcport->stats_busy = BFA_TRUE;
1972 fcport->stats_cbfn = cbfn;
1973 fcport->stats_cbarg = cbarg;
1974
1975 bfa_port_qos_stats_clear(fcport);
1976
1977 bfa_timer_start(bfa, &fcport->timer, bfa_port_stats_clr_timeout,
1978 fcport, BFA_PORT_STATS_TOV);
1979 return BFA_STATUS_OK;
1980}
1981
1982/**
1983 * Fetch port attributes. 1757 * Fetch port attributes.
1984 */ 1758 */
1985bfa_status_t 1759bfa_status_t
diff --git a/drivers/scsi/bfa/bfa_port_priv.h b/drivers/scsi/bfa/bfa_port_priv.h
index 6d315ffb1e99..40e256ec67ff 100644
--- a/drivers/scsi/bfa/bfa_port_priv.h
+++ b/drivers/scsi/bfa/bfa_port_priv.h
@@ -46,6 +46,8 @@ struct bfa_fcport_s {
46 enum bfa_pport_topology topology; /* current topology */ 46 enum bfa_pport_topology topology; /* current topology */
47 u8 myalpa; /* my ALPA in LOOP topology */ 47 u8 myalpa; /* my ALPA in LOOP topology */
48 u8 rsvd[3]; 48 u8 rsvd[3];
49 u32 mypid:24;
50 u32 rsvd_b:8;
49 struct bfa_pport_cfg_s cfg; /* current port configuration */ 51 struct bfa_pport_cfg_s cfg; /* current port configuration */
50 struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ 52 struct bfa_qos_attr_s qos_attr; /* QoS Attributes */
51 struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */ 53 struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */
@@ -59,40 +61,25 @@ struct bfa_fcport_s {
59 void (*event_cbfn) (void *cbarg, 61 void (*event_cbfn) (void *cbarg,
60 bfa_pport_event_t event); 62 bfa_pport_event_t event);
61 union { 63 union {
62 union bfi_pport_i2h_msg_u i2hmsg; 64 union bfi_fcport_i2h_msg_u i2hmsg;
63 } event_arg; 65 } event_arg;
64 void *bfad; /* BFA driver handle */ 66 void *bfad; /* BFA driver handle */
65 struct bfa_fcport_ln_s ln; /* Link Notification */ 67 struct bfa_fcport_ln_s ln; /* Link Notification */
66 struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */ 68 struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */
69 struct bfa_timer_s timer; /* timer */
67 u32 msgtag; /* fimrware msg tag for reply */ 70 u32 msgtag; /* fimrware msg tag for reply */
68 u8 *stats_kva; 71 u8 *stats_kva;
69 u64 stats_pa; 72 u64 stats_pa;
70 union bfa_pport_stats_u *stats; /* pport stats */ 73 union bfa_fcport_stats_u *stats;
71 u32 mypid:24; 74 union bfa_fcport_stats_u *stats_ret; /* driver stats location */
72 u32 rsvd_b:8; 75 bfa_status_t stats_status; /* stats/statsclr status */
73 struct bfa_timer_s timer; /* timer */ 76 bfa_boolean_t stats_busy; /* outstanding stats/statsclr */
74 union bfa_pport_stats_u *stats_ret; 77 bfa_boolean_t stats_qfull;
75 /* driver stats location */ 78 bfa_cb_pport_t stats_cbfn; /* driver callback function */
76 bfa_status_t stats_status; 79 void *stats_cbarg; /* *!< user callback arg */
77 /* stats/statsclr status */ 80 bfa_boolean_t diag_busy; /* diag busy status */
78 bfa_boolean_t stats_busy; 81 bfa_boolean_t beacon; /* port beacon status */
79 /* outstanding stats/statsclr */ 82 bfa_boolean_t link_e2e_beacon; /* link beacon status */
80 bfa_boolean_t stats_qfull;
81 bfa_boolean_t diag_busy;
82 /* diag busy status */
83 bfa_boolean_t beacon;
84 /* port beacon status */
85 bfa_boolean_t link_e2e_beacon;
86 /* link beacon status */
87 bfa_cb_pport_t stats_cbfn;
88 /* driver callback function */
89 void *stats_cbarg;
90 /* *!< user callback arg */
91 /* FCport stats */
92 u8 *fcport_stats_kva;
93 u64 fcport_stats_pa;
94 union bfa_fcport_stats_u *fcport_stats;
95 union bfa_fcport_stats_u *fcport_stats_ret;
96}; 83};
97 84
98#define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) 85#define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport)
diff --git a/drivers/scsi/bfa/bfad_attr.c b/drivers/scsi/bfa/bfad_attr.c
index dd5cb20d4b37..d97f69191838 100644
--- a/drivers/scsi/bfa/bfad_attr.c
+++ b/drivers/scsi/bfa/bfad_attr.c
@@ -288,7 +288,7 @@ bfad_im_get_stats(struct Scsi_Host *shost)
288 init_completion(&fcomp.comp); 288 init_completion(&fcomp.comp);
289 spin_lock_irqsave(&bfad->bfad_lock, flags); 289 spin_lock_irqsave(&bfad->bfad_lock, flags);
290 memset(hstats, 0, sizeof(struct fc_host_statistics)); 290 memset(hstats, 0, sizeof(struct fc_host_statistics));
291 rc = bfa_pport_get_stats(&bfad->bfa, 291 rc = bfa_port_get_stats(BFA_FCPORT(&bfad->bfa),
292 (union bfa_pport_stats_u *) hstats, 292 (union bfa_pport_stats_u *) hstats,
293 bfad_hcb_comp, &fcomp); 293 bfad_hcb_comp, &fcomp);
294 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 294 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
@@ -315,7 +315,8 @@ bfad_im_reset_stats(struct Scsi_Host *shost)
315 315
316 init_completion(&fcomp.comp); 316 init_completion(&fcomp.comp);
317 spin_lock_irqsave(&bfad->bfad_lock, flags); 317 spin_lock_irqsave(&bfad->bfad_lock, flags);
318 rc = bfa_pport_clear_stats(&bfad->bfa, bfad_hcb_comp, &fcomp); 318 rc = bfa_port_clear_stats(BFA_FCPORT(&bfad->bfa), bfad_hcb_comp,
319 &fcomp);
319 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 320 spin_unlock_irqrestore(&bfad->bfad_lock, flags);
320 321
321 if (rc != BFA_STATUS_OK) 322 if (rc != BFA_STATUS_OK)
diff --git a/drivers/scsi/bfa/include/bfa_svc.h b/drivers/scsi/bfa/include/bfa_svc.h
index f2c30858900b..1349b99a3c6d 100644
--- a/drivers/scsi/bfa/include/bfa_svc.h
+++ b/drivers/scsi/bfa/include/bfa_svc.h
@@ -36,7 +36,7 @@ struct bfa_fcxp_s;
36struct bfa_rport_info_s { 36struct bfa_rport_info_s {
37 u16 max_frmsz; /* max rcv pdu size */ 37 u16 max_frmsz; /* max rcv pdu size */
38 u32 pid:24, /* remote port ID */ 38 u32 pid:24, /* remote port ID */
39 lp_tag:8; 39 lp_tag:8; /* tag */
40 u32 local_pid:24, /* local port ID */ 40 u32 local_pid:24, /* local port ID */
41 cisc:8; /* CIRO supported */ 41 cisc:8; /* CIRO supported */
42 u8 fc_class; /* supported FC classes. enum fc_cos */ 42 u8 fc_class; /* supported FC classes. enum fc_cos */
@@ -55,7 +55,7 @@ struct bfa_rport_s {
55 void *rport_drv; /* fcs/driver rport object */ 55 void *rport_drv; /* fcs/driver rport object */
56 u16 fw_handle; /* firmware rport handle */ 56 u16 fw_handle; /* firmware rport handle */
57 u16 rport_tag; /* BFA rport tag */ 57 u16 rport_tag; /* BFA rport tag */
58 struct bfa_rport_info_s rport_info; /* rport info from *fcs/driver */ 58 struct bfa_rport_info_s rport_info; /* rport info from fcs/driver */
59 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ 59 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
60 struct bfa_cb_qe_s hcb_qe; /* BFA callback qelem */ 60 struct bfa_cb_qe_s hcb_qe; /* BFA callback qelem */
61 struct bfa_rport_hal_stats_s stats; /* BFA rport statistics */ 61 struct bfa_rport_hal_stats_s stats; /* BFA rport statistics */
@@ -102,7 +102,7 @@ struct bfa_uf_buf_s {
102struct bfa_uf_s { 102struct bfa_uf_s {
103 struct list_head qe; /* queue element */ 103 struct list_head qe; /* queue element */
104 struct bfa_s *bfa; /* bfa instance */ 104 struct bfa_s *bfa; /* bfa instance */
105 u16 uf_tag; /* identifying tag f/w messages */ 105 u16 uf_tag; /* identifying tag fw msgs */
106 u16 vf_id; 106 u16 vf_id;
107 u16 src_rport_handle; 107 u16 src_rport_handle;
108 u16 rsvd; 108 u16 rsvd;
@@ -128,7 +128,7 @@ struct bfa_lps_s {
128 u8 reqq; /* lport request queue */ 128 u8 reqq; /* lport request queue */
129 u8 alpa; /* ALPA for loop topologies */ 129 u8 alpa; /* ALPA for loop topologies */
130 u32 lp_pid; /* lport port ID */ 130 u32 lp_pid; /* lport port ID */
131 bfa_boolean_t fdisc; /* send FDISC instead of FLOGI*/ 131 bfa_boolean_t fdisc; /* send FDISC instead of FLOGI */
132 bfa_boolean_t auth_en; /* enable authentication */ 132 bfa_boolean_t auth_en; /* enable authentication */
133 bfa_boolean_t auth_req; /* authentication required */ 133 bfa_boolean_t auth_req; /* authentication required */
134 bfa_boolean_t npiv_en; /* NPIV is allowed by peer */ 134 bfa_boolean_t npiv_en; /* NPIV is allowed by peer */
@@ -178,11 +178,6 @@ bfa_status_t bfa_fcport_trunk_disable(struct bfa_s *bfa);
178bfa_boolean_t bfa_fcport_trunk_query(struct bfa_s *bfa, u32 *bitmap); 178bfa_boolean_t bfa_fcport_trunk_query(struct bfa_s *bfa, u32 *bitmap);
179void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr); 179void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_pport_attr_s *attr);
180wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node); 180wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node);
181bfa_status_t bfa_pport_get_stats(struct bfa_s *bfa,
182 union bfa_pport_stats_u *stats,
183 bfa_cb_pport_t cbfn, void *cbarg);
184bfa_status_t bfa_pport_clear_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn,
185 void *cbarg);
186void bfa_fcport_event_register(struct bfa_s *bfa, 181void bfa_fcport_event_register(struct bfa_s *bfa,
187 void (*event_cbfn) (void *cbarg, 182 void (*event_cbfn) (void *cbarg,
188 bfa_pport_event_t event), void *event_cbarg); 183 bfa_pport_event_t event), void *event_cbarg);
@@ -198,14 +193,21 @@ void bfa_fcport_busy(struct bfa_s *bfa, bfa_boolean_t status);
198void bfa_fcport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon, 193void bfa_fcport_beacon(struct bfa_s *bfa, bfa_boolean_t beacon,
199 bfa_boolean_t link_e2e_beacon); 194 bfa_boolean_t link_e2e_beacon);
200void bfa_cb_pport_event(void *cbarg, bfa_pport_event_t event); 195void bfa_cb_pport_event(void *cbarg, bfa_pport_event_t event);
201void bfa_fcport_qos_get_attr(struct bfa_s *bfa, struct bfa_qos_attr_s *qos_attr); 196void bfa_fcport_qos_get_attr(struct bfa_s *bfa,
197 struct bfa_qos_attr_s *qos_attr);
202void bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa, 198void bfa_fcport_qos_get_vc_attr(struct bfa_s *bfa,
203 struct bfa_qos_vc_attr_s *qos_vc_attr); 199 struct bfa_qos_vc_attr_s *qos_vc_attr);
204bfa_status_t bfa_fcport_get_qos_stats(struct bfa_s *bfa, 200bfa_status_t bfa_fcport_get_qos_stats(struct bfa_s *bfa,
205 union bfa_pport_stats_u *stats, 201 union bfa_fcport_stats_u *stats,
206 bfa_cb_pport_t cbfn, void *cbarg); 202 bfa_cb_pport_t cbfn, void *cbarg);
207bfa_status_t bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn, 203bfa_status_t bfa_fcport_clear_qos_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn,
208 void *cbarg); 204 void *cbarg);
205bfa_status_t bfa_fcport_get_fcoe_stats(struct bfa_s *bfa,
206 union bfa_fcport_stats_u *stats,
207 bfa_cb_pport_t cbfn, void *cbarg);
208bfa_status_t bfa_fcport_clear_fcoe_stats(struct bfa_s *bfa, bfa_cb_pport_t cbfn,
209 void *cbarg);
210
209bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); 211bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa);
210bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa); 212bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa);
211bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa, 213bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa,
diff --git a/drivers/scsi/bfa/include/bfi/bfi.h b/drivers/scsi/bfa/include/bfi/bfi.h
index 7042c18e542d..a550e80cabd2 100644
--- a/drivers/scsi/bfa/include/bfi/bfi.h
+++ b/drivers/scsi/bfa/include/bfi/bfi.h
@@ -143,8 +143,8 @@ enum bfi_mclass {
143 BFI_MC_IOC = 1, /* IO Controller (IOC) */ 143 BFI_MC_IOC = 1, /* IO Controller (IOC) */
144 BFI_MC_DIAG = 2, /* Diagnostic Msgs */ 144 BFI_MC_DIAG = 2, /* Diagnostic Msgs */
145 BFI_MC_FLASH = 3, /* Flash message class */ 145 BFI_MC_FLASH = 3, /* Flash message class */
146 BFI_MC_CEE = 4, 146 BFI_MC_CEE = 4, /* CEE */
147 BFI_MC_FC_PORT = 5, /* FC port */ 147 BFI_MC_FCPORT = 5, /* FC port */
148 BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */ 148 BFI_MC_IOCFC = 6, /* FC - IO Controller (IOC) */
149 BFI_MC_LL = 7, /* Link Layer */ 149 BFI_MC_LL = 7, /* Link Layer */
150 BFI_MC_UF = 8, /* Unsolicited frame receive */ 150 BFI_MC_UF = 8, /* Unsolicited frame receive */
diff --git a/drivers/scsi/bfa/include/bfi/bfi_pport.h b/drivers/scsi/bfa/include/bfi/bfi_pport.h
index 5c3d289d986d..50dcf45c7470 100644
--- a/drivers/scsi/bfa/include/bfi/bfi_pport.h
+++ b/drivers/scsi/bfa/include/bfi/bfi_pport.h
@@ -22,168 +22,97 @@
22 22
23#pragma pack(1) 23#pragma pack(1)
24 24
25enum bfi_pport_h2i { 25enum bfi_fcport_h2i {
26 BFI_PPORT_H2I_ENABLE_REQ = (1), 26 BFI_FCPORT_H2I_ENABLE_REQ = (1),
27 BFI_PPORT_H2I_DISABLE_REQ = (2), 27 BFI_FCPORT_H2I_DISABLE_REQ = (2),
28 BFI_PPORT_H2I_GET_STATS_REQ = (3), 28 BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ = (3),
29 BFI_PPORT_H2I_CLEAR_STATS_REQ = (4), 29 BFI_FCPORT_H2I_STATS_GET_REQ = (4),
30 BFI_PPORT_H2I_SET_SVC_PARAMS_REQ = (5), 30 BFI_FCPORT_H2I_STATS_CLEAR_REQ = (5),
31 BFI_PPORT_H2I_ENABLE_RX_VF_TAG_REQ = (6),
32 BFI_PPORT_H2I_ENABLE_TX_VF_TAG_REQ = (7),
33 BFI_PPORT_H2I_GET_QOS_STATS_REQ = (8),
34 BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ = (9),
35 BFI_FCPORT_H2I_GET_STATS_REQ = (10),
36 BFI_FCPORT_H2I_CLEAR_STATS_REQ = (11),
37}; 31};
38 32
39enum bfi_pport_i2h { 33enum bfi_fcport_i2h {
40 BFI_PPORT_I2H_ENABLE_RSP = BFA_I2HM(1), 34 BFI_FCPORT_I2H_ENABLE_RSP = BFA_I2HM(1),
41 BFI_PPORT_I2H_DISABLE_RSP = BFA_I2HM(2), 35 BFI_FCPORT_I2H_DISABLE_RSP = BFA_I2HM(2),
42 BFI_PPORT_I2H_GET_STATS_RSP = BFA_I2HM(3), 36 BFI_FCPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(3),
43 BFI_PPORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(4), 37 BFI_FCPORT_I2H_STATS_GET_RSP = BFA_I2HM(4),
44 BFI_PPORT_I2H_SET_SVC_PARAMS_RSP = BFA_I2HM(5), 38 BFI_FCPORT_I2H_STATS_CLEAR_RSP = BFA_I2HM(5),
45 BFI_PPORT_I2H_ENABLE_RX_VF_TAG_RSP = BFA_I2HM(6), 39 BFI_FCPORT_I2H_EVENT = BFA_I2HM(6),
46 BFI_PPORT_I2H_ENABLE_TX_VF_TAG_RSP = BFA_I2HM(7),
47 BFI_PPORT_I2H_EVENT = BFA_I2HM(8),
48 BFI_PPORT_I2H_GET_QOS_STATS_RSP = BFA_I2HM(9),
49 BFI_PPORT_I2H_CLEAR_QOS_STATS_RSP = BFA_I2HM(10),
50 BFI_FCPORT_I2H_GET_STATS_RSP = BFA_I2HM(11),
51 BFI_FCPORT_I2H_CLEAR_STATS_RSP = BFA_I2HM(12),
52}; 40};
53 41
54/** 42/**
55 * Generic REQ type 43 * Generic REQ type
56 */ 44 */
57struct bfi_pport_generic_req_s { 45struct bfi_fcport_req_s {
58 struct bfi_mhdr_s mh; /* msg header */ 46 struct bfi_mhdr_s mh; /* msg header */
59 u32 msgtag; /* msgtag for reply */ 47 u32 msgtag; /* msgtag for reply */
60}; 48};
61 49
62/** 50/**
63 * Generic RSP type 51 * Generic RSP type
64 */ 52 */
65struct bfi_pport_generic_rsp_s { 53struct bfi_fcport_rsp_s {
66 struct bfi_mhdr_s mh; /* common msg header */ 54 struct bfi_mhdr_s mh; /* common msg header */
67 u8 status; /* port enable status */ 55 u8 status; /* port enable status */
68 u8 rsvd[3]; 56 u8 rsvd[3];
69 u32 msgtag; /* msgtag for reply */ 57 u32 msgtag; /* msgtag for reply */
70}; 58};
71 59
72/** 60/**
73 * BFI_PPORT_H2I_ENABLE_REQ 61 * BFI_FCPORT_H2I_ENABLE_REQ
74 */ 62 */
75struct bfi_pport_enable_req_s { 63struct bfi_fcport_enable_req_s {
76 struct bfi_mhdr_s mh; /* msg header */ 64 struct bfi_mhdr_s mh; /* msg header */
77 u32 rsvd1; 65 u32 rsvd1;
78 wwn_t nwwn; /* node wwn of physical port */ 66 wwn_t nwwn; /* node wwn of physical port */
79 wwn_t pwwn; /* port wwn of physical port */ 67 wwn_t pwwn; /* port wwn of physical port */
80 struct bfa_pport_cfg_s port_cfg; /* port configuration */ 68 struct bfa_pport_cfg_s port_cfg; /* port configuration */
81 union bfi_addr_u stats_dma_addr; /* DMA address for stats */ 69 union bfi_addr_u stats_dma_addr; /* DMA address for stats */
82 union bfi_addr_u fcport_stats_dma_addr;/*!< DMA address for stats */ 70 u32 msgtag; /* msgtag for reply */
83 u32 msgtag; /* msgtag for reply */ 71 u32 rsvd2;
84 u32 rsvd2;
85}; 72};
86 73
87/** 74/**
88 * BFI_PPORT_I2H_ENABLE_RSP 75 * BFI_FCPORT_H2I_SET_SVC_PARAMS_REQ
89 */ 76 */
90#define bfi_pport_enable_rsp_t struct bfi_pport_generic_rsp_s 77struct bfi_fcport_set_svc_params_req_s {
91
92/**
93 * BFI_PPORT_H2I_DISABLE_REQ
94 */
95#define bfi_pport_disable_req_t struct bfi_pport_generic_req_s
96
97/**
98 * BFI_PPORT_I2H_DISABLE_RSP
99 */
100#define bfi_pport_disable_rsp_t struct bfi_pport_generic_rsp_s
101
102/**
103 * BFI_PPORT_H2I_GET_STATS_REQ
104 */
105#define bfi_pport_get_stats_req_t struct bfi_pport_generic_req_s
106
107/**
108 * BFI_PPORT_I2H_GET_STATS_RSP
109 */
110#define bfi_pport_get_stats_rsp_t struct bfi_pport_generic_rsp_s
111
112/**
113 * BFI_PPORT_H2I_CLEAR_STATS_REQ
114 */
115#define bfi_pport_clear_stats_req_t struct bfi_pport_generic_req_s
116
117/**
118 * BFI_PPORT_I2H_CLEAR_STATS_RSP
119 */
120#define bfi_pport_clear_stats_rsp_t struct bfi_pport_generic_rsp_s
121
122/**
123 * BFI_PPORT_H2I_GET_QOS_STATS_REQ
124 */
125#define bfi_pport_get_qos_stats_req_t struct bfi_pport_generic_req_s
126
127/**
128 * BFI_PPORT_H2I_GET_QOS_STATS_RSP
129 */
130#define bfi_pport_get_qos_stats_rsp_t struct bfi_pport_generic_rsp_s
131
132/**
133 * BFI_PPORT_H2I_CLEAR_QOS_STATS_REQ
134 */
135#define bfi_pport_clear_qos_stats_req_t struct bfi_pport_generic_req_s
136
137/**
138 * BFI_PPORT_H2I_CLEAR_QOS_STATS_RSP
139 */
140#define bfi_pport_clear_qos_stats_rsp_t struct bfi_pport_generic_rsp_s
141
142/**
143 * BFI_PPORT_H2I_SET_SVC_PARAMS_REQ
144 */
145struct bfi_pport_set_svc_params_req_s {
146 struct bfi_mhdr_s mh; /* msg header */ 78 struct bfi_mhdr_s mh; /* msg header */
147 u16 tx_bbcredit; /* Tx credits */ 79 u16 tx_bbcredit; /* Tx credits */
148 u16 rsvd; 80 u16 rsvd;
149}; 81};
150 82
151/** 83/**
152 * BFI_PPORT_I2H_SET_SVC_PARAMS_RSP 84 * BFI_FCPORT_I2H_EVENT
153 */
154
155/**
156 * BFI_PPORT_I2H_EVENT
157 */ 85 */
158struct bfi_pport_event_s { 86struct bfi_fcport_event_s {
159 struct bfi_mhdr_s mh; /* common msg header */ 87 struct bfi_mhdr_s mh; /* common msg header */
160 struct bfa_pport_link_s link_state; 88 struct bfa_pport_link_s link_state;
161}; 89};
162 90
163union bfi_pport_h2i_msg_u { 91/**
92 * fcport H2I message
93 */
94union bfi_fcport_h2i_msg_u {
164 struct bfi_mhdr_s *mhdr; 95 struct bfi_mhdr_s *mhdr;
165 struct bfi_pport_enable_req_s *penable; 96 struct bfi_fcport_enable_req_s *penable;
166 struct bfi_pport_generic_req_s *pdisable; 97 struct bfi_fcport_req_s *pdisable;
167 struct bfi_pport_generic_req_s *pgetstats; 98 struct bfi_fcport_set_svc_params_req_s *psetsvcparams;
168 struct bfi_pport_generic_req_s *pclearstats; 99 struct bfi_fcport_req_s *pstatsget;
169 struct bfi_pport_set_svc_params_req_s *psetsvcparams; 100 struct bfi_fcport_req_s *pstatsclear;
170 struct bfi_pport_get_qos_stats_req_s *pgetqosstats;
171 struct bfi_pport_generic_req_s *pclearqosstats;
172}; 101};
173 102
174union bfi_pport_i2h_msg_u { 103/**
104 * fcport I2H message
105 */
106union bfi_fcport_i2h_msg_u {
175 struct bfi_msg_s *msg; 107 struct bfi_msg_s *msg;
176 struct bfi_pport_generic_rsp_s *enable_rsp; 108 struct bfi_fcport_rsp_s *penable_rsp;
177 struct bfi_pport_disable_rsp_s *disable_rsp; 109 struct bfi_fcport_rsp_s *pdisable_rsp;
178 struct bfi_pport_generic_rsp_s *getstats_rsp; 110 struct bfi_fcport_rsp_s *psetsvcparams_rsp;
179 struct bfi_pport_clear_stats_rsp_s *clearstats_rsp; 111 struct bfi_fcport_rsp_s *pstatsget_rsp;
180 struct bfi_pport_set_svc_params_rsp_s *setsvcparasm_rsp; 112 struct bfi_fcport_rsp_s *pstatsclear_rsp;
181 struct bfi_pport_get_qos_stats_rsp_s *getqosstats_rsp; 113 struct bfi_fcport_event_s *event;
182 struct bfi_pport_clear_qos_stats_rsp_s *clearqosstats_rsp;
183 struct bfi_pport_event_s *event;
184}; 114};
185 115
186#pragma pack() 116#pragma pack()
187 117
188#endif /* __BFI_PPORT_H__ */ 118#endif /* __BFI_PPORT_H__ */
189
diff --git a/drivers/scsi/bfa/include/defs/bfa_defs_pport.h b/drivers/scsi/bfa/include/defs/bfa_defs_pport.h
index 164cfbef9b12..26e5cc78095d 100644
--- a/drivers/scsi/bfa/include/defs/bfa_defs_pport.h
+++ b/drivers/scsi/bfa/include/defs/bfa_defs_pport.h
@@ -240,73 +240,79 @@ struct bfa_pport_attr_s {
240 * FC Port statistics. 240 * FC Port statistics.
241 */ 241 */
242struct bfa_pport_fc_stats_s { 242struct bfa_pport_fc_stats_s {
243 u64 secs_reset; /* seconds since stats is reset */ 243 u64 secs_reset; /* Seconds since stats is reset */
244 u64 tx_frames; /* transmitted frames */ 244 u64 tx_frames; /* Tx frames */
245 u64 tx_words; /* transmitted words */ 245 u64 tx_words; /* Tx words */
246 u64 rx_frames; /* received frames */ 246 u64 tx_lip; /* TX LIP */
247 u64 rx_words; /* received words */ 247 u64 tx_nos; /* Tx NOS */
248 u64 lip_count; /* LIPs seen */ 248 u64 tx_ols; /* Tx OLS */
249 u64 nos_count; /* NOS count */ 249 u64 tx_lr; /* Tx LR */
250 u64 error_frames; /* errored frames */ 250 u64 tx_lrr; /* Tx LRR */
251 u64 dropped_frames; /* dropped frames */ 251 u64 rx_frames; /* Rx frames */
252 u64 link_failures; /* link failure count */ 252 u64 rx_words; /* Rx words */
253 u64 loss_of_syncs; /* loss of sync count */ 253 u64 lip_count; /* Rx LIP */
254 u64 loss_of_signals;/* loss of signal count */ 254 u64 nos_count; /* Rx NOS */
255 u64 primseq_errs; /* primitive sequence protocol */ 255 u64 ols_count; /* Rx OLS */
256 u64 bad_os_count; /* invalid ordered set */ 256 u64 lr_count; /* Rx LR */
257 u64 err_enc_out; /* Encoding error outside frame */ 257 u64 lrr_count; /* Rx LRR */
258 u64 invalid_crcs; /* frames received with invalid CRC*/ 258 u64 invalid_crcs; /* Rx CRC err frames */
259 u64 undersized_frm; /* undersized frames */ 259 u64 invalid_crc_gd_eof; /* Rx CRC err good EOF frames */
260 u64 oversized_frm; /* oversized frames */ 260 u64 undersized_frm; /* Rx undersized frames */
261 u64 bad_eof_frm; /* frames with bad EOF */ 261 u64 oversized_frm; /* Rx oversized frames */
262 struct bfa_qos_stats_s qos_stats; /* QoS statistics */ 262 u64 bad_eof_frm; /* Rx frames with bad EOF */
263 u64 error_frames; /* Errored frames */
264 u64 dropped_frames; /* Dropped frames */
265 u64 link_failures; /* Link Failure (LF) count */
266 u64 loss_of_syncs; /* Loss of sync count */
267 u64 loss_of_signals;/* Loss of signal count */
268 u64 primseq_errs; /* Primitive sequence protocol err. */
269 u64 bad_os_count; /* Invalid ordered sets */
270 u64 err_enc_out; /* Encoding err nonframe_8b10b */
271 u64 err_enc; /* Encoding err frame_8b10b */
263}; 272};
264 273
265/** 274/**
266 * Eth Port statistics. 275 * Eth Port statistics.
267 */ 276 */
268struct bfa_pport_eth_stats_s { 277struct bfa_pport_eth_stats_s {
269 u64 secs_reset; /* seconds since stats is reset */ 278 u64 secs_reset; /* Seconds since stats is reset */
270 u64 frame_64; /* both rx and tx counter */ 279 u64 frame_64; /* Frames 64 bytes */
271 u64 frame_65_127; /* both rx and tx counter */ 280 u64 frame_65_127; /* Frames 65-127 bytes */
272 u64 frame_128_255; /* both rx and tx counter */ 281 u64 frame_128_255; /* Frames 128-255 bytes */
273 u64 frame_256_511; /* both rx and tx counter */ 282 u64 frame_256_511; /* Frames 256-511 bytes */
274 u64 frame_512_1023; /* both rx and tx counter */ 283 u64 frame_512_1023; /* Frames 512-1023 bytes */
275 u64 frame_1024_1518; /* both rx and tx counter */ 284 u64 frame_1024_1518; /* Frames 1024-1518 bytes */
276 u64 frame_1519_1522; /* both rx and tx counter */ 285 u64 frame_1519_1522; /* Frames 1519-1522 bytes */
277 286 u64 tx_bytes; /* Tx bytes */
278 u64 tx_bytes; 287 u64 tx_packets; /* Tx packets */
279 u64 tx_packets; 288 u64 tx_mcast_packets; /* Tx multicast packets */
280 u64 tx_mcast_packets; 289 u64 tx_bcast_packets; /* Tx broadcast packets */
281 u64 tx_bcast_packets; 290 u64 tx_control_frame; /* Tx control frame */
282 u64 tx_control_frame; 291 u64 tx_drop; /* Tx drops */
283 u64 tx_drop; 292 u64 tx_jabber; /* Tx jabber */
284 u64 tx_jabber; 293 u64 tx_fcs_error; /* Tx FCS error */
285 u64 tx_fcs_error; 294 u64 tx_fragments; /* Tx fragments */
286 u64 tx_fragments; 295 u64 rx_bytes; /* Rx bytes */
287 296 u64 rx_packets; /* Rx packets */
288 u64 rx_bytes; 297 u64 rx_mcast_packets; /* Rx multicast packets */
289 u64 rx_packets; 298 u64 rx_bcast_packets; /* Rx broadcast packets */
290 u64 rx_mcast_packets; 299 u64 rx_control_frames; /* Rx control frames */
291 u64 rx_bcast_packets; 300 u64 rx_unknown_opcode; /* Rx unknown opcode */
292 u64 rx_control_frames; 301 u64 rx_drop; /* Rx drops */
293 u64 rx_unknown_opcode; 302 u64 rx_jabber; /* Rx jabber */
294 u64 rx_drop; 303 u64 rx_fcs_error; /* Rx FCS errors */
295 u64 rx_jabber; 304 u64 rx_alignment_error; /* Rx alignment errors */
296 u64 rx_fcs_error; 305 u64 rx_frame_length_error; /* Rx frame len errors */
297 u64 rx_alignment_error; 306 u64 rx_code_error; /* Rx code errors */
298 u64 rx_frame_length_error; 307 u64 rx_fragments; /* Rx fragments */
299 u64 rx_code_error; 308 u64 rx_pause; /* Rx pause */
300 u64 rx_fragments; 309 u64 rx_zero_pause; /* Rx zero pause */
301 310 u64 tx_pause; /* Tx pause */
302 u64 rx_pause; /* BPC */ 311 u64 tx_zero_pause; /* Tx zero pause */
303 u64 rx_zero_pause; /* BPC Pause cancellation */ 312 u64 rx_fcoe_pause; /* Rx fcoe pause */
304 u64 tx_pause; /* BPC */ 313 u64 rx_fcoe_zero_pause; /* Rx FCoE zero pause */
305 u64 tx_zero_pause; /* BPC Pause cancellation */ 314 u64 tx_fcoe_pause; /* Tx FCoE pause */
306 u64 rx_fcoe_pause; /* BPC */ 315 u64 tx_fcoe_zero_pause; /* Tx FCoE zero pause */
307 u64 rx_fcoe_zero_pause; /* BPC Pause cancellation */
308 u64 tx_fcoe_pause; /* BPC */
309 u64 tx_fcoe_zero_pause; /* BPC Pause cancellation */
310}; 316};
311 317
312/** 318/**