Skip to contentSkip to conversation

Join CAN filters with CAN_RAW_JOIN_FILTERS sockopt is ready for testing

RFC Oliver Hartkopp 2 participants 4 messages Mar 17, 2015 – Mar 18, 2015 CAN network drivers

lore
Share & tools
lore
#0 lore raw

Hi all,

as discussed today I posted the patches to "fix the long standing bug" of getting duplicate CAN frames when having overlapping filters.

The second patch (and the candump patch) is to test the functionality to implement joined filters which provides a logical AND for the given filters.

Happy testing - feedback is welcome!

Regards,
Oliver

#1 lore raw

Here some tests with the V2 version:

Current mainline (no modifications)

$ candump vcan0,0:0,0:0
  vcan0  1C8   [8]  5C FE CC 4C E9 4F 4A 21
  vcan0  1C8   [8]  5C FE CC 4C E9 4F 4A 21
  vcan0  60D   [8]  BA 3B 6F 53 05 79 BE 4F
  vcan0  60D   [8]  BA 3B 6F 53 05 79 BE 4F
  vcan0  4BE   [8]  BF AA 6D 72 31 E0 E2 1C
  vcan0  4BE   [8]  BF AA 6D 72 31 E0 E2 1C
  vcan0  7DE   [7]  4A E0 8B 68 AC 6E 0F
  vcan0  7DE   [7]  4A E0 8B 68 AC 6E 0F

two filters for 'all' lead to two frames each.
(cangen vcan0 in separate terminal)

With patch1 (can: fix multiple delivery ...)

$ candump vcan0,0:0,0:0
  vcan0  78D   [8]  C0 71 65 56 23 16 95 6B
  vcan0  70E   [3]  01 D4 CC
  vcan0  749   [7]  A7 8D B3 43 75 C1 22
  vcan0  238   [2]  17 06
  vcan0  108   [4]  8C F7 79 03
  vcan0  190   [0]
  vcan0  25D   [1]  C2
  vcan0  4CE   [4]  6F 1A 50 38

eliminates the double reception.

Now testing patch2 (can: introduce new raw socket option ...) Using 'cangen vcan0 -I i -n 6 -L 0' in separate terminal.

Current mainline (no modifications)

$ candump vcan0,001~7FF,003~7FF,004~7FF
  vcan0  000   [0]
  vcan0  000   [0]
  vcan0  000   [0]
  vcan0  001   [0]
  vcan0  001   [0]
  vcan0  002   [0]
  vcan0  002   [0]
  vcan0  002   [0]
  vcan0  003   [0]
  vcan0  003   [0]
  vcan0  004   [0]
  vcan0  004   [0]
  vcan0  005   [0]
  vcan0  005   [0]
  vcan0  005   [0]

With patch1 and patch2 but no joined filters:

$ candump vcan0,001~7FF,003~7FF,004~7FF
  vcan0  000   [0]
  vcan0  001   [0]
  vcan0  002   [0]
  vcan0  003   [0]
  vcan0  004   [0]
  vcan0  005   [0]

With patch1 and patch2 with joined filters:

$ candump vcan0,001~7FF,003~7FF,004~7FF,J
  vcan0  000   [0]
  vcan0  002   [0]
  vcan0  005   [0]

Hey - that rocks!

Quoted 16 lines · Oliver Hartkopp

Hi all,

as discussed today I posted the patches to "fix the long standing bug" of getting duplicate CAN frames when having overlapping filters.

The second patch (and the candump patch) is to test the functionality to implement joined filters which provides a logical AND for the given filters.

Happy testing - feedback is welcome!

Regards,
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

Hello Oliver,

I have a question here.

The filter used with candump are software filters or actual can device filter registers are updated ?

Best Regards,
Pankaj

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Oliver Hartkopp
Sent: Wednesday, March 18, 2015 12:44 PM
To: [email protected]
Subject: Re: [RFC] Join CAN filters with CAN_RAW_JOIN_FILTERS sockopt is ready for testing

Here some tests with the V2 version:

Current mainline (no modifications)

$ candump vcan0,0:0,0:0
   vcan0  1C8   [8]  5C FE CC 4C E9 4F 4A 21
   vcan0  1C8   [8]  5C FE CC 4C E9 4F 4A 21
   vcan0  60D   [8]  BA 3B 6F 53 05 79 BE 4F
   vcan0  60D   [8]  BA 3B 6F 53 05 79 BE 4F
   vcan0  4BE   [8]  BF AA 6D 72 31 E0 E2 1C
   vcan0  4BE   [8]  BF AA 6D 72 31 E0 E2 1C
   vcan0  7DE   [7]  4A E0 8B 68 AC 6E 0F
   vcan0  7DE   [7]  4A E0 8B 68 AC 6E 0F

two filters for 'all' lead to two frames each.
(cangen vcan0 in separate terminal)

With patch1 (can: fix multiple delivery ...)

$ candump vcan0,0:0,0:0
   vcan0  78D   [8]  C0 71 65 56 23 16 95 6B
   vcan0  70E   [3]  01 D4 CC
   vcan0  749   [7]  A7 8D B3 43 75 C1 22
   vcan0  238   [2]  17 06
   vcan0  108   [4]  8C F7 79 03
   vcan0  190   [0]
   vcan0  25D   [1]  C2
   vcan0  4CE   [4]  6F 1A 50 38

eliminates the double reception.

Now testing patch2 (can: introduce new raw socket option ...) Using 'cangen vcan0 -I i -n 6 -L 0' in separate terminal.

Current mainline (no modifications)

$ candump vcan0,001~7FF,003~7FF,004~7FF
   vcan0  000   [0]
   vcan0  000   [0]
   vcan0  000   [0]
   vcan0  001   [0]
   vcan0  001   [0]
   vcan0  002   [0]
   vcan0  002   [0]
   vcan0  002   [0]
   vcan0  003   [0]
   vcan0  003   [0]
   vcan0  004   [0]
   vcan0  004   [0]
   vcan0  005   [0]
   vcan0  005   [0]
   vcan0  005   [0]

With patch1 and patch2 but no joined filters:

$ candump vcan0,001~7FF,003~7FF,004~7FF
   vcan0  000   [0]
   vcan0  001   [0]
   vcan0  002   [0]
   vcan0  003   [0]
   vcan0  004   [0]
   vcan0  005   [0]

With patch1 and patch2 with joined filters:

$ candump vcan0,001~7FF,003~7FF,004~7FF,J
   vcan0  000   [0]
   vcan0  002   [0]
   vcan0  005   [0]

Hey - that rocks!

Quoted 8 lines · Oliver Hartkopp

Hi all,

as discussed today I posted the patches to "fix the long standing bug" of getting duplicate CAN frames when having overlapping filters.

The second patch (and the candump patch) is to test the functionality to implement joined filters which provides a logical AND for the given filters.

Quoted 8 lines

Happy testing - feedback is welcome!

Regards,
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-can" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

Hello Pankaj

Quoted 4 lines · On 18.03.2015 08:48, Pankajkumar Misra (RBEI/EEA2) wrote:

I have a question here.

The filter used with candump are software filters or actual can device filter registers are updated ?

Yes. The CAN controllers are always operated without filters and all the filtering is done in the NET_RX softirq inside the Linux network layer.

See https://www.kernel.org/doc/Documentation/networking/can.txt Chapter 3.1

Regards,
Oliver