Skip to content

Commit 5908520

Browse files
vladimirolteandavem330
authored andcommitted
net: mscc: ocelot: fix all IP traffic getting trapped to CPU with PTP over IP
The filters for the PTP trap keys are incorrectly configured, in the sense that is2_entry_set() only looks at trap->key.ipv4.dport or trap->key.ipv6.dport if trap->key.ipv4.proto or trap->key.ipv6.proto is set to IPPROTO_TCP or IPPROTO_UDP. But we don't do that, so is2_entry_set() goes through the "else" branch of the IP protocol check, and ends up installing a rule for "Any IP protocol match" (because msk is also 0). The UDP port is ignored. This means that when we run "ptp4l -i swp0 -4", all IP traffic is trapped to the CPU, which hinders bridging. Fix this by specifying the IP protocol in the VCAP IS2 filters for PTP over UDP. Fixes: 96ca08c ("net: mscc: ocelot: set up traps for PTP packets") Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent f8d9d93 commit 5908520

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,8 @@ static void
14321432
ocelot_populate_ipv4_ptp_event_trap_key(struct ocelot_vcap_filter *trap)
14331433
{
14341434
trap->key_type = OCELOT_VCAP_KEY_IPV4;
1435+
trap->key.ipv4.proto.value[0] = IPPROTO_UDP;
1436+
trap->key.ipv4.proto.mask[0] = 0xff;
14351437
trap->key.ipv4.dport.value = PTP_EV_PORT;
14361438
trap->key.ipv4.dport.mask = 0xffff;
14371439
}
@@ -1440,6 +1442,8 @@ static void
14401442
ocelot_populate_ipv6_ptp_event_trap_key(struct ocelot_vcap_filter *trap)
14411443
{
14421444
trap->key_type = OCELOT_VCAP_KEY_IPV6;
1445+
trap->key.ipv4.proto.value[0] = IPPROTO_UDP;
1446+
trap->key.ipv4.proto.mask[0] = 0xff;
14431447
trap->key.ipv6.dport.value = PTP_EV_PORT;
14441448
trap->key.ipv6.dport.mask = 0xffff;
14451449
}
@@ -1448,6 +1452,8 @@ static void
14481452
ocelot_populate_ipv4_ptp_general_trap_key(struct ocelot_vcap_filter *trap)
14491453
{
14501454
trap->key_type = OCELOT_VCAP_KEY_IPV4;
1455+
trap->key.ipv4.proto.value[0] = IPPROTO_UDP;
1456+
trap->key.ipv4.proto.mask[0] = 0xff;
14511457
trap->key.ipv4.dport.value = PTP_GEN_PORT;
14521458
trap->key.ipv4.dport.mask = 0xffff;
14531459
}
@@ -1456,6 +1462,8 @@ static void
14561462
ocelot_populate_ipv6_ptp_general_trap_key(struct ocelot_vcap_filter *trap)
14571463
{
14581464
trap->key_type = OCELOT_VCAP_KEY_IPV6;
1465+
trap->key.ipv4.proto.value[0] = IPPROTO_UDP;
1466+
trap->key.ipv4.proto.mask[0] = 0xff;
14591467
trap->key.ipv6.dport.value = PTP_GEN_PORT;
14601468
trap->key.ipv6.dport.mask = 0xffff;
14611469
}

0 commit comments

Comments
 (0)