Skip to content

Commit 924bae3

Browse files
zhangjian3032NipaLocal
authored and
NipaLocal
committed
mctp i2c: notify user space on TX failure
Currently, there is no error handling mechanism for TX failures, causing user space to remain unaware of these failures until a timeout occurs. This leads to unnecessary waiting and delays. This update sends an immediate error notification to user space upon TX failure, reducing wait times and improving response handling for failed tx. Signed-off-by: Jian Zhang <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 65b483b commit 924bae3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/mctp/mctp-i2c.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ static void mctp_i2c_xmit(struct mctp_i2c_dev *midev, struct sk_buff *skb)
485485
struct mctp_i2c_hdr *hdr;
486486
struct i2c_msg msg = {0};
487487
u8 *pecp;
488+
struct sock *sk;
488489
int rc;
489490

490491
fs = mctp_i2c_get_tx_flow_state(midev, skb);
@@ -551,6 +552,14 @@ static void mctp_i2c_xmit(struct mctp_i2c_dev *midev, struct sk_buff *skb)
551552
dev_warn_ratelimited(&midev->adapter->dev,
552553
"__i2c_transfer failed %d\n", rc);
553554
stats->tx_errors++;
555+
556+
sk = skb->sk;
557+
if (sk) {
558+
sk->sk_err = -rc;
559+
if (!sock_flag(sk, SOCK_DEAD))
560+
sk_error_report(sk);
561+
}
562+
554563
} else {
555564
stats->tx_bytes += skb->len;
556565
stats->tx_packets++;

0 commit comments

Comments
 (0)