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

Commit 59f740a6 authored by Zach Brown's avatar Zach Brown Committed by Andy Grover
Browse files

RDS/IB: print string constants in more places



This prints the constant identifier for work completion status and rdma
cm event types, like we already do for IB event types.

A core string array helper is added that each string type uses.

Signed-off-by: default avatarZach Brown <zach.brown@oracle.com>
parent 4518071a
Loading
Loading
Loading
Loading
+9 −0
Original line number Original line Diff line number Diff line
@@ -40,6 +40,15 @@


#include "rds.h"
#include "rds.h"


char *rds_str_array(char **array, size_t elements, size_t index)
{
	if ((index < elements) && array[index])
		return array[index];
	else
		return "unknown";
}
EXPORT_SYMBOL(rds_str_array);

/* this is just used for stats gathering :/ */
/* this is just used for stats gathering :/ */
static DEFINE_SPINLOCK(rds_sock_lock);
static DEFINE_SPINLOCK(rds_sock_lock);
static unsigned long rds_sock_count;
static unsigned long rds_sock_count;
+1 −0
Original line number Original line Diff line number Diff line
@@ -345,6 +345,7 @@ u32 rds_ib_ring_completed(struct rds_ib_work_ring *ring, u32 wr_id, u32 oldest);
extern wait_queue_head_t rds_ib_ring_empty_wait;
extern wait_queue_head_t rds_ib_ring_empty_wait;


/* ib_send.c */
/* ib_send.c */
char *rds_ib_wc_status_str(enum ib_wc_status status);
void rds_ib_xmit_complete(struct rds_connection *conn);
void rds_ib_xmit_complete(struct rds_connection *conn);
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm,
		unsigned int hdr_off, unsigned int sg, unsigned int off);
		unsigned int hdr_off, unsigned int sg, unsigned int off);
+4 −6
Original line number Original line Diff line number Diff line
@@ -39,7 +39,8 @@
#include "ib.h"
#include "ib.h"


static char *rds_ib_event_type_strings[] = {
static char *rds_ib_event_type_strings[] = {
#define RDS_IB_EVENT_STRING(foo) [IB_EVENT_##foo] = __stringify(foo)
#define RDS_IB_EVENT_STRING(foo) \
		[IB_EVENT_##foo] = __stringify(IB_EVENT_##foo)
	RDS_IB_EVENT_STRING(CQ_ERR),
	RDS_IB_EVENT_STRING(CQ_ERR),
	RDS_IB_EVENT_STRING(QP_FATAL),
	RDS_IB_EVENT_STRING(QP_FATAL),
	RDS_IB_EVENT_STRING(QP_REQ_ERR),
	RDS_IB_EVENT_STRING(QP_REQ_ERR),
@@ -63,11 +64,8 @@ static char *rds_ib_event_type_strings[] = {


static char *rds_ib_event_str(enum ib_event_type type)
static char *rds_ib_event_str(enum ib_event_type type)
{
{
	if (type < ARRAY_SIZE(rds_ib_event_type_strings) &&
	return rds_str_array(rds_ib_event_type_strings,
	    rds_ib_event_type_strings[type])
			     ARRAY_SIZE(rds_ib_event_type_strings), type);
		return rds_ib_event_type_strings[type];
	else
		return "unknown";
};
};


/*
/*
+7 −5
Original line number Original line Diff line number Diff line
@@ -966,8 +966,9 @@ static inline void rds_poll_cq(struct rds_ib_connection *ic,
	struct rds_ib_recv_work *recv;
	struct rds_ib_recv_work *recv;


	while (ib_poll_cq(ic->i_recv_cq, 1, &wc) > 0) {
	while (ib_poll_cq(ic->i_recv_cq, 1, &wc) > 0) {
		rdsdebug("wc wr_id 0x%llx status %u byte_len %u imm_data %u\n",
		rdsdebug("wc wr_id 0x%llx status %u (%s) byte_len %u imm_data %u\n",
			 (unsigned long long)wc.wr_id, wc.status, wc.byte_len,
			 (unsigned long long)wc.wr_id, wc.status,
			 rds_ib_wc_status_str(wc.status), wc.byte_len,
			 be32_to_cpu(wc.ex.imm_data));
			 be32_to_cpu(wc.ex.imm_data));
		rds_ib_stats_inc(s_ib_rx_cq_event);
		rds_ib_stats_inc(s_ib_rx_cq_event);


@@ -985,10 +986,11 @@ static inline void rds_poll_cq(struct rds_ib_connection *ic,
		} else {
		} else {
			/* We expect errors as the qp is drained during shutdown */
			/* We expect errors as the qp is drained during shutdown */
			if (rds_conn_up(conn) || rds_conn_connecting(conn))
			if (rds_conn_up(conn) || rds_conn_connecting(conn))
				rds_ib_conn_error(conn, "recv completion on "
				rds_ib_conn_error(conn, "recv completion on %pI4 had "
						  "%pI4 had status %u, disconnecting and "
						  "status %u (%s), disconnecting and "
						  "reconnecting\n", &conn->c_faddr,
						  "reconnecting\n", &conn->c_faddr,
						  wc.status);
						  wc.status,
						  rds_ib_wc_status_str(wc.status));
		}
		}


		/*
		/*
+41 −6
Original line number Original line Diff line number Diff line
@@ -38,6 +38,40 @@
#include "rds.h"
#include "rds.h"
#include "ib.h"
#include "ib.h"


static char *rds_ib_wc_status_strings[] = {
#define RDS_IB_WC_STATUS_STR(foo) \
		[IB_WC_##foo] = __stringify(IB_WC_##foo)
	RDS_IB_WC_STATUS_STR(SUCCESS),
	RDS_IB_WC_STATUS_STR(LOC_LEN_ERR),
	RDS_IB_WC_STATUS_STR(LOC_QP_OP_ERR),
	RDS_IB_WC_STATUS_STR(LOC_EEC_OP_ERR),
	RDS_IB_WC_STATUS_STR(LOC_PROT_ERR),
	RDS_IB_WC_STATUS_STR(WR_FLUSH_ERR),
	RDS_IB_WC_STATUS_STR(MW_BIND_ERR),
	RDS_IB_WC_STATUS_STR(BAD_RESP_ERR),
	RDS_IB_WC_STATUS_STR(LOC_ACCESS_ERR),
	RDS_IB_WC_STATUS_STR(REM_INV_REQ_ERR),
	RDS_IB_WC_STATUS_STR(REM_ACCESS_ERR),
	RDS_IB_WC_STATUS_STR(REM_OP_ERR),
	RDS_IB_WC_STATUS_STR(RETRY_EXC_ERR),
	RDS_IB_WC_STATUS_STR(RNR_RETRY_EXC_ERR),
	RDS_IB_WC_STATUS_STR(LOC_RDD_VIOL_ERR),
	RDS_IB_WC_STATUS_STR(REM_INV_RD_REQ_ERR),
	RDS_IB_WC_STATUS_STR(REM_ABORT_ERR),
	RDS_IB_WC_STATUS_STR(INV_EECN_ERR),
	RDS_IB_WC_STATUS_STR(INV_EEC_STATE_ERR),
	RDS_IB_WC_STATUS_STR(FATAL_ERR),
	RDS_IB_WC_STATUS_STR(RESP_TIMEOUT_ERR),
	RDS_IB_WC_STATUS_STR(GENERAL_ERR),
#undef RDS_IB_WC_STATUS_STR
};

char *rds_ib_wc_status_str(enum ib_wc_status status)
{
	return rds_str_array(rds_ib_wc_status_strings,
			     ARRAY_SIZE(rds_ib_wc_status_strings), status);
}

/*
/*
 * Convert IB-specific error message to RDS error message and call core
 * Convert IB-specific error message to RDS error message and call core
 * completion handler.
 * completion handler.
@@ -257,8 +291,9 @@ void rds_ib_send_cq_comp_handler(struct ib_cq *cq, void *context)
		rdsdebug("ib_req_notify_cq send failed: %d\n", ret);
		rdsdebug("ib_req_notify_cq send failed: %d\n", ret);


	while (ib_poll_cq(cq, 1, &wc) > 0) {
	while (ib_poll_cq(cq, 1, &wc) > 0) {
		rdsdebug("wc wr_id 0x%llx status %u byte_len %u imm_data %u\n",
		rdsdebug("wc wr_id 0x%llx status %u (%s) byte_len %u imm_data %u\n",
			 (unsigned long long)wc.wr_id, wc.status, wc.byte_len,
			 (unsigned long long)wc.wr_id, wc.status,
			 rds_ib_wc_status_str(wc.status), wc.byte_len,
			 be32_to_cpu(wc.ex.imm_data));
			 be32_to_cpu(wc.ex.imm_data));
		rds_ib_stats_inc(s_ib_tx_cq_event);
		rds_ib_stats_inc(s_ib_tx_cq_event);


@@ -306,10 +341,10 @@ void rds_ib_send_cq_comp_handler(struct ib_cq *cq, void *context)


		/* We expect errors as the qp is drained during shutdown */
		/* We expect errors as the qp is drained during shutdown */
		if (wc.status != IB_WC_SUCCESS && rds_conn_up(conn)) {
		if (wc.status != IB_WC_SUCCESS && rds_conn_up(conn)) {
			rds_ib_conn_error(conn,
			rds_ib_conn_error(conn, "send completion on %pI4 had status "
				"send completion on %pI4 "
					  "%u (%s), disconnecting and reconnecting\n",
				"had status %u, disconnecting and reconnecting\n",
					  &conn->c_faddr, wc.status,
				&conn->c_faddr, wc.status);
					  rds_ib_wc_status_str(wc.status));
		}
		}
	}
	}
}
}
Loading