162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci/* Copyright (C) 2018-2020, Intel Corporation. */
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#include "ice_common.h"
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci/* These are training packet headers used to program flow director filters. */
762306a36Sopenharmony_cistatic const u8 ice_fdir_tcpv4_pkt[] = {
862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
1062306a36Sopenharmony_ci	0x00, 0x28, 0x00, 0x01, 0x00, 0x00, 0x40, 0x06,
1162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00,
1462306a36Sopenharmony_ci	0x20, 0x00, 0x00, 0x00, 0x00, 0x00
1562306a36Sopenharmony_ci};
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_cistatic const u8 ice_fdir_udpv4_pkt[] = {
1862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
2062306a36Sopenharmony_ci	0x00, 0x1C, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
2162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2362306a36Sopenharmony_ci	0x00, 0x00,
2462306a36Sopenharmony_ci};
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_cistatic const u8 ice_fdir_sctpv4_pkt[] = {
2762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
2862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
2962306a36Sopenharmony_ci	0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x40, 0x84,
3062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3362306a36Sopenharmony_ci};
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_pkt[] = {
3662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
3862306a36Sopenharmony_ci	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x10,
3962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4062306a36Sopenharmony_ci	0x00, 0x00
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_cistatic const u8 ice_fdir_udp4_gtpu4_pkt[] = {
4462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
4662306a36Sopenharmony_ci	0x00, 0x4c, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
4762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
4862306a36Sopenharmony_ci	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
4962306a36Sopenharmony_ci	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
5062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x00,
5162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
5262306a36Sopenharmony_ci	0x00, 0x1c, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
5362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5562306a36Sopenharmony_ci	0x00, 0x00,
5662306a36Sopenharmony_ci};
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_cistatic const u8 ice_fdir_tcp4_gtpu4_pkt[] = {
5962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
6162306a36Sopenharmony_ci	0x00, 0x58, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
6262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6362306a36Sopenharmony_ci	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
6462306a36Sopenharmony_ci	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
6562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x00,
6662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
6762306a36Sopenharmony_ci	0x00, 0x28, 0x00, 0x00, 0x40, 0x00, 0x40, 0x06,
6862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7262306a36Sopenharmony_ci};
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_cistatic const u8 ice_fdir_icmp4_gtpu4_pkt[] = {
7562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
7762306a36Sopenharmony_ci	0x00, 0x4c, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
7862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
7962306a36Sopenharmony_ci	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
8062306a36Sopenharmony_ci	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
8162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x00,
8262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
8362306a36Sopenharmony_ci	0x00, 0x1c, 0x00, 0x00, 0x40, 0x00, 0x40, 0x01,
8462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
8662306a36Sopenharmony_ci	0x00, 0x00,
8762306a36Sopenharmony_ci};
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_gtpu4_pkt[] = {
9062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
9162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
9262306a36Sopenharmony_ci	0x00, 0x44, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
9362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
9462306a36Sopenharmony_ci	0x00, 0x00, 0x08, 0x68, 0x08, 0x68, 0x00, 0x00,
9562306a36Sopenharmony_ci	0x00, 0x00, 0x34, 0xff, 0x00, 0x28, 0x00, 0x00,
9662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x85, 0x02, 0x00,
9762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x00,
9862306a36Sopenharmony_ci	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x00,
9962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10062306a36Sopenharmony_ci	0x00, 0x00,
10162306a36Sopenharmony_ci};
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_l2tpv3_pkt[] = {
10462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
10662306a36Sopenharmony_ci	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x73,
10762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
10962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11062306a36Sopenharmony_ci};
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_cistatic const u8 ice_fdir_ipv6_l2tpv3_pkt[] = {
11362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
11562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x73, 0x40, 0x00, 0x00,
11662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12162306a36Sopenharmony_ci	0x00, 0x00,
12262306a36Sopenharmony_ci};
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_esp_pkt[] = {
12562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
12762306a36Sopenharmony_ci	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x32,
12862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
12962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13062306a36Sopenharmony_ci	0x00, 0x00
13162306a36Sopenharmony_ci};
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_cistatic const u8 ice_fdir_ipv6_esp_pkt[] = {
13462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
13662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x32, 0x40, 0x00, 0x00,
13762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
13962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14262306a36Sopenharmony_ci};
14362306a36Sopenharmony_ci
14462306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_ah_pkt[] = {
14562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
14762306a36Sopenharmony_ci	0x00, 0x14, 0x00, 0x00, 0x40, 0x00, 0x40, 0x33,
14862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
14962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15162306a36Sopenharmony_ci	0x00, 0x00
15262306a36Sopenharmony_ci};
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_cistatic const u8 ice_fdir_ipv6_ah_pkt[] = {
15562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
15762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x33, 0x40, 0x00, 0x00,
15862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
15962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16462306a36Sopenharmony_ci};
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_nat_t_esp_pkt[] = {
16762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
16862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
16962306a36Sopenharmony_ci	0x00, 0x1C, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
17062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x11, 0x94, 0x00, 0x00,
17262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17362306a36Sopenharmony_ci	0x00, 0x00,
17462306a36Sopenharmony_ci};
17562306a36Sopenharmony_ci
17662306a36Sopenharmony_cistatic const u8 ice_fdir_ipv6_nat_t_esp_pkt[] = {
17762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
17862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
17962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x08, 0x11, 0x40, 0x00, 0x00,
18062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18462306a36Sopenharmony_ci	0x11, 0x94, 0x00, 0x00, 0x00, 0x08,
18562306a36Sopenharmony_ci};
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_pfcp_node_pkt[] = {
18862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
18962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
19062306a36Sopenharmony_ci	0x00, 0x2C, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
19162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19262306a36Sopenharmony_ci	0x00, 0x00, 0x22, 0x65, 0x22, 0x65, 0x00, 0x00,
19362306a36Sopenharmony_ci	0x00, 0x00, 0x20, 0x00, 0x00, 0x10, 0x00, 0x00,
19462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
19562306a36Sopenharmony_ci	0x00, 0x00,
19662306a36Sopenharmony_ci};
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_cistatic const u8 ice_fdir_ipv4_pfcp_session_pkt[] = {
19962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
20162306a36Sopenharmony_ci	0x00, 0x2C, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
20262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20362306a36Sopenharmony_ci	0x00, 0x00, 0x22, 0x65, 0x22, 0x65, 0x00, 0x00,
20462306a36Sopenharmony_ci	0x00, 0x00, 0x21, 0x00, 0x00, 0x10, 0x00, 0x00,
20562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
20662306a36Sopenharmony_ci	0x00, 0x00,
20762306a36Sopenharmony_ci};
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_cistatic const u8 ice_fdir_ipv6_pfcp_node_pkt[] = {
21062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
21262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x18, 0x11, 0x40, 0x00, 0x00,
21362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x65,
21762306a36Sopenharmony_ci	0x22, 0x65, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00,
21862306a36Sopenharmony_ci	0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
21962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22062306a36Sopenharmony_ci};
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_cistatic const u8 ice_fdir_ipv6_pfcp_session_pkt[] = {
22362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
22562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x18, 0x11, 0x40, 0x00, 0x00,
22662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
22962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x65,
23062306a36Sopenharmony_ci	0x22, 0x65, 0x00, 0x00, 0x00, 0x00, 0x21, 0x00,
23162306a36Sopenharmony_ci	0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23362306a36Sopenharmony_ci};
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_cistatic const u8 ice_fdir_non_ip_l2_pkt[] = {
23662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
23962306a36Sopenharmony_ci};
24062306a36Sopenharmony_ci
24162306a36Sopenharmony_cistatic const u8 ice_fdir_tcpv6_pkt[] = {
24262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
24462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x14, 0x06, 0x40, 0x00, 0x00,
24562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
24962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
25062306a36Sopenharmony_ci	0x00, 0x00, 0x50, 0x00, 0x20, 0x00, 0x00, 0x00,
25162306a36Sopenharmony_ci	0x00, 0x00,
25262306a36Sopenharmony_ci};
25362306a36Sopenharmony_ci
25462306a36Sopenharmony_cistatic const u8 ice_fdir_udpv6_pkt[] = {
25562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
25662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
25762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x08, 0x11, 0x40, 0x00, 0x00,
25862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
25962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x08, 0x00, 0x00,
26362306a36Sopenharmony_ci};
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_cistatic const u8 ice_fdir_sctpv6_pkt[] = {
26662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
26762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
26862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x0C, 0x84, 0x40, 0x00, 0x00,
26962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27462306a36Sopenharmony_ci	0x00, 0x00,
27562306a36Sopenharmony_ci};
27662306a36Sopenharmony_ci
27762306a36Sopenharmony_cistatic const u8 ice_fdir_ipv6_pkt[] = {
27862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
27962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x86, 0xDD, 0x60, 0x00,
28062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x3B, 0x40, 0x00, 0x00,
28162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28562306a36Sopenharmony_ci};
28662306a36Sopenharmony_ci
28762306a36Sopenharmony_cistatic const u8 ice_fdir_tcp4_tun_pkt[] = {
28862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
28962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
29062306a36Sopenharmony_ci	0x00, 0x5a, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
29162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29362306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
29462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
29662306a36Sopenharmony_ci	0x45, 0x00, 0x00, 0x28, 0x00, 0x00, 0x40, 0x00,
29762306a36Sopenharmony_ci	0x40, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
29962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30062306a36Sopenharmony_ci	0x50, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
30162306a36Sopenharmony_ci};
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_cistatic const u8 ice_fdir_udp4_tun_pkt[] = {
30462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
30662306a36Sopenharmony_ci	0x00, 0x4e, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
30762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
30962306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
31062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
31262306a36Sopenharmony_ci	0x45, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x40, 0x00,
31362306a36Sopenharmony_ci	0x40, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
31562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00,
31662306a36Sopenharmony_ci};
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_cistatic const u8 ice_fdir_sctp4_tun_pkt[] = {
31962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
32162306a36Sopenharmony_ci	0x00, 0x52, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
32262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32462306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
32562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
32762306a36Sopenharmony_ci	0x45, 0x00, 0x00, 0x20, 0x00, 0x01, 0x00, 0x00,
32862306a36Sopenharmony_ci	0x40, 0x84, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
32962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33162306a36Sopenharmony_ci};
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_cistatic const u8 ice_fdir_ip4_tun_pkt[] = {
33462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
33662306a36Sopenharmony_ci	0x00, 0x46, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
33762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
33962306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
34062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00,
34262306a36Sopenharmony_ci	0x45, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00,
34362306a36Sopenharmony_ci	0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00,
34562306a36Sopenharmony_ci};
34662306a36Sopenharmony_ci
34762306a36Sopenharmony_cistatic const u8 ice_fdir_tcp6_tun_pkt[] = {
34862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
34962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
35062306a36Sopenharmony_ci	0x00, 0x6e, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
35162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35362306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
35462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xdd,
35662306a36Sopenharmony_ci	0x60, 0x00, 0x00, 0x00, 0x00, 0x14, 0x06, 0x40,
35762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
35962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
36062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
36162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
36262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x20, 0x00,
36362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00,
36462306a36Sopenharmony_ci};
36562306a36Sopenharmony_ci
36662306a36Sopenharmony_cistatic const u8 ice_fdir_udp6_tun_pkt[] = {
36762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
36862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
36962306a36Sopenharmony_ci	0x00, 0x62, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
37062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37262306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
37362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xdd,
37562306a36Sopenharmony_ci	0x60, 0x00, 0x00, 0x00, 0x00, 0x08, 0x11, 0x40,
37662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
37962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38162306a36Sopenharmony_ci};
38262306a36Sopenharmony_ci
38362306a36Sopenharmony_cistatic const u8 ice_fdir_sctp6_tun_pkt[] = {
38462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
38662306a36Sopenharmony_ci	0x00, 0x66, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
38762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
38962306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
39062306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xdd,
39262306a36Sopenharmony_ci	0x60, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x84, 0x40,
39362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39762306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
39862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00,
39962306a36Sopenharmony_ci};
40062306a36Sopenharmony_ci
40162306a36Sopenharmony_cistatic const u8 ice_fdir_ip6_tun_pkt[] = {
40262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x45, 0x00,
40462306a36Sopenharmony_ci	0x00, 0x5a, 0x00, 0x00, 0x40, 0x00, 0x40, 0x11,
40562306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40662306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40762306a36Sopenharmony_ci	0x00, 0x00, 0x04, 0x00, 0x00, 0x03, 0x00, 0x00,
40862306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
40962306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0xdd,
41062306a36Sopenharmony_ci	0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x40,
41162306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41262306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41362306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41462306a36Sopenharmony_ci	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
41562306a36Sopenharmony_ci};
41662306a36Sopenharmony_ci
41762306a36Sopenharmony_ci/* Flow Director no-op training packet table */
41862306a36Sopenharmony_cistatic const struct ice_fdir_base_pkt ice_fdir_pkt[] = {
41962306a36Sopenharmony_ci	{
42062306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_TCP,
42162306a36Sopenharmony_ci		sizeof(ice_fdir_tcpv4_pkt), ice_fdir_tcpv4_pkt,
42262306a36Sopenharmony_ci		sizeof(ice_fdir_tcp4_tun_pkt), ice_fdir_tcp4_tun_pkt,
42362306a36Sopenharmony_ci	},
42462306a36Sopenharmony_ci	{
42562306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_UDP,
42662306a36Sopenharmony_ci		sizeof(ice_fdir_udpv4_pkt), ice_fdir_udpv4_pkt,
42762306a36Sopenharmony_ci		sizeof(ice_fdir_udp4_tun_pkt), ice_fdir_udp4_tun_pkt,
42862306a36Sopenharmony_ci	},
42962306a36Sopenharmony_ci	{
43062306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_SCTP,
43162306a36Sopenharmony_ci		sizeof(ice_fdir_sctpv4_pkt), ice_fdir_sctpv4_pkt,
43262306a36Sopenharmony_ci		sizeof(ice_fdir_sctp4_tun_pkt), ice_fdir_sctp4_tun_pkt,
43362306a36Sopenharmony_ci	},
43462306a36Sopenharmony_ci	{
43562306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_OTHER,
43662306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_pkt), ice_fdir_ipv4_pkt,
43762306a36Sopenharmony_ci		sizeof(ice_fdir_ip4_tun_pkt), ice_fdir_ip4_tun_pkt,
43862306a36Sopenharmony_ci	},
43962306a36Sopenharmony_ci	{
44062306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP,
44162306a36Sopenharmony_ci		sizeof(ice_fdir_udp4_gtpu4_pkt),
44262306a36Sopenharmony_ci		ice_fdir_udp4_gtpu4_pkt,
44362306a36Sopenharmony_ci		sizeof(ice_fdir_udp4_gtpu4_pkt),
44462306a36Sopenharmony_ci		ice_fdir_udp4_gtpu4_pkt,
44562306a36Sopenharmony_ci	},
44662306a36Sopenharmony_ci	{
44762306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP,
44862306a36Sopenharmony_ci		sizeof(ice_fdir_tcp4_gtpu4_pkt),
44962306a36Sopenharmony_ci		ice_fdir_tcp4_gtpu4_pkt,
45062306a36Sopenharmony_ci		sizeof(ice_fdir_tcp4_gtpu4_pkt),
45162306a36Sopenharmony_ci		ice_fdir_tcp4_gtpu4_pkt,
45262306a36Sopenharmony_ci	},
45362306a36Sopenharmony_ci	{
45462306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP,
45562306a36Sopenharmony_ci		sizeof(ice_fdir_icmp4_gtpu4_pkt),
45662306a36Sopenharmony_ci		ice_fdir_icmp4_gtpu4_pkt,
45762306a36Sopenharmony_ci		sizeof(ice_fdir_icmp4_gtpu4_pkt),
45862306a36Sopenharmony_ci		ice_fdir_icmp4_gtpu4_pkt,
45962306a36Sopenharmony_ci	},
46062306a36Sopenharmony_ci	{
46162306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER,
46262306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_gtpu4_pkt),
46362306a36Sopenharmony_ci		ice_fdir_ipv4_gtpu4_pkt,
46462306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_gtpu4_pkt),
46562306a36Sopenharmony_ci		ice_fdir_ipv4_gtpu4_pkt,
46662306a36Sopenharmony_ci	},
46762306a36Sopenharmony_ci	{
46862306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3,
46962306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
47062306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_l2tpv3_pkt), ice_fdir_ipv4_l2tpv3_pkt,
47162306a36Sopenharmony_ci	},
47262306a36Sopenharmony_ci	{
47362306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3,
47462306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_l2tpv3_pkt), ice_fdir_ipv6_l2tpv3_pkt,
47562306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_l2tpv3_pkt), ice_fdir_ipv6_l2tpv3_pkt,
47662306a36Sopenharmony_ci	},
47762306a36Sopenharmony_ci	{
47862306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_ESP,
47962306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_esp_pkt), ice_fdir_ipv4_esp_pkt,
48062306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_esp_pkt), ice_fdir_ipv4_esp_pkt,
48162306a36Sopenharmony_ci	},
48262306a36Sopenharmony_ci	{
48362306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_ESP,
48462306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_esp_pkt), ice_fdir_ipv6_esp_pkt,
48562306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_esp_pkt), ice_fdir_ipv6_esp_pkt,
48662306a36Sopenharmony_ci	},
48762306a36Sopenharmony_ci	{
48862306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_AH,
48962306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_ah_pkt), ice_fdir_ipv4_ah_pkt,
49062306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_ah_pkt), ice_fdir_ipv4_ah_pkt,
49162306a36Sopenharmony_ci	},
49262306a36Sopenharmony_ci	{
49362306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_AH,
49462306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_ah_pkt), ice_fdir_ipv6_ah_pkt,
49562306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_ah_pkt), ice_fdir_ipv6_ah_pkt,
49662306a36Sopenharmony_ci	},
49762306a36Sopenharmony_ci	{
49862306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_NAT_T_ESP,
49962306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_nat_t_esp_pkt),
50062306a36Sopenharmony_ci		ice_fdir_ipv4_nat_t_esp_pkt,
50162306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_nat_t_esp_pkt),
50262306a36Sopenharmony_ci		ice_fdir_ipv4_nat_t_esp_pkt,
50362306a36Sopenharmony_ci	},
50462306a36Sopenharmony_ci	{
50562306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_NAT_T_ESP,
50662306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_nat_t_esp_pkt),
50762306a36Sopenharmony_ci		ice_fdir_ipv6_nat_t_esp_pkt,
50862306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_nat_t_esp_pkt),
50962306a36Sopenharmony_ci		ice_fdir_ipv6_nat_t_esp_pkt,
51062306a36Sopenharmony_ci	},
51162306a36Sopenharmony_ci	{
51262306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_PFCP_NODE,
51362306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_pfcp_node_pkt),
51462306a36Sopenharmony_ci		ice_fdir_ipv4_pfcp_node_pkt,
51562306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_pfcp_node_pkt),
51662306a36Sopenharmony_ci		ice_fdir_ipv4_pfcp_node_pkt,
51762306a36Sopenharmony_ci	},
51862306a36Sopenharmony_ci	{
51962306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV4_PFCP_SESSION,
52062306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_pfcp_session_pkt),
52162306a36Sopenharmony_ci		ice_fdir_ipv4_pfcp_session_pkt,
52262306a36Sopenharmony_ci		sizeof(ice_fdir_ipv4_pfcp_session_pkt),
52362306a36Sopenharmony_ci		ice_fdir_ipv4_pfcp_session_pkt,
52462306a36Sopenharmony_ci	},
52562306a36Sopenharmony_ci	{
52662306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_PFCP_NODE,
52762306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_pfcp_node_pkt),
52862306a36Sopenharmony_ci		ice_fdir_ipv6_pfcp_node_pkt,
52962306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_pfcp_node_pkt),
53062306a36Sopenharmony_ci		ice_fdir_ipv6_pfcp_node_pkt,
53162306a36Sopenharmony_ci	},
53262306a36Sopenharmony_ci	{
53362306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_PFCP_SESSION,
53462306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_pfcp_session_pkt),
53562306a36Sopenharmony_ci		ice_fdir_ipv6_pfcp_session_pkt,
53662306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_pfcp_session_pkt),
53762306a36Sopenharmony_ci		ice_fdir_ipv6_pfcp_session_pkt,
53862306a36Sopenharmony_ci	},
53962306a36Sopenharmony_ci	{
54062306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NON_IP_L2,
54162306a36Sopenharmony_ci		sizeof(ice_fdir_non_ip_l2_pkt), ice_fdir_non_ip_l2_pkt,
54262306a36Sopenharmony_ci		sizeof(ice_fdir_non_ip_l2_pkt), ice_fdir_non_ip_l2_pkt,
54362306a36Sopenharmony_ci	},
54462306a36Sopenharmony_ci	{
54562306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_TCP,
54662306a36Sopenharmony_ci		sizeof(ice_fdir_tcpv6_pkt), ice_fdir_tcpv6_pkt,
54762306a36Sopenharmony_ci		sizeof(ice_fdir_tcp6_tun_pkt), ice_fdir_tcp6_tun_pkt,
54862306a36Sopenharmony_ci	},
54962306a36Sopenharmony_ci	{
55062306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_UDP,
55162306a36Sopenharmony_ci		sizeof(ice_fdir_udpv6_pkt), ice_fdir_udpv6_pkt,
55262306a36Sopenharmony_ci		sizeof(ice_fdir_udp6_tun_pkt), ice_fdir_udp6_tun_pkt,
55362306a36Sopenharmony_ci	},
55462306a36Sopenharmony_ci	{
55562306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_SCTP,
55662306a36Sopenharmony_ci		sizeof(ice_fdir_sctpv6_pkt), ice_fdir_sctpv6_pkt,
55762306a36Sopenharmony_ci		sizeof(ice_fdir_sctp6_tun_pkt), ice_fdir_sctp6_tun_pkt,
55862306a36Sopenharmony_ci	},
55962306a36Sopenharmony_ci	{
56062306a36Sopenharmony_ci		ICE_FLTR_PTYPE_NONF_IPV6_OTHER,
56162306a36Sopenharmony_ci		sizeof(ice_fdir_ipv6_pkt), ice_fdir_ipv6_pkt,
56262306a36Sopenharmony_ci		sizeof(ice_fdir_ip6_tun_pkt), ice_fdir_ip6_tun_pkt,
56362306a36Sopenharmony_ci	},
56462306a36Sopenharmony_ci};
56562306a36Sopenharmony_ci
56662306a36Sopenharmony_ci#define ICE_FDIR_NUM_PKT ARRAY_SIZE(ice_fdir_pkt)
56762306a36Sopenharmony_ci
56862306a36Sopenharmony_ci/**
56962306a36Sopenharmony_ci * ice_set_dflt_val_fd_desc
57062306a36Sopenharmony_ci * @fd_fltr_ctx: pointer to fd filter descriptor
57162306a36Sopenharmony_ci */
57262306a36Sopenharmony_cistatic void ice_set_dflt_val_fd_desc(struct ice_fd_fltr_desc_ctx *fd_fltr_ctx)
57362306a36Sopenharmony_ci{
57462306a36Sopenharmony_ci	fd_fltr_ctx->comp_q = ICE_FXD_FLTR_QW0_COMP_Q_ZERO;
57562306a36Sopenharmony_ci	fd_fltr_ctx->comp_report = ICE_FXD_FLTR_QW0_COMP_REPORT_SW_FAIL;
57662306a36Sopenharmony_ci	fd_fltr_ctx->fd_space = ICE_FXD_FLTR_QW0_FD_SPACE_GUAR_BEST;
57762306a36Sopenharmony_ci	fd_fltr_ctx->cnt_ena = ICE_FXD_FLTR_QW0_STAT_ENA_PKTS;
57862306a36Sopenharmony_ci	fd_fltr_ctx->evict_ena = ICE_FXD_FLTR_QW0_EVICT_ENA_TRUE;
57962306a36Sopenharmony_ci	fd_fltr_ctx->toq = ICE_FXD_FLTR_QW0_TO_Q_EQUALS_QINDEX;
58062306a36Sopenharmony_ci	fd_fltr_ctx->toq_prio = ICE_FXD_FLTR_QW0_TO_Q_PRIO1;
58162306a36Sopenharmony_ci	fd_fltr_ctx->dpu_recipe = ICE_FXD_FLTR_QW0_DPU_RECIPE_DFLT;
58262306a36Sopenharmony_ci	fd_fltr_ctx->drop = ICE_FXD_FLTR_QW0_DROP_NO;
58362306a36Sopenharmony_ci	fd_fltr_ctx->flex_prio = ICE_FXD_FLTR_QW0_FLEX_PRI_NONE;
58462306a36Sopenharmony_ci	fd_fltr_ctx->flex_mdid = ICE_FXD_FLTR_QW0_FLEX_MDID0;
58562306a36Sopenharmony_ci	fd_fltr_ctx->flex_val = ICE_FXD_FLTR_QW0_FLEX_VAL0;
58662306a36Sopenharmony_ci	fd_fltr_ctx->dtype = ICE_TX_DESC_DTYPE_FLTR_PROG;
58762306a36Sopenharmony_ci	fd_fltr_ctx->desc_prof_prio = ICE_FXD_FLTR_QW1_PROF_PRIO_ZERO;
58862306a36Sopenharmony_ci	fd_fltr_ctx->desc_prof = ICE_FXD_FLTR_QW1_PROF_ZERO;
58962306a36Sopenharmony_ci	fd_fltr_ctx->swap = ICE_FXD_FLTR_QW1_SWAP_SET;
59062306a36Sopenharmony_ci	fd_fltr_ctx->fdid_prio = ICE_FXD_FLTR_QW1_FDID_PRI_ONE;
59162306a36Sopenharmony_ci	fd_fltr_ctx->fdid_mdid = ICE_FXD_FLTR_QW1_FDID_MDID_FD;
59262306a36Sopenharmony_ci	fd_fltr_ctx->fdid = ICE_FXD_FLTR_QW1_FDID_ZERO;
59362306a36Sopenharmony_ci}
59462306a36Sopenharmony_ci
59562306a36Sopenharmony_ci/**
59662306a36Sopenharmony_ci * ice_set_fd_desc_val
59762306a36Sopenharmony_ci * @ctx: pointer to fd filter descriptor context
59862306a36Sopenharmony_ci * @fdir_desc: populated with fd filter descriptor values
59962306a36Sopenharmony_ci */
60062306a36Sopenharmony_cistatic void
60162306a36Sopenharmony_ciice_set_fd_desc_val(struct ice_fd_fltr_desc_ctx *ctx,
60262306a36Sopenharmony_ci		    struct ice_fltr_desc *fdir_desc)
60362306a36Sopenharmony_ci{
60462306a36Sopenharmony_ci	u64 qword;
60562306a36Sopenharmony_ci
60662306a36Sopenharmony_ci	/* prep QW0 of FD filter programming desc */
60762306a36Sopenharmony_ci	qword = ((u64)ctx->qindex << ICE_FXD_FLTR_QW0_QINDEX_S) &
60862306a36Sopenharmony_ci		ICE_FXD_FLTR_QW0_QINDEX_M;
60962306a36Sopenharmony_ci	qword |= ((u64)ctx->comp_q << ICE_FXD_FLTR_QW0_COMP_Q_S) &
61062306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_COMP_Q_M;
61162306a36Sopenharmony_ci	qword |= ((u64)ctx->comp_report << ICE_FXD_FLTR_QW0_COMP_REPORT_S) &
61262306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_COMP_REPORT_M;
61362306a36Sopenharmony_ci	qword |= ((u64)ctx->fd_space << ICE_FXD_FLTR_QW0_FD_SPACE_S) &
61462306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_FD_SPACE_M;
61562306a36Sopenharmony_ci	qword |= ((u64)ctx->cnt_index << ICE_FXD_FLTR_QW0_STAT_CNT_S) &
61662306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_STAT_CNT_M;
61762306a36Sopenharmony_ci	qword |= ((u64)ctx->cnt_ena << ICE_FXD_FLTR_QW0_STAT_ENA_S) &
61862306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_STAT_ENA_M;
61962306a36Sopenharmony_ci	qword |= ((u64)ctx->evict_ena << ICE_FXD_FLTR_QW0_EVICT_ENA_S) &
62062306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_EVICT_ENA_M;
62162306a36Sopenharmony_ci	qword |= ((u64)ctx->toq << ICE_FXD_FLTR_QW0_TO_Q_S) &
62262306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_TO_Q_M;
62362306a36Sopenharmony_ci	qword |= ((u64)ctx->toq_prio << ICE_FXD_FLTR_QW0_TO_Q_PRI_S) &
62462306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_TO_Q_PRI_M;
62562306a36Sopenharmony_ci	qword |= ((u64)ctx->dpu_recipe << ICE_FXD_FLTR_QW0_DPU_RECIPE_S) &
62662306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_DPU_RECIPE_M;
62762306a36Sopenharmony_ci	qword |= ((u64)ctx->drop << ICE_FXD_FLTR_QW0_DROP_S) &
62862306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_DROP_M;
62962306a36Sopenharmony_ci	qword |= ((u64)ctx->flex_prio << ICE_FXD_FLTR_QW0_FLEX_PRI_S) &
63062306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_FLEX_PRI_M;
63162306a36Sopenharmony_ci	qword |= ((u64)ctx->flex_mdid << ICE_FXD_FLTR_QW0_FLEX_MDID_S) &
63262306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_FLEX_MDID_M;
63362306a36Sopenharmony_ci	qword |= ((u64)ctx->flex_val << ICE_FXD_FLTR_QW0_FLEX_VAL_S) &
63462306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW0_FLEX_VAL_M;
63562306a36Sopenharmony_ci	fdir_desc->qidx_compq_space_stat = cpu_to_le64(qword);
63662306a36Sopenharmony_ci
63762306a36Sopenharmony_ci	/* prep QW1 of FD filter programming desc */
63862306a36Sopenharmony_ci	qword = ((u64)ctx->dtype << ICE_FXD_FLTR_QW1_DTYPE_S) &
63962306a36Sopenharmony_ci		ICE_FXD_FLTR_QW1_DTYPE_M;
64062306a36Sopenharmony_ci	qword |= ((u64)ctx->pcmd << ICE_FXD_FLTR_QW1_PCMD_S) &
64162306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_PCMD_M;
64262306a36Sopenharmony_ci	qword |= ((u64)ctx->desc_prof_prio << ICE_FXD_FLTR_QW1_PROF_PRI_S) &
64362306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_PROF_PRI_M;
64462306a36Sopenharmony_ci	qword |= ((u64)ctx->desc_prof << ICE_FXD_FLTR_QW1_PROF_S) &
64562306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_PROF_M;
64662306a36Sopenharmony_ci	qword |= ((u64)ctx->fd_vsi << ICE_FXD_FLTR_QW1_FD_VSI_S) &
64762306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_FD_VSI_M;
64862306a36Sopenharmony_ci	qword |= ((u64)ctx->swap << ICE_FXD_FLTR_QW1_SWAP_S) &
64962306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_SWAP_M;
65062306a36Sopenharmony_ci	qword |= ((u64)ctx->fdid_prio << ICE_FXD_FLTR_QW1_FDID_PRI_S) &
65162306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_FDID_PRI_M;
65262306a36Sopenharmony_ci	qword |= ((u64)ctx->fdid_mdid << ICE_FXD_FLTR_QW1_FDID_MDID_S) &
65362306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_FDID_MDID_M;
65462306a36Sopenharmony_ci	qword |= ((u64)ctx->fdid << ICE_FXD_FLTR_QW1_FDID_S) &
65562306a36Sopenharmony_ci		 ICE_FXD_FLTR_QW1_FDID_M;
65662306a36Sopenharmony_ci	fdir_desc->dtype_cmd_vsi_fdid = cpu_to_le64(qword);
65762306a36Sopenharmony_ci}
65862306a36Sopenharmony_ci
65962306a36Sopenharmony_ci/**
66062306a36Sopenharmony_ci * ice_fdir_get_prgm_desc - set a fdir descriptor from a fdir filter struct
66162306a36Sopenharmony_ci * @hw: pointer to the hardware structure
66262306a36Sopenharmony_ci * @input: filter
66362306a36Sopenharmony_ci * @fdesc: filter descriptor
66462306a36Sopenharmony_ci * @add: if add is true, this is an add operation, false implies delete
66562306a36Sopenharmony_ci */
66662306a36Sopenharmony_civoid
66762306a36Sopenharmony_ciice_fdir_get_prgm_desc(struct ice_hw *hw, struct ice_fdir_fltr *input,
66862306a36Sopenharmony_ci		       struct ice_fltr_desc *fdesc, bool add)
66962306a36Sopenharmony_ci{
67062306a36Sopenharmony_ci	struct ice_fd_fltr_desc_ctx fdir_fltr_ctx = { 0 };
67162306a36Sopenharmony_ci
67262306a36Sopenharmony_ci	/* set default context info */
67362306a36Sopenharmony_ci	ice_set_dflt_val_fd_desc(&fdir_fltr_ctx);
67462306a36Sopenharmony_ci
67562306a36Sopenharmony_ci	/* change sideband filtering values */
67662306a36Sopenharmony_ci	fdir_fltr_ctx.fdid = input->fltr_id;
67762306a36Sopenharmony_ci	if (input->dest_ctl == ICE_FLTR_PRGM_DESC_DEST_DROP_PKT) {
67862306a36Sopenharmony_ci		fdir_fltr_ctx.drop = ICE_FXD_FLTR_QW0_DROP_YES;
67962306a36Sopenharmony_ci		fdir_fltr_ctx.qindex = 0;
68062306a36Sopenharmony_ci	} else if (input->dest_ctl ==
68162306a36Sopenharmony_ci		   ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_OTHER) {
68262306a36Sopenharmony_ci		fdir_fltr_ctx.drop = ICE_FXD_FLTR_QW0_DROP_NO;
68362306a36Sopenharmony_ci		fdir_fltr_ctx.qindex = 0;
68462306a36Sopenharmony_ci	} else {
68562306a36Sopenharmony_ci		if (input->dest_ctl ==
68662306a36Sopenharmony_ci		    ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QGROUP)
68762306a36Sopenharmony_ci			fdir_fltr_ctx.toq = input->q_region;
68862306a36Sopenharmony_ci		fdir_fltr_ctx.drop = ICE_FXD_FLTR_QW0_DROP_NO;
68962306a36Sopenharmony_ci		fdir_fltr_ctx.qindex = input->q_index;
69062306a36Sopenharmony_ci	}
69162306a36Sopenharmony_ci	fdir_fltr_ctx.cnt_ena = input->cnt_ena;
69262306a36Sopenharmony_ci	fdir_fltr_ctx.cnt_index = input->cnt_index;
69362306a36Sopenharmony_ci	fdir_fltr_ctx.fd_vsi = ice_get_hw_vsi_num(hw, input->dest_vsi);
69462306a36Sopenharmony_ci	fdir_fltr_ctx.evict_ena = ICE_FXD_FLTR_QW0_EVICT_ENA_FALSE;
69562306a36Sopenharmony_ci	if (input->dest_ctl == ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_OTHER)
69662306a36Sopenharmony_ci		fdir_fltr_ctx.toq_prio = 0;
69762306a36Sopenharmony_ci	else
69862306a36Sopenharmony_ci		fdir_fltr_ctx.toq_prio = 3;
69962306a36Sopenharmony_ci	fdir_fltr_ctx.pcmd = add ? ICE_FXD_FLTR_QW1_PCMD_ADD :
70062306a36Sopenharmony_ci		ICE_FXD_FLTR_QW1_PCMD_REMOVE;
70162306a36Sopenharmony_ci	fdir_fltr_ctx.swap = ICE_FXD_FLTR_QW1_SWAP_NOT_SET;
70262306a36Sopenharmony_ci	fdir_fltr_ctx.comp_q = ICE_FXD_FLTR_QW0_COMP_Q_ZERO;
70362306a36Sopenharmony_ci	fdir_fltr_ctx.comp_report = input->comp_report;
70462306a36Sopenharmony_ci	fdir_fltr_ctx.fdid_prio = input->fdid_prio;
70562306a36Sopenharmony_ci	fdir_fltr_ctx.desc_prof = 1;
70662306a36Sopenharmony_ci	fdir_fltr_ctx.desc_prof_prio = 3;
70762306a36Sopenharmony_ci	ice_set_fd_desc_val(&fdir_fltr_ctx, fdesc);
70862306a36Sopenharmony_ci}
70962306a36Sopenharmony_ci
71062306a36Sopenharmony_ci/**
71162306a36Sopenharmony_ci * ice_alloc_fd_res_cntr - obtain counter resource for FD type
71262306a36Sopenharmony_ci * @hw: pointer to the hardware structure
71362306a36Sopenharmony_ci * @cntr_id: returns counter index
71462306a36Sopenharmony_ci */
71562306a36Sopenharmony_ciint ice_alloc_fd_res_cntr(struct ice_hw *hw, u16 *cntr_id)
71662306a36Sopenharmony_ci{
71762306a36Sopenharmony_ci	return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK,
71862306a36Sopenharmony_ci				  ICE_AQC_RES_TYPE_FLAG_DEDICATED, 1, cntr_id);
71962306a36Sopenharmony_ci}
72062306a36Sopenharmony_ci
72162306a36Sopenharmony_ci/**
72262306a36Sopenharmony_ci * ice_free_fd_res_cntr - Free counter resource for FD type
72362306a36Sopenharmony_ci * @hw: pointer to the hardware structure
72462306a36Sopenharmony_ci * @cntr_id: counter index to be freed
72562306a36Sopenharmony_ci */
72662306a36Sopenharmony_ciint ice_free_fd_res_cntr(struct ice_hw *hw, u16 cntr_id)
72762306a36Sopenharmony_ci{
72862306a36Sopenharmony_ci	return ice_free_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_COUNTER_BLOCK,
72962306a36Sopenharmony_ci				 ICE_AQC_RES_TYPE_FLAG_DEDICATED, 1, cntr_id);
73062306a36Sopenharmony_ci}
73162306a36Sopenharmony_ci
73262306a36Sopenharmony_ci/**
73362306a36Sopenharmony_ci * ice_alloc_fd_guar_item - allocate resource for FD guaranteed entries
73462306a36Sopenharmony_ci * @hw: pointer to the hardware structure
73562306a36Sopenharmony_ci * @cntr_id: returns counter index
73662306a36Sopenharmony_ci * @num_fltr: number of filter entries to be allocated
73762306a36Sopenharmony_ci */
73862306a36Sopenharmony_ciint ice_alloc_fd_guar_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
73962306a36Sopenharmony_ci{
74062306a36Sopenharmony_ci	return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_GUARANTEED_ENTRIES,
74162306a36Sopenharmony_ci				  ICE_AQC_RES_TYPE_FLAG_DEDICATED, num_fltr,
74262306a36Sopenharmony_ci				  cntr_id);
74362306a36Sopenharmony_ci}
74462306a36Sopenharmony_ci
74562306a36Sopenharmony_ci/**
74662306a36Sopenharmony_ci * ice_alloc_fd_shrd_item - allocate resource for flow director shared entries
74762306a36Sopenharmony_ci * @hw: pointer to the hardware structure
74862306a36Sopenharmony_ci * @cntr_id: returns counter index
74962306a36Sopenharmony_ci * @num_fltr: number of filter entries to be allocated
75062306a36Sopenharmony_ci */
75162306a36Sopenharmony_ciint ice_alloc_fd_shrd_item(struct ice_hw *hw, u16 *cntr_id, u16 num_fltr)
75262306a36Sopenharmony_ci{
75362306a36Sopenharmony_ci	return ice_alloc_res_cntr(hw, ICE_AQC_RES_TYPE_FDIR_SHARED_ENTRIES,
75462306a36Sopenharmony_ci				  ICE_AQC_RES_TYPE_FLAG_DEDICATED, num_fltr,
75562306a36Sopenharmony_ci				  cntr_id);
75662306a36Sopenharmony_ci}
75762306a36Sopenharmony_ci
75862306a36Sopenharmony_ci/**
75962306a36Sopenharmony_ci * ice_get_fdir_cnt_all - get the number of Flow Director filters
76062306a36Sopenharmony_ci * @hw: hardware data structure
76162306a36Sopenharmony_ci *
76262306a36Sopenharmony_ci * Returns the number of filters available on device
76362306a36Sopenharmony_ci */
76462306a36Sopenharmony_ciint ice_get_fdir_cnt_all(struct ice_hw *hw)
76562306a36Sopenharmony_ci{
76662306a36Sopenharmony_ci	return hw->func_caps.fd_fltr_guar + hw->func_caps.fd_fltr_best_effort;
76762306a36Sopenharmony_ci}
76862306a36Sopenharmony_ci
76962306a36Sopenharmony_ci/**
77062306a36Sopenharmony_ci * ice_pkt_insert_ipv6_addr - insert a be32 IPv6 address into a memory buffer
77162306a36Sopenharmony_ci * @pkt: packet buffer
77262306a36Sopenharmony_ci * @offset: offset into buffer
77362306a36Sopenharmony_ci * @addr: IPv6 address to convert and insert into pkt at offset
77462306a36Sopenharmony_ci */
77562306a36Sopenharmony_cistatic void ice_pkt_insert_ipv6_addr(u8 *pkt, int offset, __be32 *addr)
77662306a36Sopenharmony_ci{
77762306a36Sopenharmony_ci	int idx;
77862306a36Sopenharmony_ci
77962306a36Sopenharmony_ci	for (idx = 0; idx < ICE_IPV6_ADDR_LEN_AS_U32; idx++)
78062306a36Sopenharmony_ci		memcpy(pkt + offset + idx * sizeof(*addr), &addr[idx],
78162306a36Sopenharmony_ci		       sizeof(*addr));
78262306a36Sopenharmony_ci}
78362306a36Sopenharmony_ci
78462306a36Sopenharmony_ci/**
78562306a36Sopenharmony_ci * ice_pkt_insert_u6_qfi - insert a u6 value QFI into a memory buffer for GTPU
78662306a36Sopenharmony_ci * @pkt: packet buffer
78762306a36Sopenharmony_ci * @offset: offset into buffer
78862306a36Sopenharmony_ci * @data: 8 bit value to convert and insert into pkt at offset
78962306a36Sopenharmony_ci *
79062306a36Sopenharmony_ci * This function is designed for inserting QFI (6 bits) for GTPU.
79162306a36Sopenharmony_ci */
79262306a36Sopenharmony_cistatic void ice_pkt_insert_u6_qfi(u8 *pkt, int offset, u8 data)
79362306a36Sopenharmony_ci{
79462306a36Sopenharmony_ci	u8 ret;
79562306a36Sopenharmony_ci
79662306a36Sopenharmony_ci	ret = (data & 0x3F) + (*(pkt + offset) & 0xC0);
79762306a36Sopenharmony_ci	memcpy(pkt + offset, &ret, sizeof(ret));
79862306a36Sopenharmony_ci}
79962306a36Sopenharmony_ci
80062306a36Sopenharmony_ci/**
80162306a36Sopenharmony_ci * ice_pkt_insert_u8 - insert a u8 value into a memory buffer.
80262306a36Sopenharmony_ci * @pkt: packet buffer
80362306a36Sopenharmony_ci * @offset: offset into buffer
80462306a36Sopenharmony_ci * @data: 8 bit value to convert and insert into pkt at offset
80562306a36Sopenharmony_ci */
80662306a36Sopenharmony_cistatic void ice_pkt_insert_u8(u8 *pkt, int offset, u8 data)
80762306a36Sopenharmony_ci{
80862306a36Sopenharmony_ci	memcpy(pkt + offset, &data, sizeof(data));
80962306a36Sopenharmony_ci}
81062306a36Sopenharmony_ci
81162306a36Sopenharmony_ci/**
81262306a36Sopenharmony_ci * ice_pkt_insert_u8_tc - insert a u8 value into a memory buffer for TC ipv6.
81362306a36Sopenharmony_ci * @pkt: packet buffer
81462306a36Sopenharmony_ci * @offset: offset into buffer
81562306a36Sopenharmony_ci * @data: 8 bit value to convert and insert into pkt at offset
81662306a36Sopenharmony_ci *
81762306a36Sopenharmony_ci * This function is designed for inserting Traffic Class (TC) for IPv6,
81862306a36Sopenharmony_ci * since that TC is not aligned in number of bytes. Here we split it out
81962306a36Sopenharmony_ci * into two part and fill each byte with data copy from pkt, then insert
82062306a36Sopenharmony_ci * the two bytes data one by one.
82162306a36Sopenharmony_ci */
82262306a36Sopenharmony_cistatic void ice_pkt_insert_u8_tc(u8 *pkt, int offset, u8 data)
82362306a36Sopenharmony_ci{
82462306a36Sopenharmony_ci	u8 high, low;
82562306a36Sopenharmony_ci
82662306a36Sopenharmony_ci	high = (data >> 4) + (*(pkt + offset) & 0xF0);
82762306a36Sopenharmony_ci	memcpy(pkt + offset, &high, sizeof(high));
82862306a36Sopenharmony_ci
82962306a36Sopenharmony_ci	low = (*(pkt + offset + 1) & 0x0F) + ((data & 0x0F) << 4);
83062306a36Sopenharmony_ci	memcpy(pkt + offset + 1, &low, sizeof(low));
83162306a36Sopenharmony_ci}
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci/**
83462306a36Sopenharmony_ci * ice_pkt_insert_u16 - insert a be16 value into a memory buffer
83562306a36Sopenharmony_ci * @pkt: packet buffer
83662306a36Sopenharmony_ci * @offset: offset into buffer
83762306a36Sopenharmony_ci * @data: 16 bit value to convert and insert into pkt at offset
83862306a36Sopenharmony_ci */
83962306a36Sopenharmony_cistatic void ice_pkt_insert_u16(u8 *pkt, int offset, __be16 data)
84062306a36Sopenharmony_ci{
84162306a36Sopenharmony_ci	memcpy(pkt + offset, &data, sizeof(data));
84262306a36Sopenharmony_ci}
84362306a36Sopenharmony_ci
84462306a36Sopenharmony_ci/**
84562306a36Sopenharmony_ci * ice_pkt_insert_u32 - insert a be32 value into a memory buffer
84662306a36Sopenharmony_ci * @pkt: packet buffer
84762306a36Sopenharmony_ci * @offset: offset into buffer
84862306a36Sopenharmony_ci * @data: 32 bit value to convert and insert into pkt at offset
84962306a36Sopenharmony_ci */
85062306a36Sopenharmony_cistatic void ice_pkt_insert_u32(u8 *pkt, int offset, __be32 data)
85162306a36Sopenharmony_ci{
85262306a36Sopenharmony_ci	memcpy(pkt + offset, &data, sizeof(data));
85362306a36Sopenharmony_ci}
85462306a36Sopenharmony_ci
85562306a36Sopenharmony_ci/**
85662306a36Sopenharmony_ci * ice_pkt_insert_mac_addr - insert a MAC addr into a memory buffer.
85762306a36Sopenharmony_ci * @pkt: packet buffer
85862306a36Sopenharmony_ci * @addr: MAC address to convert and insert into pkt at offset
85962306a36Sopenharmony_ci */
86062306a36Sopenharmony_cistatic void ice_pkt_insert_mac_addr(u8 *pkt, u8 *addr)
86162306a36Sopenharmony_ci{
86262306a36Sopenharmony_ci	ether_addr_copy(pkt, addr);
86362306a36Sopenharmony_ci}
86462306a36Sopenharmony_ci
86562306a36Sopenharmony_ci/**
86662306a36Sopenharmony_ci * ice_fdir_get_gen_prgm_pkt - generate a training packet
86762306a36Sopenharmony_ci * @hw: pointer to the hardware structure
86862306a36Sopenharmony_ci * @input: flow director filter data structure
86962306a36Sopenharmony_ci * @pkt: pointer to return filter packet
87062306a36Sopenharmony_ci * @frag: generate a fragment packet
87162306a36Sopenharmony_ci * @tun: true implies generate a tunnel packet
87262306a36Sopenharmony_ci */
87362306a36Sopenharmony_ciint
87462306a36Sopenharmony_ciice_fdir_get_gen_prgm_pkt(struct ice_hw *hw, struct ice_fdir_fltr *input,
87562306a36Sopenharmony_ci			  u8 *pkt, bool frag, bool tun)
87662306a36Sopenharmony_ci{
87762306a36Sopenharmony_ci	enum ice_fltr_ptype flow;
87862306a36Sopenharmony_ci	u16 tnl_port;
87962306a36Sopenharmony_ci	u8 *loc;
88062306a36Sopenharmony_ci	u16 idx;
88162306a36Sopenharmony_ci
88262306a36Sopenharmony_ci	if (input->flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER) {
88362306a36Sopenharmony_ci		switch (input->ip.v4.proto) {
88462306a36Sopenharmony_ci		case IPPROTO_TCP:
88562306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV4_TCP;
88662306a36Sopenharmony_ci			break;
88762306a36Sopenharmony_ci		case IPPROTO_UDP:
88862306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV4_UDP;
88962306a36Sopenharmony_ci			break;
89062306a36Sopenharmony_ci		case IPPROTO_SCTP:
89162306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV4_SCTP;
89262306a36Sopenharmony_ci			break;
89362306a36Sopenharmony_ci		default:
89462306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV4_OTHER;
89562306a36Sopenharmony_ci			break;
89662306a36Sopenharmony_ci		}
89762306a36Sopenharmony_ci	} else if (input->flow_type == ICE_FLTR_PTYPE_NONF_IPV6_OTHER) {
89862306a36Sopenharmony_ci		switch (input->ip.v6.proto) {
89962306a36Sopenharmony_ci		case IPPROTO_TCP:
90062306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV6_TCP;
90162306a36Sopenharmony_ci			break;
90262306a36Sopenharmony_ci		case IPPROTO_UDP:
90362306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV6_UDP;
90462306a36Sopenharmony_ci			break;
90562306a36Sopenharmony_ci		case IPPROTO_SCTP:
90662306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV6_SCTP;
90762306a36Sopenharmony_ci			break;
90862306a36Sopenharmony_ci		default:
90962306a36Sopenharmony_ci			flow = ICE_FLTR_PTYPE_NONF_IPV6_OTHER;
91062306a36Sopenharmony_ci			break;
91162306a36Sopenharmony_ci		}
91262306a36Sopenharmony_ci	} else {
91362306a36Sopenharmony_ci		flow = input->flow_type;
91462306a36Sopenharmony_ci	}
91562306a36Sopenharmony_ci
91662306a36Sopenharmony_ci	for (idx = 0; idx < ICE_FDIR_NUM_PKT; idx++)
91762306a36Sopenharmony_ci		if (ice_fdir_pkt[idx].flow == flow)
91862306a36Sopenharmony_ci			break;
91962306a36Sopenharmony_ci	if (idx == ICE_FDIR_NUM_PKT)
92062306a36Sopenharmony_ci		return -EINVAL;
92162306a36Sopenharmony_ci	if (!tun) {
92262306a36Sopenharmony_ci		memcpy(pkt, ice_fdir_pkt[idx].pkt, ice_fdir_pkt[idx].pkt_len);
92362306a36Sopenharmony_ci		loc = pkt;
92462306a36Sopenharmony_ci	} else {
92562306a36Sopenharmony_ci		if (!ice_get_open_tunnel_port(hw, &tnl_port, TNL_ALL))
92662306a36Sopenharmony_ci			return -ENOENT;
92762306a36Sopenharmony_ci		if (!ice_fdir_pkt[idx].tun_pkt)
92862306a36Sopenharmony_ci			return -EINVAL;
92962306a36Sopenharmony_ci		memcpy(pkt, ice_fdir_pkt[idx].tun_pkt,
93062306a36Sopenharmony_ci		       ice_fdir_pkt[idx].tun_pkt_len);
93162306a36Sopenharmony_ci		ice_pkt_insert_u16(pkt, ICE_IPV4_UDP_DST_PORT_OFFSET,
93262306a36Sopenharmony_ci				   htons(tnl_port));
93362306a36Sopenharmony_ci		loc = &pkt[ICE_FDIR_TUN_PKT_OFF];
93462306a36Sopenharmony_ci	}
93562306a36Sopenharmony_ci
93662306a36Sopenharmony_ci	/* Reverse the src and dst, since the HW expects them to be from Tx
93762306a36Sopenharmony_ci	 * perspective. The input from user is from Rx filter perspective.
93862306a36Sopenharmony_ci	 */
93962306a36Sopenharmony_ci	switch (flow) {
94062306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_TCP:
94162306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
94262306a36Sopenharmony_ci				   input->ip.v4.src_ip);
94362306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV4_TCP_DST_PORT_OFFSET,
94462306a36Sopenharmony_ci				   input->ip.v4.src_port);
94562306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
94662306a36Sopenharmony_ci				   input->ip.v4.dst_ip);
94762306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV4_TCP_SRC_PORT_OFFSET,
94862306a36Sopenharmony_ci				   input->ip.v4.dst_port);
94962306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TOS_OFFSET, input->ip.v4.tos);
95062306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TTL_OFFSET, input->ip.v4.ttl);
95162306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
95262306a36Sopenharmony_ci		if (frag)
95362306a36Sopenharmony_ci			loc[20] = ICE_FDIR_IPV4_PKT_FLAG_MF;
95462306a36Sopenharmony_ci		break;
95562306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_UDP:
95662306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
95762306a36Sopenharmony_ci				   input->ip.v4.src_ip);
95862306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV4_UDP_DST_PORT_OFFSET,
95962306a36Sopenharmony_ci				   input->ip.v4.src_port);
96062306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
96162306a36Sopenharmony_ci				   input->ip.v4.dst_ip);
96262306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV4_UDP_SRC_PORT_OFFSET,
96362306a36Sopenharmony_ci				   input->ip.v4.dst_port);
96462306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TOS_OFFSET, input->ip.v4.tos);
96562306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TTL_OFFSET, input->ip.v4.ttl);
96662306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
96762306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc + ETH_ALEN,
96862306a36Sopenharmony_ci					input->ext_data.src_mac);
96962306a36Sopenharmony_ci		break;
97062306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_SCTP:
97162306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
97262306a36Sopenharmony_ci				   input->ip.v4.src_ip);
97362306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV4_SCTP_DST_PORT_OFFSET,
97462306a36Sopenharmony_ci				   input->ip.v4.src_port);
97562306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
97662306a36Sopenharmony_ci				   input->ip.v4.dst_ip);
97762306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV4_SCTP_SRC_PORT_OFFSET,
97862306a36Sopenharmony_ci				   input->ip.v4.dst_port);
97962306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TOS_OFFSET, input->ip.v4.tos);
98062306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TTL_OFFSET, input->ip.v4.ttl);
98162306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
98262306a36Sopenharmony_ci		break;
98362306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_OTHER:
98462306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
98562306a36Sopenharmony_ci				   input->ip.v4.src_ip);
98662306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
98762306a36Sopenharmony_ci				   input->ip.v4.dst_ip);
98862306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TOS_OFFSET, input->ip.v4.tos);
98962306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_TTL_OFFSET, input->ip.v4.ttl);
99062306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV4_PROTO_OFFSET,
99162306a36Sopenharmony_ci				  input->ip.v4.proto);
99262306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
99362306a36Sopenharmony_ci		break;
99462306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_UDP:
99562306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_TCP:
99662306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_ICMP:
99762306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_GTPU_IPV4_OTHER:
99862306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
99962306a36Sopenharmony_ci				   input->ip.v4.src_ip);
100062306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
100162306a36Sopenharmony_ci				   input->ip.v4.dst_ip);
100262306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_GTPU_TEID_OFFSET,
100362306a36Sopenharmony_ci				   input->gtpu_data.teid);
100462306a36Sopenharmony_ci		ice_pkt_insert_u6_qfi(loc, ICE_IPV4_GTPU_QFI_OFFSET,
100562306a36Sopenharmony_ci				      input->gtpu_data.qfi);
100662306a36Sopenharmony_ci		break;
100762306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_L2TPV3:
100862306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_L2TPV3_SESS_ID_OFFSET,
100962306a36Sopenharmony_ci				   input->l2tpv3_data.session_id);
101062306a36Sopenharmony_ci		break;
101162306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_L2TPV3:
101262306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV6_L2TPV3_SESS_ID_OFFSET,
101362306a36Sopenharmony_ci				   input->l2tpv3_data.session_id);
101462306a36Sopenharmony_ci		break;
101562306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_ESP:
101662306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_ESP_SPI_OFFSET,
101762306a36Sopenharmony_ci				   input->ip.v4.sec_parm_idx);
101862306a36Sopenharmony_ci		break;
101962306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_ESP:
102062306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV6_ESP_SPI_OFFSET,
102162306a36Sopenharmony_ci				   input->ip.v6.sec_parm_idx);
102262306a36Sopenharmony_ci		break;
102362306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_AH:
102462306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_AH_SPI_OFFSET,
102562306a36Sopenharmony_ci				   input->ip.v4.sec_parm_idx);
102662306a36Sopenharmony_ci		break;
102762306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_AH:
102862306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV6_AH_SPI_OFFSET,
102962306a36Sopenharmony_ci				   input->ip.v6.sec_parm_idx);
103062306a36Sopenharmony_ci		break;
103162306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_NAT_T_ESP:
103262306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_DST_ADDR_OFFSET,
103362306a36Sopenharmony_ci				   input->ip.v4.src_ip);
103462306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_SRC_ADDR_OFFSET,
103562306a36Sopenharmony_ci				   input->ip.v4.dst_ip);
103662306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV4_NAT_T_ESP_SPI_OFFSET,
103762306a36Sopenharmony_ci				   input->ip.v4.sec_parm_idx);
103862306a36Sopenharmony_ci		break;
103962306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_NAT_T_ESP:
104062306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
104162306a36Sopenharmony_ci					 input->ip.v6.src_ip);
104262306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
104362306a36Sopenharmony_ci					 input->ip.v6.dst_ip);
104462306a36Sopenharmony_ci		ice_pkt_insert_u32(loc, ICE_IPV6_NAT_T_ESP_SPI_OFFSET,
104562306a36Sopenharmony_ci				   input->ip.v6.sec_parm_idx);
104662306a36Sopenharmony_ci		break;
104762306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_PFCP_NODE:
104862306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV4_PFCP_SESSION:
104962306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV4_UDP_SRC_PORT_OFFSET,
105062306a36Sopenharmony_ci				   input->ip.v4.dst_port);
105162306a36Sopenharmony_ci		break;
105262306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_PFCP_NODE:
105362306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_PFCP_SESSION:
105462306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV6_UDP_SRC_PORT_OFFSET,
105562306a36Sopenharmony_ci				   input->ip.v6.dst_port);
105662306a36Sopenharmony_ci		break;
105762306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NON_IP_L2:
105862306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_MAC_ETHTYPE_OFFSET,
105962306a36Sopenharmony_ci				   input->ext_data.ether_type);
106062306a36Sopenharmony_ci		break;
106162306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_TCP:
106262306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
106362306a36Sopenharmony_ci					 input->ip.v6.src_ip);
106462306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
106562306a36Sopenharmony_ci					 input->ip.v6.dst_ip);
106662306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV6_TCP_DST_PORT_OFFSET,
106762306a36Sopenharmony_ci				   input->ip.v6.src_port);
106862306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV6_TCP_SRC_PORT_OFFSET,
106962306a36Sopenharmony_ci				   input->ip.v6.dst_port);
107062306a36Sopenharmony_ci		ice_pkt_insert_u8_tc(loc, ICE_IPV6_TC_OFFSET, input->ip.v6.tc);
107162306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV6_HLIM_OFFSET, input->ip.v6.hlim);
107262306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
107362306a36Sopenharmony_ci		break;
107462306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_UDP:
107562306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
107662306a36Sopenharmony_ci					 input->ip.v6.src_ip);
107762306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
107862306a36Sopenharmony_ci					 input->ip.v6.dst_ip);
107962306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV6_UDP_DST_PORT_OFFSET,
108062306a36Sopenharmony_ci				   input->ip.v6.src_port);
108162306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV6_UDP_SRC_PORT_OFFSET,
108262306a36Sopenharmony_ci				   input->ip.v6.dst_port);
108362306a36Sopenharmony_ci		ice_pkt_insert_u8_tc(loc, ICE_IPV6_TC_OFFSET, input->ip.v6.tc);
108462306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV6_HLIM_OFFSET, input->ip.v6.hlim);
108562306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
108662306a36Sopenharmony_ci		break;
108762306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_SCTP:
108862306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
108962306a36Sopenharmony_ci					 input->ip.v6.src_ip);
109062306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
109162306a36Sopenharmony_ci					 input->ip.v6.dst_ip);
109262306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV6_SCTP_DST_PORT_OFFSET,
109362306a36Sopenharmony_ci				   input->ip.v6.src_port);
109462306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, ICE_IPV6_SCTP_SRC_PORT_OFFSET,
109562306a36Sopenharmony_ci				   input->ip.v6.dst_port);
109662306a36Sopenharmony_ci		ice_pkt_insert_u8_tc(loc, ICE_IPV6_TC_OFFSET, input->ip.v6.tc);
109762306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV6_HLIM_OFFSET, input->ip.v6.hlim);
109862306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
109962306a36Sopenharmony_ci		break;
110062306a36Sopenharmony_ci	case ICE_FLTR_PTYPE_NONF_IPV6_OTHER:
110162306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_DST_ADDR_OFFSET,
110262306a36Sopenharmony_ci					 input->ip.v6.src_ip);
110362306a36Sopenharmony_ci		ice_pkt_insert_ipv6_addr(loc, ICE_IPV6_SRC_ADDR_OFFSET,
110462306a36Sopenharmony_ci					 input->ip.v6.dst_ip);
110562306a36Sopenharmony_ci		ice_pkt_insert_u8_tc(loc, ICE_IPV6_TC_OFFSET, input->ip.v6.tc);
110662306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV6_HLIM_OFFSET, input->ip.v6.hlim);
110762306a36Sopenharmony_ci		ice_pkt_insert_u8(loc, ICE_IPV6_PROTO_OFFSET,
110862306a36Sopenharmony_ci				  input->ip.v6.proto);
110962306a36Sopenharmony_ci		ice_pkt_insert_mac_addr(loc, input->ext_data.dst_mac);
111062306a36Sopenharmony_ci		break;
111162306a36Sopenharmony_ci	default:
111262306a36Sopenharmony_ci		return -EINVAL;
111362306a36Sopenharmony_ci	}
111462306a36Sopenharmony_ci
111562306a36Sopenharmony_ci	if (input->flex_fltr)
111662306a36Sopenharmony_ci		ice_pkt_insert_u16(loc, input->flex_offset, input->flex_word);
111762306a36Sopenharmony_ci
111862306a36Sopenharmony_ci	return 0;
111962306a36Sopenharmony_ci}
112062306a36Sopenharmony_ci
112162306a36Sopenharmony_ci/**
112262306a36Sopenharmony_ci * ice_fdir_has_frag - does flow type have 2 ptypes
112362306a36Sopenharmony_ci * @flow: flow ptype
112462306a36Sopenharmony_ci *
112562306a36Sopenharmony_ci * returns true is there is a fragment packet for this ptype
112662306a36Sopenharmony_ci */
112762306a36Sopenharmony_cibool ice_fdir_has_frag(enum ice_fltr_ptype flow)
112862306a36Sopenharmony_ci{
112962306a36Sopenharmony_ci	if (flow == ICE_FLTR_PTYPE_NONF_IPV4_OTHER)
113062306a36Sopenharmony_ci		return true;
113162306a36Sopenharmony_ci	else
113262306a36Sopenharmony_ci		return false;
113362306a36Sopenharmony_ci}
113462306a36Sopenharmony_ci
113562306a36Sopenharmony_ci/**
113662306a36Sopenharmony_ci * ice_fdir_find_fltr_by_idx - find filter with idx
113762306a36Sopenharmony_ci * @hw: pointer to hardware structure
113862306a36Sopenharmony_ci * @fltr_idx: index to find.
113962306a36Sopenharmony_ci *
114062306a36Sopenharmony_ci * Returns pointer to filter if found or null
114162306a36Sopenharmony_ci */
114262306a36Sopenharmony_cistruct ice_fdir_fltr *
114362306a36Sopenharmony_ciice_fdir_find_fltr_by_idx(struct ice_hw *hw, u32 fltr_idx)
114462306a36Sopenharmony_ci{
114562306a36Sopenharmony_ci	struct ice_fdir_fltr *rule;
114662306a36Sopenharmony_ci
114762306a36Sopenharmony_ci	list_for_each_entry(rule, &hw->fdir_list_head, fltr_node) {
114862306a36Sopenharmony_ci		/* rule ID found in the list */
114962306a36Sopenharmony_ci		if (fltr_idx == rule->fltr_id)
115062306a36Sopenharmony_ci			return rule;
115162306a36Sopenharmony_ci		if (fltr_idx < rule->fltr_id)
115262306a36Sopenharmony_ci			break;
115362306a36Sopenharmony_ci	}
115462306a36Sopenharmony_ci	return NULL;
115562306a36Sopenharmony_ci}
115662306a36Sopenharmony_ci
115762306a36Sopenharmony_ci/**
115862306a36Sopenharmony_ci * ice_fdir_list_add_fltr - add a new node to the flow director filter list
115962306a36Sopenharmony_ci * @hw: hardware structure
116062306a36Sopenharmony_ci * @fltr: filter node to add to structure
116162306a36Sopenharmony_ci */
116262306a36Sopenharmony_civoid ice_fdir_list_add_fltr(struct ice_hw *hw, struct ice_fdir_fltr *fltr)
116362306a36Sopenharmony_ci{
116462306a36Sopenharmony_ci	struct ice_fdir_fltr *rule, *parent = NULL;
116562306a36Sopenharmony_ci
116662306a36Sopenharmony_ci	list_for_each_entry(rule, &hw->fdir_list_head, fltr_node) {
116762306a36Sopenharmony_ci		/* rule ID found or pass its spot in the list */
116862306a36Sopenharmony_ci		if (rule->fltr_id >= fltr->fltr_id)
116962306a36Sopenharmony_ci			break;
117062306a36Sopenharmony_ci		parent = rule;
117162306a36Sopenharmony_ci	}
117262306a36Sopenharmony_ci
117362306a36Sopenharmony_ci	if (parent)
117462306a36Sopenharmony_ci		list_add(&fltr->fltr_node, &parent->fltr_node);
117562306a36Sopenharmony_ci	else
117662306a36Sopenharmony_ci		list_add(&fltr->fltr_node, &hw->fdir_list_head);
117762306a36Sopenharmony_ci}
117862306a36Sopenharmony_ci
117962306a36Sopenharmony_ci/**
118062306a36Sopenharmony_ci * ice_fdir_update_cntrs - increment / decrement filter counter
118162306a36Sopenharmony_ci * @hw: pointer to hardware structure
118262306a36Sopenharmony_ci * @flow: filter flow type
118362306a36Sopenharmony_ci * @add: true implies filters added
118462306a36Sopenharmony_ci */
118562306a36Sopenharmony_civoid
118662306a36Sopenharmony_ciice_fdir_update_cntrs(struct ice_hw *hw, enum ice_fltr_ptype flow, bool add)
118762306a36Sopenharmony_ci{
118862306a36Sopenharmony_ci	int incr;
118962306a36Sopenharmony_ci
119062306a36Sopenharmony_ci	incr = add ? 1 : -1;
119162306a36Sopenharmony_ci	hw->fdir_active_fltr += incr;
119262306a36Sopenharmony_ci
119362306a36Sopenharmony_ci	if (flow == ICE_FLTR_PTYPE_NONF_NONE || flow >= ICE_FLTR_PTYPE_MAX)
119462306a36Sopenharmony_ci		ice_debug(hw, ICE_DBG_SW, "Unknown filter type %d\n", flow);
119562306a36Sopenharmony_ci	else
119662306a36Sopenharmony_ci		hw->fdir_fltr_cnt[flow] += incr;
119762306a36Sopenharmony_ci}
119862306a36Sopenharmony_ci
119962306a36Sopenharmony_ci/**
120062306a36Sopenharmony_ci * ice_cmp_ipv6_addr - compare 2 IP v6 addresses
120162306a36Sopenharmony_ci * @a: IP v6 address
120262306a36Sopenharmony_ci * @b: IP v6 address
120362306a36Sopenharmony_ci *
120462306a36Sopenharmony_ci * Returns 0 on equal, returns non-0 if different
120562306a36Sopenharmony_ci */
120662306a36Sopenharmony_cistatic int ice_cmp_ipv6_addr(__be32 *a, __be32 *b)
120762306a36Sopenharmony_ci{
120862306a36Sopenharmony_ci	return memcmp(a, b, 4 * sizeof(__be32));
120962306a36Sopenharmony_ci}
121062306a36Sopenharmony_ci
121162306a36Sopenharmony_ci/**
121262306a36Sopenharmony_ci * ice_fdir_comp_rules - compare 2 filters
121362306a36Sopenharmony_ci * @a: a Flow Director filter data structure
121462306a36Sopenharmony_ci * @b: a Flow Director filter data structure
121562306a36Sopenharmony_ci * @v6: bool true if v6 filter
121662306a36Sopenharmony_ci *
121762306a36Sopenharmony_ci * Returns true if the filters match
121862306a36Sopenharmony_ci */
121962306a36Sopenharmony_cistatic bool
122062306a36Sopenharmony_ciice_fdir_comp_rules(struct ice_fdir_fltr *a,  struct ice_fdir_fltr *b, bool v6)
122162306a36Sopenharmony_ci{
122262306a36Sopenharmony_ci	enum ice_fltr_ptype flow_type = a->flow_type;
122362306a36Sopenharmony_ci
122462306a36Sopenharmony_ci	/* The calling function already checks that the two filters have the
122562306a36Sopenharmony_ci	 * same flow_type.
122662306a36Sopenharmony_ci	 */
122762306a36Sopenharmony_ci	if (!v6) {
122862306a36Sopenharmony_ci		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_TCP ||
122962306a36Sopenharmony_ci		    flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP ||
123062306a36Sopenharmony_ci		    flow_type == ICE_FLTR_PTYPE_NONF_IPV4_SCTP) {
123162306a36Sopenharmony_ci			if (a->ip.v4.dst_ip == b->ip.v4.dst_ip &&
123262306a36Sopenharmony_ci			    a->ip.v4.src_ip == b->ip.v4.src_ip &&
123362306a36Sopenharmony_ci			    a->ip.v4.dst_port == b->ip.v4.dst_port &&
123462306a36Sopenharmony_ci			    a->ip.v4.src_port == b->ip.v4.src_port)
123562306a36Sopenharmony_ci				return true;
123662306a36Sopenharmony_ci		} else if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER) {
123762306a36Sopenharmony_ci			if (a->ip.v4.dst_ip == b->ip.v4.dst_ip &&
123862306a36Sopenharmony_ci			    a->ip.v4.src_ip == b->ip.v4.src_ip &&
123962306a36Sopenharmony_ci			    a->ip.v4.l4_header == b->ip.v4.l4_header &&
124062306a36Sopenharmony_ci			    a->ip.v4.proto == b->ip.v4.proto &&
124162306a36Sopenharmony_ci			    a->ip.v4.ip_ver == b->ip.v4.ip_ver &&
124262306a36Sopenharmony_ci			    a->ip.v4.tos == b->ip.v4.tos)
124362306a36Sopenharmony_ci				return true;
124462306a36Sopenharmony_ci		}
124562306a36Sopenharmony_ci	} else {
124662306a36Sopenharmony_ci		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV6_UDP ||
124762306a36Sopenharmony_ci		    flow_type == ICE_FLTR_PTYPE_NONF_IPV6_TCP ||
124862306a36Sopenharmony_ci		    flow_type == ICE_FLTR_PTYPE_NONF_IPV6_SCTP) {
124962306a36Sopenharmony_ci			if (a->ip.v6.dst_port == b->ip.v6.dst_port &&
125062306a36Sopenharmony_ci			    a->ip.v6.src_port == b->ip.v6.src_port &&
125162306a36Sopenharmony_ci			    !ice_cmp_ipv6_addr(a->ip.v6.dst_ip,
125262306a36Sopenharmony_ci					       b->ip.v6.dst_ip) &&
125362306a36Sopenharmony_ci			    !ice_cmp_ipv6_addr(a->ip.v6.src_ip,
125462306a36Sopenharmony_ci					       b->ip.v6.src_ip))
125562306a36Sopenharmony_ci				return true;
125662306a36Sopenharmony_ci		} else if (flow_type == ICE_FLTR_PTYPE_NONF_IPV6_OTHER) {
125762306a36Sopenharmony_ci			if (a->ip.v6.dst_port == b->ip.v6.dst_port &&
125862306a36Sopenharmony_ci			    a->ip.v6.src_port == b->ip.v6.src_port)
125962306a36Sopenharmony_ci				return true;
126062306a36Sopenharmony_ci		}
126162306a36Sopenharmony_ci	}
126262306a36Sopenharmony_ci
126362306a36Sopenharmony_ci	return false;
126462306a36Sopenharmony_ci}
126562306a36Sopenharmony_ci
126662306a36Sopenharmony_ci/**
126762306a36Sopenharmony_ci * ice_fdir_is_dup_fltr - test if filter is already in list for PF
126862306a36Sopenharmony_ci * @hw: hardware data structure
126962306a36Sopenharmony_ci * @input: Flow Director filter data structure
127062306a36Sopenharmony_ci *
127162306a36Sopenharmony_ci * Returns true if the filter is found in the list
127262306a36Sopenharmony_ci */
127362306a36Sopenharmony_cibool ice_fdir_is_dup_fltr(struct ice_hw *hw, struct ice_fdir_fltr *input)
127462306a36Sopenharmony_ci{
127562306a36Sopenharmony_ci	struct ice_fdir_fltr *rule;
127662306a36Sopenharmony_ci	bool ret = false;
127762306a36Sopenharmony_ci
127862306a36Sopenharmony_ci	list_for_each_entry(rule, &hw->fdir_list_head, fltr_node) {
127962306a36Sopenharmony_ci		enum ice_fltr_ptype flow_type;
128062306a36Sopenharmony_ci
128162306a36Sopenharmony_ci		if (rule->flow_type != input->flow_type)
128262306a36Sopenharmony_ci			continue;
128362306a36Sopenharmony_ci
128462306a36Sopenharmony_ci		flow_type = input->flow_type;
128562306a36Sopenharmony_ci		if (flow_type == ICE_FLTR_PTYPE_NONF_IPV4_TCP ||
128662306a36Sopenharmony_ci		    flow_type == ICE_FLTR_PTYPE_NONF_IPV4_UDP ||
128762306a36Sopenharmony_ci		    flow_type == ICE_FLTR_PTYPE_NONF_IPV4_SCTP ||
128862306a36Sopenharmony_ci		    flow_type == ICE_FLTR_PTYPE_NONF_IPV4_OTHER)
128962306a36Sopenharmony_ci			ret = ice_fdir_comp_rules(rule, input, false);
129062306a36Sopenharmony_ci		else
129162306a36Sopenharmony_ci			ret = ice_fdir_comp_rules(rule, input, true);
129262306a36Sopenharmony_ci		if (ret) {
129362306a36Sopenharmony_ci			if (rule->fltr_id == input->fltr_id &&
129462306a36Sopenharmony_ci			    rule->q_index != input->q_index)
129562306a36Sopenharmony_ci				ret = false;
129662306a36Sopenharmony_ci			else
129762306a36Sopenharmony_ci				break;
129862306a36Sopenharmony_ci		}
129962306a36Sopenharmony_ci	}
130062306a36Sopenharmony_ci
130162306a36Sopenharmony_ci	return ret;
130262306a36Sopenharmony_ci}
1303