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

Commit 2f2b2614 authored by Mintz, Yuval's avatar Mintz, Yuval Committed by David S. Miller
Browse files

qed: Provide iSCSI statistics to management



Management firmware can query for some basic iSCSI-related statistics.
Provide those just as we do for other protocols.

Signed-off-by: default avatarYuval Mintz <Yuval.Mintz@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 08737a3f
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -1324,6 +1324,26 @@ static int qed_iscsi_stats(struct qed_dev *cdev, struct qed_iscsi_stats *stats)
	return qed_iscsi_get_stats(QED_LEADING_HWFN(cdev), stats);
}

void qed_get_protocol_stats_iscsi(struct qed_dev *cdev,
				  struct qed_mcp_iscsi_stats *stats)
{
	struct qed_iscsi_stats proto_stats;

	/* Retrieve FW statistics */
	memset(&proto_stats, 0, sizeof(proto_stats));
	if (qed_iscsi_stats(cdev, &proto_stats)) {
		DP_VERBOSE(cdev, QED_MSG_STORAGE,
			   "Failed to collect ISCSI statistics\n");
		return;
	}

	/* Translate FW statistics into struct */
	stats->rx_pdus = proto_stats.iscsi_rx_total_pdu_cnt;
	stats->tx_pdus = proto_stats.iscsi_tx_total_pdu_cnt;
	stats->rx_bytes = proto_stats.iscsi_rx_bytes_cnt;
	stats->tx_bytes = proto_stats.iscsi_tx_bytes_cnt;
}

static const struct qed_iscsi_ops qed_iscsi_ops_pass = {
	.common = &qed_common_ops_pass,
	.ll2 = &qed_ll2_ops_pass,
+13 −1
Original line number Diff line number Diff line
@@ -64,6 +64,15 @@ void qed_iscsi_setup(struct qed_hwfn *p_hwfn,

void qed_iscsi_free(struct qed_hwfn *p_hwfn,
		    struct qed_iscsi_info *p_iscsi_info);

/**
 * @brief - Fills provided statistics struct with statistics.
 *
 * @param cdev
 * @param stats - points to struct that will be filled with statistics.
 */
void qed_get_protocol_stats_iscsi(struct qed_dev *cdev,
				  struct qed_mcp_iscsi_stats *stats);
#else /* IS_ENABLED(CONFIG_QED_ISCSI) */
static inline struct qed_iscsi_info *qed_iscsi_alloc(
		struct qed_hwfn *p_hwfn) { return NULL; }
@@ -71,6 +80,9 @@ static inline void qed_iscsi_setup(struct qed_hwfn *p_hwfn,
				   struct qed_iscsi_info *p_iscsi_info) {}
static inline void qed_iscsi_free(struct qed_hwfn *p_hwfn,
				 struct qed_iscsi_info *p_iscsi_info) {}
static inline void
qed_get_protocol_stats_iscsi(struct qed_dev *cdev,
			     struct qed_mcp_iscsi_stats *stats) {}
#endif /* IS_ENABLED(CONFIG_QED_ISCSI) */

#endif
+5 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@
#include "qed_dev_api.h"
#include "qed_ll2.h"
#include "qed_fcoe.h"
#include "qed_iscsi.h"

#include "qed_mcp.h"
#include "qed_hw.h"
#include "qed_selftest.h"
@@ -1679,6 +1681,9 @@ void qed_get_protocol_stats(struct qed_dev *cdev,
	case QED_MCP_FCOE_STATS:
		qed_get_protocol_stats_fcoe(cdev, &stats->fcoe_stats);
		break;
	case QED_MCP_ISCSI_STATS:
		qed_get_protocol_stats_iscsi(cdev, &stats->iscsi_stats);
		break;
	default:
		DP_ERR(cdev, "Invalid protocol type = %d\n", type);
		return;