[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241113190920.0ceaddf2@kernel.org>
Date: Wed, 13 Nov 2024 19:09:20 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Jian Zhang <zhangjian.3032@...edance.com>
Cc: netdev@...r.kernel.org, openbmc@...ts.ozlabs.org, Jeremy Kerr
<jk@...econstruct.com.au>, Matt Johnston <matt@...econstruct.com.au>,
"David S. Miller" <davem@...emloft.net>, Eric Dumazet
<edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
linux-kernel@...r.kernel.org (open list)
Subject: Re: [PATCH net-next] mctp i2c: notify user space on TX failure
On Fri, 8 Nov 2024 17:42:06 +0800 Jian Zhang wrote:
> diff --git a/drivers/net/mctp/mctp-i2c.c b/drivers/net/mctp/mctp-i2c.c
> index 4dc057c121f5..e9a835606dfc 100644
> --- a/drivers/net/mctp/mctp-i2c.c
> +++ b/drivers/net/mctp/mctp-i2c.c
> @@ -485,6 +485,7 @@ static void mctp_i2c_xmit(struct mctp_i2c_dev *midev, struct sk_buff *skb)
> struct mctp_i2c_hdr *hdr;
> struct i2c_msg msg = {0};
> u8 *pecp;
> + struct sock *sk;
> int rc;
>
nit: order the variable declaration lines longest to shortest
> @@ -551,6 +552,14 @@ static void mctp_i2c_xmit(struct mctp_i2c_dev *midev, struct sk_buff *skb)
> dev_warn_ratelimited(&midev->adapter->dev,
> "__i2c_transfer failed %d\n", rc);
> stats->tx_errors++;
> +
> + sk = skb->sk;
> + if (sk) {
> + sk->sk_err = -rc;
> + if (!sock_flag(sk, SOCK_DEAD))
> + sk_error_report(sk);
> + }
notifying socket in the xmit handler of a netdev is a bit strange,
could you do it somewhere higher in the MCTP stack?
--
pw-bot: cr
Powered by blists - more mailing lists