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

Commit b85d045e authored by Jing Huang's avatar Jing Huang Committed by James Bottomley
Browse files

[SCSI] bfa: statistics and typo fix



- Added time stamp for fcport stats reset
- Added new fileds to the statistics data structures.
- Typo removal and minor cleanup.

Signed-off-by: default avatarJing Huang <huangj@brocade.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@suse.de>
parent 15b64a83
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ struct bfa_itnim_s {
	struct bfa_reqq_wait_s reqq_wait; /*  to wait for room in reqq */
	struct bfa_fcpim_mod_s *fcpim;	/*  fcpim module                */
	struct bfa_itnim_hal_stats_s	stats;
	struct bfa_itnim_latency_s  io_latency;
};

#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
+23 −2
Original line number Diff line number Diff line
@@ -888,6 +888,7 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
	struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa);
	struct bfa_pport_cfg_s *port_cfg = &fcport->cfg;
	struct bfa_fcport_ln_s *ln = &fcport->ln;
	struct bfa_timeval_s tv;

	bfa_os_memset(fcport, 0, sizeof(struct bfa_fcport_s));
	fcport->bfa = bfa;
@@ -898,6 +899,12 @@ bfa_fcport_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
	bfa_sm_set_state(fcport, bfa_fcport_sm_uninit);
	bfa_sm_set_state(ln, bfa_fcport_ln_sm_dn);

	/**
	 * initialize time stamp for stats reset
	 */
	bfa_os_gettimeofday(&tv);
	fcport->stats_reset_time = tv.tv_sec;

	/**
	 * initialize and set default configuration
	 */
@@ -1126,16 +1133,22 @@ __bfa_cb_fcport_stats_get(void *cbarg, bfa_boolean_t complete)

	if (complete) {
		if (fcport->stats_status == BFA_STATUS_OK) {
			struct bfa_timeval_s tv;

			/* Swap FC QoS or FCoE stats */
			if (bfa_ioc_get_fcmode(&fcport->bfa->ioc))
			if (bfa_ioc_get_fcmode(&fcport->bfa->ioc)) {
				bfa_fcport_qos_stats_swap(
					&fcport->stats_ret->fcqos,
					&fcport->stats->fcqos);
			else
			} else {
				bfa_fcport_fcoe_stats_swap(
					&fcport->stats_ret->fcoe,
					&fcport->stats->fcoe);

				bfa_os_gettimeofday(&tv);
				fcport->stats_ret->fcoe.secs_reset =
					tv.tv_sec - fcport->stats_reset_time;
			}
		}
		fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
	} else {
@@ -1191,6 +1204,14 @@ __bfa_cb_fcport_stats_clr(void *cbarg, bfa_boolean_t complete)
	struct bfa_fcport_s *fcport = cbarg;

	if (complete) {
		struct bfa_timeval_s tv;

		/**
		 * re-initialize time stamp for stats reset
		 */
		bfa_os_gettimeofday(&tv);
		fcport->stats_reset_time = tv.tv_sec;

		fcport->stats_cbfn(fcport->stats_cbarg, fcport->stats_status);
	} else {
		fcport->stats_busy = BFA_FALSE;
+25 −2
Original line number Diff line number Diff line
@@ -102,9 +102,14 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
	port->stats_busy = BFA_FALSE;

	if (status == BFA_STATUS_OK) {
		struct bfa_timeval_s tv;

		memcpy(port->stats, port->stats_dma.kva,
		       sizeof(union bfa_pport_stats_u));
		bfa_port_stats_swap(port, port->stats);

		bfa_os_gettimeofday(&tv);
		port->stats->fc.secs_reset = tv.tv_sec - port->stats_reset_time;
	}

	if (port->stats_cbfn) {
@@ -125,9 +130,17 @@ bfa_port_get_stats_isr(struct bfa_port_s *port, bfa_status_t status)
static void
bfa_port_clear_stats_isr(struct bfa_port_s *port, bfa_status_t status)
{
	struct bfa_timeval_s tv;

	port->stats_status = status;
	port->stats_busy = BFA_FALSE;

	/**
	 * re-initialize time stamp for stats reset
	 */
	bfa_os_gettimeofday(&tv);
	port->stats_reset_time = tv.tv_sec;

	if (port->stats_cbfn) {
		port->stats_cbfn(port->stats_cbarg, status);
		port->stats_cbfn = NULL;
@@ -428,6 +441,8 @@ void
bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, void *dev,
		struct bfa_trc_mod_s *trcmod, struct bfa_log_mod_s *logmod)
{
	struct bfa_timeval_s tv;

	bfa_assert(port);

	port->dev = dev;
@@ -435,13 +450,21 @@ bfa_port_attach(struct bfa_port_s *port, struct bfa_ioc_s *ioc, void *dev,
	port->trcmod = trcmod;
	port->logmod = logmod;

	port->stats_busy = port->endis_pending = BFA_FALSE;
	port->stats_cbfn = port->endis_cbfn = NULL;
	port->stats_busy = BFA_FALSE;
	port->endis_pending = BFA_FALSE;
	port->stats_cbfn = NULL;
	port->endis_cbfn = NULL;

	bfa_ioc_mbox_regisr(port->ioc, BFI_MC_PORT, bfa_port_isr, port);
	bfa_ioc_hbfail_init(&port->hbfail, bfa_port_hbfail, port);
	bfa_ioc_hbfail_register(port->ioc, &port->hbfail);

	/**
	 * initialize time stamp for stats reset
	 */
	bfa_os_gettimeofday(&tv);
	port->stats_reset_time = tv.tv_sec;

	bfa_trc(port, 0);
}

+2 −1
Original line number Diff line number Diff line
@@ -75,8 +75,9 @@ struct bfa_fcport_s {
	bfa_status_t            stats_status; /*  stats/statsclr status */
	bfa_boolean_t           stats_busy; /*  outstanding stats/statsclr */
	bfa_boolean_t           stats_qfull;
	u32                	stats_reset_time; /* stats reset time stamp */
	bfa_cb_pport_t          stats_cbfn; /*  driver callback function */
	void                    *stats_cbarg; /* *!< user callback arg */
	void                    *stats_cbarg; /* user callback arg */
	bfa_boolean_t           diag_busy; /*  diag busy status */
	bfa_boolean_t           beacon; /*  port beacon status */
	bfa_boolean_t           link_e2e_beacon; /*  link beacon status */
+0 −13
Original line number Diff line number Diff line
@@ -141,18 +141,6 @@ struct bfad_cfg_param_s {
	u32        binding_method;
};

union bfad_tmp_buf {
	/* From struct bfa_adapter_attr_s */
	char            manufacturer[BFA_ADAPTER_MFG_NAME_LEN];
	char            serial_num[BFA_ADAPTER_SERIAL_NUM_LEN];
	char            model[BFA_ADAPTER_MODEL_NAME_LEN];
	char            fw_ver[BFA_VERSION_LEN];
	char            optrom_ver[BFA_VERSION_LEN];

	/* From struct bfa_ioc_pci_attr_s */
	u8         chip_rev[BFA_IOC_CHIP_REV_LEN];  /*  chip revision */
};

/*
 * BFAD (PCI function) data structure
 */
@@ -195,7 +183,6 @@ struct bfad_s {
	struct bfa_plog_s      plog_buf;
	int             ref_count;
	bfa_boolean_t	ipfc_enabled;
	union bfad_tmp_buf tmp_buf;
	struct fc_host_statistics link_stats;
	struct list_head pbc_pcfg_list;
};
Loading