* [PATCH RFC] rdma_cm: add rdma_reject_msg() helper function
@ 2016-10-20 21:12 Steve Wise
[not found] ` <20161020211652.35902E0C53-/5N3P9jjx0xzbRFIqnYvSA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Steve Wise @ 2016-10-20 21:12 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ
rdma_reject_msg() returns a pointer to a string message associated with
the transport reject reason codes.
Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
Hey Bart, if folks like this, then perhaps you can make use of it in your
nvme series.
Steve.
---
drivers/infiniband/core/cma.c | 64 +++++++++++++++++++++++++++++++++++++++++++
include/rdma/rdma_cm.h | 8 ++++++
2 files changed, 72 insertions(+)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 5f65a78..fd11821 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -101,6 +101,70 @@ const char *__attribute_const__ rdma_event_msg(enum rdma_cm_event_type event)
}
EXPORT_SYMBOL(rdma_event_msg);
+static const char * const ib_rej_reason_strs[] = {
+ [IB_CM_REJ_NO_QP] = "no qp",
+ [IB_CM_REJ_NO_EEC] = "no eec",
+ [IB_CM_REJ_NO_RESOURCES] = "no resources",
+ [IB_CM_REJ_TIMEOUT] = "timeout",
+ [IB_CM_REJ_UNSUPPORTED] = "unsupported",
+ [IB_CM_REJ_INVALID_COMM_ID] = "invalid comm id",
+ [IB_CM_REJ_INVALID_COMM_INSTANCE] = "invalid comm instance",
+ [IB_CM_REJ_INVALID_SERVICE_ID] = "invalid service id",
+ [IB_CM_REJ_INVALID_TRANSPORT_TYPE] = "invalid transport type",
+ [IB_CM_REJ_STALE_CONN] = "stale conn",
+ [IB_CM_REJ_RDC_NOT_EXIST] = "rdc not exist",
+ [IB_CM_REJ_INVALID_GID] = "invalid gid",
+ [IB_CM_REJ_INVALID_LID] = "invalid lid",
+ [IB_CM_REJ_INVALID_SL] = "invalid sl",
+ [IB_CM_REJ_INVALID_TRAFFIC_CLASS] = "invalid traffic class",
+ [IB_CM_REJ_INVALID_HOP_LIMIT] = "invalid hop limit",
+ [IB_CM_REJ_INVALID_PACKET_RATE] = "invalid packet rate",
+ [IB_CM_REJ_INVALID_ALT_GID] = "invalid alt gid",
+ [IB_CM_REJ_INVALID_ALT_LID] = "invalid alt lid",
+ [IB_CM_REJ_INVALID_ALT_SL] = "invalid alt sl",
+ [IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS] = "invalid alt traffic class",
+ [IB_CM_REJ_INVALID_ALT_HOP_LIMIT] = "invalid alt hop limit",
+ [IB_CM_REJ_INVALID_ALT_PACKET_RATE] = "invalid alt packet rate",
+ [IB_CM_REJ_PORT_CM_REDIRECT] = "port cm redirect",
+ [IB_CM_REJ_PORT_REDIRECT] = "port redirect",
+ [IB_CM_REJ_INVALID_MTU] = "invalid mtu",
+ [IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES] = "insufficient resp resources",
+ [IB_CM_REJ_CONSUMER_DEFINED] = "consumer defined",
+ [IB_CM_REJ_INVALID_RNR_RETRY] = "invalid rnr retry",
+ [IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID] = "duplicate local comm id",
+ [IB_CM_REJ_INVALID_CLASS_VERSION] = "invalid class version",
+ [IB_CM_REJ_INVALID_FLOW_LABEL] = "invalid flow label",
+ [IB_CM_REJ_INVALID_ALT_FLOW_LABEL] = "invalid alt flow label",
+};
+
+static const char * const iw_rej_reason_strs[] = {
+ [ECONNRESET] = "reset by remote host",
+ [ECONNREFUSED] = "refused by remote application",
+ [ETIMEDOUT] = "setup timeout",
+};
+
+const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
+ int reason)
+{
+ size_t index = reason;
+
+ if (rdma_ib_or_roce(id->device, id->port_num))
+ return (index < ARRAY_SIZE(ib_rej_reason_strs) &&
+ ib_rej_reason_strs[index]) ?
+ ib_rej_reason_strs[index] : "unrecognized reason";
+
+ if (rdma_protocol_iwarp(id->device, id->port_num)) {
+
+ /* iWARP uses negative errnos */
+ index = -index;
+ return (index < ARRAY_SIZE(iw_rej_reason_strs) &&
+ iw_rej_reason_strs[index]) ?
+ iw_rej_reason_strs[index] : "unrecognized reason";
+ }
+ return "unrecognized reason";
+}
+EXPORT_SYMBOL(rdma_reject_msg);
+
static void cma_add_one(struct ib_device *device);
static void cma_remove_one(struct ib_device *device, void *client_data);
diff --git a/include/rdma/rdma_cm.h b/include/rdma/rdma_cm.h
index 81fb1d1..712a70c 100644
--- a/include/rdma/rdma_cm.h
+++ b/include/rdma/rdma_cm.h
@@ -388,4 +388,12 @@ int rdma_set_afonly(struct rdma_cm_id *id, int afonly);
*/
__be64 rdma_get_service_id(struct rdma_cm_id *id, struct sockaddr *addr);
+/**
+ * rdma_reject_msg - return a pointer to a reject message string.
+ * @id: Communication identifier that received the REJECT event
+ * @reason: Value returned in the REJECT event status field.
+ */
+const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
+ int reason);
+
#endif /* RDMA_CM_H */
--
2.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* RE: [PATCH RFC] rdma_cm: add rdma_reject_msg() helper function
[not found] ` <20161020211652.35902E0C53-/5N3P9jjx0xzbRFIqnYvSA@public.gmane.org>
@ 2016-10-20 21:21 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB0A1CF9-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Hefty, Sean @ 2016-10-20 21:21 UTC (permalink / raw)
To: Steve Wise, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org
> drivers/infiniband/core/cma.c | 64
> +++++++++++++++++++++++++++++++++++++++++++
> include/rdma/rdma_cm.h | 8 ++++++
> 2 files changed, 72 insertions(+)
> +static const char * const ib_rej_reason_strs[] = {
> + [IB_CM_REJ_NO_QP] = "no qp",
> + [IB_CM_REJ_NO_EEC] = "no eec",
> + [IB_CM_REJ_NO_RESOURCES] = "no resources",
> + [IB_CM_REJ_TIMEOUT] = "timeout",
> + [IB_CM_REJ_UNSUPPORTED] = "unsupported",
> + [IB_CM_REJ_INVALID_COMM_ID] = "invalid comm id",
> + [IB_CM_REJ_INVALID_COMM_INSTANCE] = "invalid comm instance",
> + [IB_CM_REJ_INVALID_SERVICE_ID] = "invalid service id",
> + [IB_CM_REJ_INVALID_TRANSPORT_TYPE] = "invalid transport type",
> + [IB_CM_REJ_STALE_CONN] = "stale conn",
> + [IB_CM_REJ_RDC_NOT_EXIST] = "rdc not exist",
> + [IB_CM_REJ_INVALID_GID] = "invalid gid",
> + [IB_CM_REJ_INVALID_LID] = "invalid lid",
> + [IB_CM_REJ_INVALID_SL] = "invalid sl",
> + [IB_CM_REJ_INVALID_TRAFFIC_CLASS] = "invalid traffic class",
> + [IB_CM_REJ_INVALID_HOP_LIMIT] = "invalid hop limit",
> + [IB_CM_REJ_INVALID_PACKET_RATE] = "invalid packet
> rate",
> + [IB_CM_REJ_INVALID_ALT_GID] = "invalid alt gid",
> + [IB_CM_REJ_INVALID_ALT_LID] = "invalid alt lid",
> + [IB_CM_REJ_INVALID_ALT_SL] = "invalid alt sl",
> + [IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS] = "invalid alt traffic
> class",
> + [IB_CM_REJ_INVALID_ALT_HOP_LIMIT] = "invalid alt hop limit",
> + [IB_CM_REJ_INVALID_ALT_PACKET_RATE] = "invalid alt packet rate",
> + [IB_CM_REJ_PORT_CM_REDIRECT] = "port cm redirect",
> + [IB_CM_REJ_PORT_REDIRECT] = "port redirect",
> + [IB_CM_REJ_INVALID_MTU] = "invalid mtu",
> + [IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES] = "insufficient resp
> resources",
> + [IB_CM_REJ_CONSUMER_DEFINED] = "consumer defined",
> + [IB_CM_REJ_INVALID_RNR_RETRY] = "invalid rnr retry",
> + [IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID] = "duplicate local comm id",
> + [IB_CM_REJ_INVALID_CLASS_VERSION] = "invalid class version",
> + [IB_CM_REJ_INVALID_FLOW_LABEL] = "invalid flow label",
> + [IB_CM_REJ_INVALID_ALT_FLOW_LABEL] = "invalid alt flow label",
> +};
This would be better placed as part of the ib_cm.
> +
> +static const char * const iw_rej_reason_strs[] = {
> + [ECONNRESET] = "reset by remote host",
> + [ECONNREFUSED] = "refused by remote application",
> + [ETIMEDOUT] = "setup timeout",
> +};
Same with iw_cm.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH RFC] rdma_cm: add rdma_reject_msg() helper function
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB0A1CF9-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2016-10-20 21:23 ` Steve Wise
2016-10-20 21:25 ` Hefty, Sean
0 siblings, 1 reply; 5+ messages in thread
From: Steve Wise @ 2016-10-20 21:23 UTC (permalink / raw)
To: 'Hefty, Sean', dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ
>
>
> > +static const char * const ib_rej_reason_strs[] = {
> > + [IB_CM_REJ_NO_QP] = "no qp",
> > + [IB_CM_REJ_NO_EEC] = "no eec",
> > + [IB_CM_REJ_NO_RESOURCES] = "no resources",
> > + [IB_CM_REJ_TIMEOUT] = "timeout",
> > + [IB_CM_REJ_UNSUPPORTED] = "unsupported",
> > + [IB_CM_REJ_INVALID_COMM_ID] = "invalid comm id",
> > + [IB_CM_REJ_INVALID_COMM_INSTANCE] = "invalid comm instance",
> > + [IB_CM_REJ_INVALID_SERVICE_ID] = "invalid service id",
> > + [IB_CM_REJ_INVALID_TRANSPORT_TYPE] = "invalid transport type",
> > + [IB_CM_REJ_STALE_CONN] = "stale conn",
> > + [IB_CM_REJ_RDC_NOT_EXIST] = "rdc not exist",
> > + [IB_CM_REJ_INVALID_GID] = "invalid gid",
> > + [IB_CM_REJ_INVALID_LID] = "invalid lid",
> > + [IB_CM_REJ_INVALID_SL] = "invalid sl",
> > + [IB_CM_REJ_INVALID_TRAFFIC_CLASS] = "invalid traffic class",
> > + [IB_CM_REJ_INVALID_HOP_LIMIT] = "invalid hop limit",
> > + [IB_CM_REJ_INVALID_PACKET_RATE] = "invalid packet
> > rate",
> > + [IB_CM_REJ_INVALID_ALT_GID] = "invalid alt gid",
> > + [IB_CM_REJ_INVALID_ALT_LID] = "invalid alt lid",
> > + [IB_CM_REJ_INVALID_ALT_SL] = "invalid alt sl",
> > + [IB_CM_REJ_INVALID_ALT_TRAFFIC_CLASS] = "invalid alt traffic
> > class",
> > + [IB_CM_REJ_INVALID_ALT_HOP_LIMIT] = "invalid alt hop limit",
> > + [IB_CM_REJ_INVALID_ALT_PACKET_RATE] = "invalid alt packet rate",
> > + [IB_CM_REJ_PORT_CM_REDIRECT] = "port cm redirect",
> > + [IB_CM_REJ_PORT_REDIRECT] = "port redirect",
> > + [IB_CM_REJ_INVALID_MTU] = "invalid mtu",
> > + [IB_CM_REJ_INSUFFICIENT_RESP_RESOURCES] = "insufficient resp
> > resources",
> > + [IB_CM_REJ_CONSUMER_DEFINED] = "consumer defined",
> > + [IB_CM_REJ_INVALID_RNR_RETRY] = "invalid rnr retry",
> > + [IB_CM_REJ_DUPLICATE_LOCAL_COMM_ID] = "duplicate local comm
> id",
> > + [IB_CM_REJ_INVALID_CLASS_VERSION] = "invalid class version",
> > + [IB_CM_REJ_INVALID_FLOW_LABEL] = "invalid flow label",
> > + [IB_CM_REJ_INVALID_ALT_FLOW_LABEL] = "invalid alt flow label",
> > +};
>
> This would be better placed as part of the ib_cm.
>
> > +
> > +static const char * const iw_rej_reason_strs[] = {
> > + [ECONNRESET] = "reset by remote host",
> > + [ECONNREFUSED] = "refused by remote application",
> > + [ETIMEDOUT] = "setup timeout",
> > +};
>
> Same with iw_cm.
Hey Sean, I can do that. I thought perhaps it was better to keep it static in
cma.c, rather than having to extern them. But I'll make that change.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH RFC] rdma_cm: add rdma_reject_msg() helper function
2016-10-20 21:23 ` Steve Wise
@ 2016-10-20 21:25 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB0A1D24-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Hefty, Sean @ 2016-10-20 21:25 UTC (permalink / raw)
To: Steve Wise, dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org
> Hey Sean, I can do that. I thought perhaps it was better to keep it
> static in
> cma.c, rather than having to extern them. But I'll make that change.
You could make them static to the ib/iw cm and export reject_msg() helper routines from there.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH RFC] rdma_cm: add rdma_reject_msg() helper function
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB0A1D24-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
@ 2016-10-20 21:28 ` Steve Wise
0 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2016-10-20 21:28 UTC (permalink / raw)
To: 'Hefty, Sean', dledford-H+wXaHxf7aLQT0dZR+AlfA
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA,
bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ
>
> > Hey Sean, I can do that. I thought perhaps it was better to keep it
> > static in
> > cma.c, rather than having to extern them. But I'll make that change.
>
> You could make them static to the ib/iw cm and export reject_msg() helper
routines
> from there.
Yea ok. So rdma_reject_msg() calls ib_reject_msg() or iw_reject_msg()...
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-20 21:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-20 21:12 [PATCH RFC] rdma_cm: add rdma_reject_msg() helper function Steve Wise
[not found] ` <20161020211652.35902E0C53-/5N3P9jjx0xzbRFIqnYvSA@public.gmane.org>
2016-10-20 21:21 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB0A1CF9-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-10-20 21:23 ` Steve Wise
2016-10-20 21:25 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB0A1D24-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2016-10-20 21:28 ` Steve Wise
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).