Skip to content

Commit 0bfe711

Browse files
hartkoppkuba-moo
authored andcommitted
can: isotp: fix support for transmission of SF without flow control
The original implementation had a very simple handling for single frame transmissions as it just sent the single frame without a timeout handling. With the new echo frame handling the echo frame was also introduced for single frames but the former exception ('simple without timers') has been maintained by accident. This leads to a 1 second timeout when closing the socket and to an -ECOMM error when CAN_ISOTP_WAIT_TX_DONE is selected. As the echo handling is always active (also for single frames) remove the wrong extra condition for single frames. Fixes: 9f39d36 ("can: isotp: add support for transmission without flow control") Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net> Link: https://lore.kernel.org/r/20230821144547.6658-2-socketcan@hartkopp.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent bf23ffc commit 0bfe711

1 file changed

Lines changed: 7 additions & 15 deletions

File tree

net/can/isotp.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,6 @@ static bool isotp_register_rxid(struct isotp_sock *so)
188188
return (isotp_bc_flags(so) == 0);
189189
}
190190

191-
static bool isotp_register_txecho(struct isotp_sock *so)
192-
{
193-
/* all modes but SF_BROADCAST register for tx echo skbs */
194-
return (isotp_bc_flags(so) != CAN_ISOTP_SF_BROADCAST);
195-
}
196-
197191
static enum hrtimer_restart isotp_rx_timer_handler(struct hrtimer *hrtimer)
198192
{
199193
struct isotp_sock *so = container_of(hrtimer, struct isotp_sock,
@@ -1209,7 +1203,7 @@ static int isotp_release(struct socket *sock)
12091203
lock_sock(sk);
12101204

12111205
/* remove current filters & unregister */
1212-
if (so->bound && isotp_register_txecho(so)) {
1206+
if (so->bound) {
12131207
if (so->ifindex) {
12141208
struct net_device *dev;
12151209

@@ -1332,14 +1326,12 @@ static int isotp_bind(struct socket *sock, struct sockaddr *uaddr, int len)
13321326
can_rx_register(net, dev, rx_id, SINGLE_MASK(rx_id),
13331327
isotp_rcv, sk, "isotp", sk);
13341328

1335-
if (isotp_register_txecho(so)) {
1336-
/* no consecutive frame echo skb in flight */
1337-
so->cfecho = 0;
1329+
/* no consecutive frame echo skb in flight */
1330+
so->cfecho = 0;
13381331

1339-
/* register for echo skb's */
1340-
can_rx_register(net, dev, tx_id, SINGLE_MASK(tx_id),
1341-
isotp_rcv_echo, sk, "isotpe", sk);
1342-
}
1332+
/* register for echo skb's */
1333+
can_rx_register(net, dev, tx_id, SINGLE_MASK(tx_id),
1334+
isotp_rcv_echo, sk, "isotpe", sk);
13431335

13441336
dev_put(dev);
13451337

@@ -1560,7 +1552,7 @@ static void isotp_notify(struct isotp_sock *so, unsigned long msg,
15601552
case NETDEV_UNREGISTER:
15611553
lock_sock(sk);
15621554
/* remove current filters & unregister */
1563-
if (so->bound && isotp_register_txecho(so)) {
1555+
if (so->bound) {
15641556
if (isotp_register_rxid(so))
15651557
can_rx_unregister(dev_net(dev), dev, so->rxid,
15661558
SINGLE_MASK(so->rxid),

0 commit comments

Comments
 (0)