[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-can
Subject:    Re: J1939 packet stuffing
From:       Kurt Van Dijck <dev.kurt () vandijck-laurijssen ! be>
Date:       2014-04-23 12:21:48
Message-ID: 20140423122148.GA1860 () vandijck-laurijssen ! be
[Download RAW message or body]

Hey Swapnil,

On Wed, Apr 23, 2014 at 02:58:27AM +0000, swapnil wrote:
> 
> Hi Kurt,
>     1.For time being i am doing change in user space as i need to start 
> testing for multiple(example 6 ECU ) ECU connected on J1939.
>     Once it et update in the can-j1939 module i will update it.

Modifying userspace means adjusting the dlc, which I think may not ideal
for transport protocol.
Hence, I understand your situation, therefore please find below a
quick fix proposal, similar to the interpacket delay insertion earlier.

This patch will stuff _all_ CAN frames with 0xff up to 8 bytes.
This conforms more strictly to the spec

>   
>     2.Yes,the packet stuffing issue occurred with every ecu that i have 
> tested .. These all ECU from same manufacturer used in US

I see. They all originate from the same programmer.
Well, that's a strict programmer.

--
diff --git a/net/can/j1939/main.c b/net/can/j1939/main.c
index 7edf843..1479de4 100644
--- a/net/can/j1939/main.c
+++ b/net/can/j1939/main.c
@@ -156,7 +156,9 @@ static int j1939_send_can(struct sk_buff *skb)
 		canid |= ((sk_addr->pgn & 0x3ffff) << 8);
 
 	msg->can_id = canid;
-	msg->can_dlc = dlc;
+	if (dlc < 8)
+		memset(msg->data+dlc, 0xff, 8 - dlc);
+	msg->can_dlc = 8;
 
 	/* set net_device */
 	ret = -ENODEV;
--
To unsubscribe from this list: send the line "unsubscribe linux-can" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic