On Tue, Sep 24, 2019 at 1:05 AM Bart Van Assche <bvanassche@xxxxxxx> wrote: > > On 6/20/19 8:03 AM, Jack Wang wrote: > > +static inline const char *ibtrs_clt_state_str(enum ibtrs_clt_state state) > > +{ > > + switch (state) { > > + case IBTRS_CLT_CONNECTING: > > + return "IBTRS_CLT_CONNECTING"; > > + case IBTRS_CLT_CONNECTING_ERR: > > + return "IBTRS_CLT_CONNECTING_ERR"; > > + case IBTRS_CLT_RECONNECTING: > > + return "IBTRS_CLT_RECONNECTING"; > > + case IBTRS_CLT_CONNECTED: > > + return "IBTRS_CLT_CONNECTED"; > > + case IBTRS_CLT_CLOSING: > > + return "IBTRS_CLT_CLOSING"; > > + case IBTRS_CLT_CLOSED: > > + return "IBTRS_CLT_CLOSED"; > > + case IBTRS_CLT_DEAD: > > + return "IBTRS_CLT_DEAD"; > > + default: > > + return "UNKNOWN"; > > + } > > +} > > Since this code is not in the hot path, please move it from a .h into a > .c file. ok. > > > +static inline struct ibtrs_clt_con *to_clt_con(struct ibtrs_con *c) > > +{ > > + return container_of(c, struct ibtrs_clt_con, c); > > +} > > + > > +static inline struct ibtrs_clt_sess *to_clt_sess(struct ibtrs_sess *s) > > +{ > > + return container_of(s, struct ibtrs_clt_sess, s); > > +} > > Is it really useful to define functions for these conversions? Has it > been considered to inline these functions? We use them quite some places, it does make the code shorter. Thanks Jinpu Wang