From: swise@opengridcomputing.com (Steve Wise)
Subject: [PATCH v3 1/6] rdma_cm: add rdma_reject_msg() helper function
Date: Tue, 25 Oct 2016 13:18:06 -0500 [thread overview]
Message-ID: <014501d22eec$22408920$66c19b60$@opengridcomputing.com> (raw)
In-Reply-To: <93f8b8f8-51f5-a595-c9ad-0b3e22789636@sandisk.com>
> -----Original Message-----
> From: Bart Van Assche [mailto:bart.vanassche at sandisk.com]
> Sent: Tuesday, October 25, 2016 12:58 PM
> To: Steve Wise; dledford at redhat.com; sean.hefty at intel.com
> Cc: linux-rdma at vger.kernel.org; linux-nvme at lists.infradead.org;
> sagi at grimberg.me; hch at lst.de; axboe at fb.com; santosh.shilimkar at oracle.com
> Subject: Re: [PATCH v3 1/6] rdma_cm: add rdma_reject_msg() helper function
>
> On 10/24/2016 12:09 PM, Steve Wise wrote:
> > + [IB_CM_REJ_RDC_NOT_EXIST] = "rdc not exist",
>
> Please change this into "RDC does not exist".
>
ok
> > + [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",
>
> Other error messages capitalize GID, LID, CM, ID, RNR and SL so please
> do this here too.
>
ok
> > +const char *__attribute_const__ ibcm_reject_msg(int reason)
> > +{
> > + size_t index = reason;
> > +
> > + if (index >= ARRAY_SIZE(ibcm_rej_reason_strs) ||
> > + !ibcm_rej_reason_strs[index])
> > + return "unrecognized reason";
> > + else
> > + return ibcm_rej_reason_strs[index];
> > +}
>
> Please consider using positive logic - this means negating the
> if-condition and swapping the if- and else-parts.
yea that might be even clearer.
>
> > +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
> > + int reason)
> > +{
> > + if (rdma_ib_or_roce(id->device, id->port_num))
> > + return ibcm_reject_msg(reason);
> > +
> > + if (rdma_protocol_iwarp(id->device, id->port_num))
> > + return iwcm_reject_msg(reason);
> > +
> > + WARN_ON_ONCE(1);
> > + return "unrecognized reason";
>
> Have you considered to return "unrecognized transport" here instead?
>
I can do that.
> > +const char *__attribute_const__ iwcm_reject_msg(int reason)
> > +{
> > + size_t index;
> > +
> > + /* iWARP uses negative errnos */
> > + index = -reason;
> > +
> > + if (index >= ARRAY_SIZE(iwcm_rej_reason_strs) ||
> > + !iwcm_rej_reason_strs[index])
> > + return "unrecognized reason";
> > + else
> > + return iwcm_rej_reason_strs[index];
> > +}
>
> Also for this function, please consider using positive logic.
>
> Thanks,
>
> Bart.
WARNING: multiple messages have this Message-ID (diff)
From: "Steve Wise" <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
To: 'Bart Van Assche'
<bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>,
dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org,
sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org,
hch-jcswGhMUV9g@public.gmane.org,
axboe-b10kYP2dOMg@public.gmane.org,
santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
Subject: RE: [PATCH v3 1/6] rdma_cm: add rdma_reject_msg() helper function
Date: Tue, 25 Oct 2016 13:18:06 -0500 [thread overview]
Message-ID: <014501d22eec$22408920$66c19b60$@opengridcomputing.com> (raw)
In-Reply-To: <93f8b8f8-51f5-a595-c9ad-0b3e22789636-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
> -----Original Message-----
> From: Bart Van Assche [mailto:bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org]
> Sent: Tuesday, October 25, 2016 12:58 PM
> To: Steve Wise; dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org
> Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; linux-nvme-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org;
> sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org; hch-jcswGhMUV9g@public.gmane.org; axboe-b10kYP2dOMg@public.gmane.org; santosh.shilimkar-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org
> Subject: Re: [PATCH v3 1/6] rdma_cm: add rdma_reject_msg() helper function
>
> On 10/24/2016 12:09 PM, Steve Wise wrote:
> > + [IB_CM_REJ_RDC_NOT_EXIST] = "rdc not exist",
>
> Please change this into "RDC does not exist".
>
ok
> > + [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",
>
> Other error messages capitalize GID, LID, CM, ID, RNR and SL so please
> do this here too.
>
ok
> > +const char *__attribute_const__ ibcm_reject_msg(int reason)
> > +{
> > + size_t index = reason;
> > +
> > + if (index >= ARRAY_SIZE(ibcm_rej_reason_strs) ||
> > + !ibcm_rej_reason_strs[index])
> > + return "unrecognized reason";
> > + else
> > + return ibcm_rej_reason_strs[index];
> > +}
>
> Please consider using positive logic - this means negating the
> if-condition and swapping the if- and else-parts.
yea that might be even clearer.
>
> > +const char *__attribute_const__ rdma_reject_msg(struct rdma_cm_id *id,
> > + int reason)
> > +{
> > + if (rdma_ib_or_roce(id->device, id->port_num))
> > + return ibcm_reject_msg(reason);
> > +
> > + if (rdma_protocol_iwarp(id->device, id->port_num))
> > + return iwcm_reject_msg(reason);
> > +
> > + WARN_ON_ONCE(1);
> > + return "unrecognized reason";
>
> Have you considered to return "unrecognized transport" here instead?
>
I can do that.
> > +const char *__attribute_const__ iwcm_reject_msg(int reason)
> > +{
> > + size_t index;
> > +
> > + /* iWARP uses negative errnos */
> > + index = -reason;
> > +
> > + if (index >= ARRAY_SIZE(iwcm_rej_reason_strs) ||
> > + !iwcm_rej_reason_strs[index])
> > + return "unrecognized reason";
> > + else
> > + return iwcm_rej_reason_strs[index];
> > +}
>
> Also for this function, please consider using positive logic.
>
> Thanks,
>
> Bart.
--
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
next prev parent reply other threads:[~2016-10-25 18:18 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-24 19:07 [PATCH v3 0/6] connect reject event helpers Steve Wise
2016-10-24 19:07 ` Steve Wise
2016-10-24 18:59 ` [PATCH v3 2/6] rdma_cm: add rdma_is_consumer_reject() helper function Steve Wise
2016-10-24 18:59 ` Steve Wise
2016-10-25 16:36 ` Sagi Grimberg
2016-10-25 16:36 ` Sagi Grimberg
2016-10-25 17:00 ` Christoph Hellwig
2016-10-25 17:00 ` Christoph Hellwig
2016-10-24 18:59 ` [PATCH v3 1/6] rdma_cm: add rdma_reject_msg() " Steve Wise
2016-10-24 18:59 ` Steve Wise
2016-10-25 16:37 ` Sagi Grimberg
2016-10-25 16:37 ` Sagi Grimberg
2016-10-25 17:00 ` Christoph Hellwig
2016-10-25 17:00 ` Christoph Hellwig
2016-10-25 17:58 ` Bart Van Assche
2016-10-25 17:58 ` Bart Van Assche
2016-10-25 18:18 ` Steve Wise [this message]
2016-10-25 18:18 ` Steve Wise
2016-10-24 18:59 ` [PATCH v3 3/6] rdma_cm: add rdma_consumer_reject_data " Steve Wise
2016-10-24 18:59 ` Steve Wise
2016-10-25 16:36 ` Sagi Grimberg
2016-10-25 16:36 ` Sagi Grimberg
2016-10-25 17:01 ` Christoph Hellwig
2016-10-25 17:01 ` Christoph Hellwig
2016-10-24 19:07 ` [PATCH v3 4/6] nvme-rdma: use rdma connection reject helper functions Steve Wise
2016-10-24 19:07 ` Steve Wise
2016-10-25 16:36 ` Sagi Grimberg
2016-10-25 16:36 ` Sagi Grimberg
2016-10-25 16:58 ` Steve Wise
2016-10-25 16:58 ` Steve Wise
2016-10-25 17:02 ` Christoph Hellwig
2016-10-25 17:02 ` Christoph Hellwig
2016-10-25 17:04 ` Sagi Grimberg
2016-10-25 17:04 ` Sagi Grimberg
2016-10-25 17:01 ` Christoph Hellwig
2016-10-25 17:01 ` Christoph Hellwig
2016-10-25 18:05 ` Bart Van Assche
2016-10-25 18:05 ` Bart Van Assche
2016-10-25 18:20 ` Steve Wise
2016-10-25 18:20 ` Steve Wise
2016-10-25 18:25 ` Bart Van Assche
2016-10-25 18:25 ` Bart Van Assche
2016-10-24 19:07 ` [PATCH v3 5/6] ib_iser: log the connection reject message Steve Wise
2016-10-24 19:07 ` Steve Wise
2016-10-25 16:34 ` Sagi Grimberg
2016-10-25 16:34 ` Sagi Grimberg
2016-10-24 19:07 ` [PATCH v3 6/6] rds_rdma: " Steve Wise
2016-10-24 19:07 ` Steve Wise
2016-10-25 15:51 ` Santosh Shilimkar
2016-10-25 15:51 ` Santosh Shilimkar
2016-10-25 16:04 ` Steve Wise
2016-10-25 16:04 ` Steve Wise
2016-10-25 16:11 ` Santosh Shilimkar
2016-10-25 16:11 ` Santosh Shilimkar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='014501d22eec$22408920$66c19b60$@opengridcomputing.com' \
--to=swise@opengridcomputing.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.