netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Jian Zhang <zhangjian.3032@bytedance.com>
Cc: netdev@vger.kernel.org, openbmc@lists.ozlabs.org,
	Jeremy Kerr <jk@codeconstruct.com.au>,
	Matt Johnston <matt@codeconstruct.com.au>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Paolo Abeni <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org (open list)
Subject: Re: [PATCH net-next] mctp i2c: notify user space on TX failure
Date: Wed, 13 Nov 2024 19:09:20 -0800	[thread overview]
Message-ID: <20241113190920.0ceaddf2@kernel.org> (raw)
In-Reply-To: <20241108094206.2808293-1-zhangjian.3032@bytedance.com>

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

  reply	other threads:[~2024-11-14  3:09 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-08  9:42 [PATCH net-next] mctp i2c: notify user space on TX failure Jian Zhang
2024-11-14  3:09 ` Jakub Kicinski [this message]
2024-11-14  3:13   ` Jeremy Kerr
2024-11-14  3:19     ` Jakub Kicinski
2024-11-14  6:48       ` Jeremy Kerr
2024-11-14 15:02         ` Jakub Kicinski
2024-11-15  8:30           ` Marc Kleine-Budde

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=20241113190920.0ceaddf2@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jk@codeconstruct.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeconstruct.com.au \
    --cc=netdev@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=pabeni@redhat.com \
    --cc=zhangjian.3032@bytedance.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 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).