提交 b63833ec 编写于 作者: J Jian Shen 提交者: Zheng Zengkai

net: hns3: add support for traffic class tuple support for flow director by ethtool

mainline inclusion
from mainline-v5.13-rc1
commit ae481191
category: feature
bugzilla: 173966
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ae4811913f576d3a891e2ca8a3ad11746f644c69

----------------------------------------------------------------------

The hardware supports to parse and match the traffic class field
of IPv6 packet for flow director, uses the same tuple as ip tos.
So removes the limitation of configure 'tclass' by driver.
Signed-off-by: NJian Shen <shenjian15@huawei.com>
Signed-off-by: NHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
Reviewed-by: NYongxin Li <liyongxin1@huawei.com>
Signed-off-by: NJunxin Chen <chenjunxin1@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 f59da287
...@@ -5665,8 +5665,7 @@ static int hclge_fd_check_tcpip6_tuple(struct ethtool_tcpip6_spec *spec, ...@@ -5665,8 +5665,7 @@ static int hclge_fd_check_tcpip6_tuple(struct ethtool_tcpip6_spec *spec,
if (!spec || !unused_tuple) if (!spec || !unused_tuple)
return -EINVAL; return -EINVAL;
*unused_tuple |= BIT(INNER_SRC_MAC) | BIT(INNER_DST_MAC) | *unused_tuple |= BIT(INNER_SRC_MAC) | BIT(INNER_DST_MAC);
BIT(INNER_IP_TOS);
/* check whether src/dst ip address used */ /* check whether src/dst ip address used */
if (ipv6_addr_any((struct in6_addr *)spec->ip6src)) if (ipv6_addr_any((struct in6_addr *)spec->ip6src))
...@@ -5681,8 +5680,8 @@ static int hclge_fd_check_tcpip6_tuple(struct ethtool_tcpip6_spec *spec, ...@@ -5681,8 +5680,8 @@ static int hclge_fd_check_tcpip6_tuple(struct ethtool_tcpip6_spec *spec,
if (!spec->pdst) if (!spec->pdst)
*unused_tuple |= BIT(INNER_DST_PORT); *unused_tuple |= BIT(INNER_DST_PORT);
if (spec->tclass) if (!spec->tclass)
return -EOPNOTSUPP; *unused_tuple |= BIT(INNER_IP_TOS);
return 0; return 0;
} }
...@@ -5694,7 +5693,7 @@ static int hclge_fd_check_ip6_tuple(struct ethtool_usrip6_spec *spec, ...@@ -5694,7 +5693,7 @@ static int hclge_fd_check_ip6_tuple(struct ethtool_usrip6_spec *spec,
return -EINVAL; return -EINVAL;
*unused_tuple |= BIT(INNER_SRC_MAC) | BIT(INNER_DST_MAC) | *unused_tuple |= BIT(INNER_SRC_MAC) | BIT(INNER_DST_MAC) |
BIT(INNER_IP_TOS) | BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT); BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT);
/* check whether src/dst ip address used */ /* check whether src/dst ip address used */
if (ipv6_addr_any((struct in6_addr *)spec->ip6src)) if (ipv6_addr_any((struct in6_addr *)spec->ip6src))
...@@ -5706,8 +5705,8 @@ static int hclge_fd_check_ip6_tuple(struct ethtool_usrip6_spec *spec, ...@@ -5706,8 +5705,8 @@ static int hclge_fd_check_ip6_tuple(struct ethtool_usrip6_spec *spec,
if (!spec->l4_proto) if (!spec->l4_proto)
*unused_tuple |= BIT(INNER_IP_PROTO); *unused_tuple |= BIT(INNER_IP_PROTO);
if (spec->tclass) if (!spec->tclass)
return -EOPNOTSUPP; *unused_tuple |= BIT(INNER_IP_TOS);
if (spec->l4_4_bytes) if (spec->l4_4_bytes)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -5993,6 +5992,9 @@ static void hclge_fd_get_tcpip6_tuple(struct hclge_dev *hdev, ...@@ -5993,6 +5992,9 @@ static void hclge_fd_get_tcpip6_tuple(struct hclge_dev *hdev,
rule->tuples.ether_proto = ETH_P_IPV6; rule->tuples.ether_proto = ETH_P_IPV6;
rule->tuples_mask.ether_proto = 0xFFFF; rule->tuples_mask.ether_proto = 0xFFFF;
rule->tuples.ip_tos = fs->h_u.tcp_ip6_spec.tclass;
rule->tuples_mask.ip_tos = fs->m_u.tcp_ip6_spec.tclass;
rule->tuples.ip_proto = ip_proto; rule->tuples.ip_proto = ip_proto;
rule->tuples_mask.ip_proto = 0xFF; rule->tuples_mask.ip_proto = 0xFF;
} }
...@@ -6014,6 +6016,9 @@ static void hclge_fd_get_ip6_tuple(struct hclge_dev *hdev, ...@@ -6014,6 +6016,9 @@ static void hclge_fd_get_ip6_tuple(struct hclge_dev *hdev,
rule->tuples.ip_proto = fs->h_u.usr_ip6_spec.l4_proto; rule->tuples.ip_proto = fs->h_u.usr_ip6_spec.l4_proto;
rule->tuples_mask.ip_proto = fs->m_u.usr_ip6_spec.l4_proto; rule->tuples_mask.ip_proto = fs->m_u.usr_ip6_spec.l4_proto;
rule->tuples.ip_tos = fs->h_u.tcp_ip6_spec.tclass;
rule->tuples_mask.ip_tos = fs->m_u.tcp_ip6_spec.tclass;
rule->tuples.ether_proto = ETH_P_IPV6; rule->tuples.ether_proto = ETH_P_IPV6;
rule->tuples_mask.ether_proto = 0xFFFF; rule->tuples_mask.ether_proto = 0xFFFF;
} }
...@@ -6423,6 +6428,10 @@ static void hclge_fd_get_tcpip6_info(struct hclge_fd_rule *rule, ...@@ -6423,6 +6428,10 @@ static void hclge_fd_get_tcpip6_info(struct hclge_fd_rule *rule,
cpu_to_be32_array(spec_mask->ip6dst, rule->tuples_mask.dst_ip, cpu_to_be32_array(spec_mask->ip6dst, rule->tuples_mask.dst_ip,
IPV6_SIZE); IPV6_SIZE);
spec->tclass = rule->tuples.ip_tos;
spec_mask->tclass = rule->unused_tuple & BIT(INNER_IP_TOS) ?
0 : rule->tuples_mask.ip_tos;
spec->psrc = cpu_to_be16(rule->tuples.src_port); spec->psrc = cpu_to_be16(rule->tuples.src_port);
spec_mask->psrc = rule->unused_tuple & BIT(INNER_SRC_PORT) ? spec_mask->psrc = rule->unused_tuple & BIT(INNER_SRC_PORT) ?
0 : cpu_to_be16(rule->tuples_mask.src_port); 0 : cpu_to_be16(rule->tuples_mask.src_port);
...@@ -6450,6 +6459,10 @@ static void hclge_fd_get_ip6_info(struct hclge_fd_rule *rule, ...@@ -6450,6 +6459,10 @@ static void hclge_fd_get_ip6_info(struct hclge_fd_rule *rule,
cpu_to_be32_array(spec_mask->ip6dst, cpu_to_be32_array(spec_mask->ip6dst,
rule->tuples_mask.dst_ip, IPV6_SIZE); rule->tuples_mask.dst_ip, IPV6_SIZE);
spec->tclass = rule->tuples.ip_tos;
spec_mask->tclass = rule->unused_tuple & BIT(INNER_IP_TOS) ?
0 : rule->tuples_mask.ip_tos;
spec->l4_proto = rule->tuples.ip_proto; spec->l4_proto = rule->tuples.ip_proto;
spec_mask->l4_proto = rule->unused_tuple & BIT(INNER_IP_PROTO) ? spec_mask->l4_proto = rule->unused_tuple & BIT(INNER_IP_PROTO) ?
0 : rule->tuples_mask.ip_proto; 0 : rule->tuples_mask.ip_proto;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册