[PATCH v1 02/17] j1939: transport: do not send packets from j1939_tp_send

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

 



I case the transmit queue is full, we will fail complete
session without retrying it again.
With this patch we will be able to handle it and unify the
code and error paths.

Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
---
 net/can/j1939/transport.c | 20 ++++----------------
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/net/can/j1939/transport.c b/net/can/j1939/transport.c
index 4320804062eb..e47eff502b6f 100644
--- a/net/can/j1939/transport.c
+++ b/net/can/j1939/transport.c
@@ -1401,17 +1401,6 @@ static void j1939_xtp_rx_dat(struct j1939_priv *priv, struct sk_buff *skb)
 	j1939_session_put(session);
 }
 
-static inline int j1939_tp_tx_initial(struct j1939_session *session)
-{
-	int ret;
-
-	ret = j1939_tp_txnext(session);
-	/* set nonblocking for further packets */
-	session->skcb.msg_flags |= MSG_DONTWAIT;
-
-	return ret;
-}
-
 /* j1939 main intf */
 struct j1939_session *j1939_tp_send(struct j1939_priv *priv,
 				    struct sk_buff *skb, size_t size)
@@ -1478,12 +1467,11 @@ struct j1939_session *j1939_tp_send(struct j1939_priv *priv,
 	if (ret < 0)
 		goto failed;
 
-	ret = j1939_tp_tx_initial(session);
-	if (ret)
-		goto failed;
-
-	/* transmission started */
 	session->tskey = session->sk->sk_tskey++;
+	session->skcb.msg_flags |= MSG_DONTWAIT;
+	/* transmission started */
+	j1939_tp_schedule_txtimer(session, 0);
+
 	return session;
 
  failed:
-- 
2.20.1




[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