Skip to content

Commit 59e1be6

Browse files
Subbaraya SundeepPaolo Abeni
authored andcommitted
octeontx2-pf: Fix UDP/TCP src and dst port tc filters
Check the mask for non-zero value before installing tc filters for L4 source and destination ports. Otherwise installing a filter for source port installs destination port too and vice-versa. Fixes: 1d4d9e4 ("octeontx2-pf: Add tc flower hardware offload on ingress traffic") Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com> Signed-off-by: Sunil Goutham <sgoutham@marvell.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent b354eae commit 59e1be6

File tree

1 file changed

+18
-12
lines changed
  • drivers/net/ethernet/marvell/octeontx2/nic

1 file changed

+18
-12
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -648,21 +648,27 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node,
648648

649649
flow_spec->dport = match.key->dst;
650650
flow_mask->dport = match.mask->dst;
651-
if (ip_proto == IPPROTO_UDP)
652-
req->features |= BIT_ULL(NPC_DPORT_UDP);
653-
else if (ip_proto == IPPROTO_TCP)
654-
req->features |= BIT_ULL(NPC_DPORT_TCP);
655-
else if (ip_proto == IPPROTO_SCTP)
656-
req->features |= BIT_ULL(NPC_DPORT_SCTP);
651+
652+
if (flow_mask->dport) {
653+
if (ip_proto == IPPROTO_UDP)
654+
req->features |= BIT_ULL(NPC_DPORT_UDP);
655+
else if (ip_proto == IPPROTO_TCP)
656+
req->features |= BIT_ULL(NPC_DPORT_TCP);
657+
else if (ip_proto == IPPROTO_SCTP)
658+
req->features |= BIT_ULL(NPC_DPORT_SCTP);
659+
}
657660

658661
flow_spec->sport = match.key->src;
659662
flow_mask->sport = match.mask->src;
660-
if (ip_proto == IPPROTO_UDP)
661-
req->features |= BIT_ULL(NPC_SPORT_UDP);
662-
else if (ip_proto == IPPROTO_TCP)
663-
req->features |= BIT_ULL(NPC_SPORT_TCP);
664-
else if (ip_proto == IPPROTO_SCTP)
665-
req->features |= BIT_ULL(NPC_SPORT_SCTP);
663+
664+
if (flow_mask->sport) {
665+
if (ip_proto == IPPROTO_UDP)
666+
req->features |= BIT_ULL(NPC_SPORT_UDP);
667+
else if (ip_proto == IPPROTO_TCP)
668+
req->features |= BIT_ULL(NPC_SPORT_TCP);
669+
else if (ip_proto == IPPROTO_SCTP)
670+
req->features |= BIT_ULL(NPC_SPORT_SCTP);
671+
}
666672
}
667673

668674
return otx2_tc_parse_actions(nic, &rule->action, req, f, node);

0 commit comments

Comments
 (0)