mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
net: hns3: improve the unused_tuple parameter setting
Currently, when the tc tool is used to set flow table rules, the IP address and MAC address can be configured separately, for example, src_xx or dst_xx can be configured separately. Therefore, the driver needs to check whether the mask is all zero in keys, such as FLOW_DISSECTOR_KEY_IPV4_ADDRS, FLOW_DISSECTOR_KEY_IPV6_ADDRS, and FLOW_DISSECTOR_KEY_ETH_ADDRS. If the mask is all zero, the tuple is not configured. In this case, the driver adds the tuple to unused_tuple. Signed-off-by: Jijie Shao <shaojijie@huawei.com> Link: https://patch.msgid.link/20260610060618.834987-3-shaojijie@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
d7db57e3b4
commit
1ad6f1ff3e
|
|
@ -7242,6 +7242,10 @@ static void hclge_get_cls_key_mac(const struct flow_rule *flow,
|
|||
ether_addr_copy(rule->tuples_mask.dst_mac, match.mask->dst);
|
||||
ether_addr_copy(rule->tuples.src_mac, match.key->src);
|
||||
ether_addr_copy(rule->tuples_mask.src_mac, match.mask->src);
|
||||
if (is_zero_ether_addr(match.mask->dst))
|
||||
rule->unused_tuple |= BIT(INNER_DST_MAC);
|
||||
if (is_zero_ether_addr(match.mask->src))
|
||||
rule->unused_tuple |= BIT(INNER_SRC_MAC);
|
||||
} else {
|
||||
rule->unused_tuple |= BIT(INNER_DST_MAC);
|
||||
rule->unused_tuple |= BIT(INNER_SRC_MAC);
|
||||
|
|
@ -7290,6 +7294,10 @@ static int hclge_get_cls_key_ip(const struct flow_rule *flow,
|
|||
rule->tuples.dst_ip[IPV4_INDEX] = be32_to_cpu(match.key->dst);
|
||||
rule->tuples_mask.dst_ip[IPV4_INDEX] =
|
||||
be32_to_cpu(match.mask->dst);
|
||||
if (!match.mask->src)
|
||||
rule->unused_tuple |= BIT(INNER_SRC_IP);
|
||||
if (!match.mask->dst)
|
||||
rule->unused_tuple |= BIT(INNER_DST_IP);
|
||||
} else if (addr_type == FLOW_DISSECTOR_KEY_IPV6_ADDRS) {
|
||||
struct flow_match_ipv6_addrs match;
|
||||
|
||||
|
|
@ -7302,6 +7310,10 @@ static int hclge_get_cls_key_ip(const struct flow_rule *flow,
|
|||
match.key->dst.s6_addr32);
|
||||
ipv6_addr_be32_to_cpu(rule->tuples_mask.dst_ip,
|
||||
match.mask->dst.s6_addr32);
|
||||
if (ipv6_addr_any(&match.mask->src))
|
||||
rule->unused_tuple |= BIT(INNER_SRC_IP);
|
||||
if (ipv6_addr_any(&match.mask->dst))
|
||||
rule->unused_tuple |= BIT(INNER_DST_IP);
|
||||
} else {
|
||||
rule->unused_tuple |= BIT(INNER_SRC_IP);
|
||||
rule->unused_tuple |= BIT(INNER_DST_IP);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user