Re: [PATCH] can-isotp: Add error message if txqueuelen is too small.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun. 26 Apr 2021 at 00:10, Patrick Menschel <menschel.p@xxxxxxxxx> wrote:
>
> This patch adds a comprehensive error message in
> case that txqueuelen is too small and the isotp
> driver encounters ENOBUFS (105), e.g.
> "no buffer space available" while it does
> enqueue its generated frames.
>
> Signed-off-by: Patrick Menschel <menschel.p@xxxxxxxxx>
> ---
>  net/can/isotp.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/net/can/isotp.c b/net/can/isotp.c
> index 9f94ad3ca..c50e238b0 100644
> --- a/net/can/isotp.c
> +++ b/net/can/isotp.c
> @@ -946,8 +946,17 @@ static int isotp_sendmsg(struct socket *sock, struct msghdr *msg, size_t size)
>         err = can_send(skb, 1);
>         dev_put(dev);
>         if (err) {
> -               pr_notice_once("can-isotp: %s: can_send_ret %d\n",
> -                              __func__, err);
> +               if (err == -ENOBUFS) {
> +                       /* if txqueuelen is not of sufficient length
> +                        * for this transfer
> +                        */
> +                       pr_notice_once("can-isotp: %s: can_send_ret %d : No buffer space available in tx queue\n",
> +                                      __func__, err);

Speaking of comprehensive error messages, it would be great to
print the mnemotechnic of the error code instead of its value:
|                       pr_notice_once("can-isotp: %s: can_send_ret
%pe : tx queue is full\n",
|                                      __func__, ERR_PTR(err));

> +               } else {
> +                       /* general error */
> +                       pr_notice_once("can-isotp: %s: can_send_ret %d\n",
> +                                      __func__, err);

Same here:
|                       pr_notice_once("can-isotp: %s: can_send_ret %pe\n",
|                                      __func__, ERR_PTR(err));

Yours sincerely,
Vincent



[Index of Archives]     [Automotive Discussions]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [CAN Bus]

  Powered by Linux