diff mbox series

[net] net: dsa: hellcreek: Allow PTP on blocked ports

Message ID 20211213101810.121553-1-kurt@linutronix.de (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net] net: dsa: hellcreek: Allow PTP on blocked ports | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch warning WARNING: quoted string split across lines
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Kurt Kanzenbach Dec. 13, 2021, 10:18 a.m. UTC
PTP forms its own clock distribution tree. Therefore, PTP traffic is allowed to
traverse blocked ports by STP. Adjust the static FDB entries accordingly.

Fixes: ddd56dfe52c9 ("net: dsa: hellcreek: Add PTP clock support")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
---
 drivers/net/dsa/hirschmann/hellcreek.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

Comments

Richard Cochran Dec. 13, 2021, 12:14 p.m. UTC | #1
On Mon, Dec 13, 2021 at 11:18:10AM +0100, Kurt Kanzenbach wrote:

> @@ -1055,7 +1058,7 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
>  		.portmask     = 0x03,	/* Management ports */
>  		.age	      = 0,
>  		.is_obt	      = 0,
> -		.pass_blocked = 0,
> +		.pass_blocked = 1,

This one should stay blocked.

>  		.is_static    = 1,
>  		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
>  		.reprio_en    = 1,
> @@ -1066,7 +1069,7 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
>  		.portmask     = 0x03,	/* Management ports */
>  		.age	      = 0,
>  		.is_obt	      = 0,
> -		.pass_blocked = 0,
> +		.pass_blocked = 1,

This one is okay.

>  		.is_static    = 1,
>  		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
>  		.reprio_en    = 1,
> -- 
> 2.30.2
> 

Thanks,
Richard
Kurt Kanzenbach Dec. 14, 2021, 8:13 a.m. UTC | #2
Hi Richard,

On Mon Dec 13 2021, Richard Cochran wrote:
> On Mon, Dec 13, 2021 at 11:18:10AM +0100, Kurt Kanzenbach wrote:
>
>> @@ -1055,7 +1058,7 @@ static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
>>  		.portmask     = 0x03,	/* Management ports */
>>  		.age	      = 0,
>>  		.is_obt	      = 0,
>> -		.pass_blocked = 0,
>> +		.pass_blocked = 1,
>
> This one should stay blocked.

You're right. I confirmed with Hirschmann. Only peer delay measurements
should be allowed on blocked ports. In addition, we also have to add
static entries for STP with pass_blocked bit set. Furthermore, the UDP
entries are missing as well. Currently it only works for 802.1AS even
though the driver happily announces V2_EVENT capability.

I'll clean it up and resend properly.

Thanks,
Kurt
diff mbox series

Patch

diff --git a/drivers/net/dsa/hirschmann/hellcreek.c b/drivers/net/dsa/hirschmann/hellcreek.c
index 4e0b53d94b52..072fc442cde2 100644
--- a/drivers/net/dsa/hirschmann/hellcreek.c
+++ b/drivers/net/dsa/hirschmann/hellcreek.c
@@ -710,8 +710,9 @@  static int __hellcreek_fdb_add(struct hellcreek *hellcreek,
 	u16 meta = 0;
 
 	dev_dbg(hellcreek->dev, "Add static FDB entry: MAC=%pM, MASK=0x%02x, "
-		"OBT=%d, REPRIO_EN=%d, PRIO=%d\n", entry->mac, entry->portmask,
-		entry->is_obt, entry->reprio_en, entry->reprio_tc);
+		"OBT=%d, PASS_BLOCKED=%d, REPRIO_EN=%d, PRIO=%d\n", entry->mac,
+		entry->portmask, entry->is_obt, entry->pass_blocked,
+		entry->reprio_en, entry->reprio_tc);
 
 	/* Add mac address */
 	hellcreek_write(hellcreek, entry->mac[1] | (entry->mac[0] << 8), HR_FDBWDH);
@@ -722,6 +723,8 @@  static int __hellcreek_fdb_add(struct hellcreek *hellcreek,
 	meta |= entry->portmask << HR_FDBWRM0_PORTMASK_SHIFT;
 	if (entry->is_obt)
 		meta |= HR_FDBWRM0_OBT;
+	if (entry->pass_blocked)
+		meta |= HR_FDBWRM0_PASS_BLOCKED;
 	if (entry->reprio_en) {
 		meta |= HR_FDBWRM0_REPRIO_EN;
 		meta |= entry->reprio_tc << HR_FDBWRM0_REPRIO_TC_SHIFT;
@@ -1055,7 +1058,7 @@  static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 		.portmask     = 0x03,	/* Management ports */
 		.age	      = 0,
 		.is_obt	      = 0,
-		.pass_blocked = 0,
+		.pass_blocked = 1,
 		.is_static    = 1,
 		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
 		.reprio_en    = 1,
@@ -1066,7 +1069,7 @@  static int hellcreek_setup_fdb(struct hellcreek *hellcreek)
 		.portmask     = 0x03,	/* Management ports */
 		.age	      = 0,
 		.is_obt	      = 0,
-		.pass_blocked = 0,
+		.pass_blocked = 1,
 		.is_static    = 1,
 		.reprio_tc    = 6,	/* TC: 6 as per IEEE 802.1AS */
 		.reprio_en    = 1,