Lines Matching +full:protocol +full:- +full:id
1 // SPDX-License-Identifier: GPL-2.0
31 * iavf_validate_fdir_fltr_masks - validate Flow Director filter fields masks
41 if (fltr->eth_mask.etype && fltr->eth_mask.etype != htons(U16_MAX)) in iavf_validate_fdir_fltr_masks()
44 if (fltr->ip_ver == 4) { in iavf_validate_fdir_fltr_masks()
45 if (fltr->ip_mask.v4_addrs.src_ip && in iavf_validate_fdir_fltr_masks()
46 fltr->ip_mask.v4_addrs.src_ip != htonl(U32_MAX)) in iavf_validate_fdir_fltr_masks()
49 if (fltr->ip_mask.v4_addrs.dst_ip && in iavf_validate_fdir_fltr_masks()
50 fltr->ip_mask.v4_addrs.dst_ip != htonl(U32_MAX)) in iavf_validate_fdir_fltr_masks()
53 if (fltr->ip_mask.tos && fltr->ip_mask.tos != U8_MAX) in iavf_validate_fdir_fltr_masks()
55 } else if (fltr->ip_ver == 6) { in iavf_validate_fdir_fltr_masks()
56 if (memcmp(&fltr->ip_mask.v6_addrs.src_ip, &ipv6_addr_zero_mask, in iavf_validate_fdir_fltr_masks()
58 memcmp(&fltr->ip_mask.v6_addrs.src_ip, &ipv6_addr_full_mask, in iavf_validate_fdir_fltr_masks()
62 if (memcmp(&fltr->ip_mask.v6_addrs.dst_ip, &ipv6_addr_zero_mask, in iavf_validate_fdir_fltr_masks()
64 memcmp(&fltr->ip_mask.v6_addrs.dst_ip, &ipv6_addr_full_mask, in iavf_validate_fdir_fltr_masks()
68 if (fltr->ip_mask.tclass && fltr->ip_mask.tclass != U8_MAX) in iavf_validate_fdir_fltr_masks()
72 if (fltr->ip_mask.proto && fltr->ip_mask.proto != U8_MAX) in iavf_validate_fdir_fltr_masks()
75 if (fltr->ip_mask.src_port && fltr->ip_mask.src_port != htons(U16_MAX)) in iavf_validate_fdir_fltr_masks()
78 if (fltr->ip_mask.dst_port && fltr->ip_mask.dst_port != htons(U16_MAX)) in iavf_validate_fdir_fltr_masks()
81 if (fltr->ip_mask.spi && fltr->ip_mask.spi != htonl(U32_MAX)) in iavf_validate_fdir_fltr_masks()
84 if (fltr->ip_mask.l4_header && in iavf_validate_fdir_fltr_masks()
85 fltr->ip_mask.l4_header != htonl(U32_MAX)) in iavf_validate_fdir_fltr_masks()
91 …dev_err(&adapter->pdev->dev, "Failed to add Flow Director filter, partial masks are not supported\… in iavf_validate_fdir_fltr_masks()
92 return -EOPNOTSUPP; in iavf_validate_fdir_fltr_masks()
96 * iavf_pkt_udp_no_pay_len - the length of UDP packet without payload
102 (fltr->ip_ver == 4 ? sizeof(struct iphdr) : sizeof(struct ipv6hdr)) + in iavf_pkt_udp_no_pay_len()
107 * iavf_fill_fdir_gtpu_hdr - fill the GTP-U protocol header
109 * @proto_hdrs: Flow Director protocol headers data structure
111 * Returns 0 if the GTP-U protocol header is set successfully
117 struct virtchnl_proto_hdr *uhdr = &proto_hdrs->proto_hdr[proto_hdrs->count - 1]; in iavf_fill_fdir_gtpu_hdr()
118 struct virtchnl_proto_hdr *ghdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_gtpu_hdr()
127 for (i = 0; i < fltr->flex_cnt; i++) { in iavf_fill_fdir_gtpu_hdr()
138 if (fltr->flex_words[i].offset < adj_offs) in iavf_fill_fdir_gtpu_hdr()
139 return -EINVAL; in iavf_fill_fdir_gtpu_hdr()
141 hdr_offs = fltr->flex_words[i].offset - adj_offs; in iavf_fill_fdir_gtpu_hdr()
146 __be16 *pay_word = (__be16 *)ghdr->buffer; in iavf_fill_fdir_gtpu_hdr()
148 pay_word[hdr_offs >> 1] = htons(fltr->flex_words[i].word); in iavf_fill_fdir_gtpu_hdr()
153 if ((fltr->flex_words[i].word & in iavf_fill_fdir_gtpu_hdr()
156 return -EOPNOTSUPP; in iavf_fill_fdir_gtpu_hdr()
158 ehdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_gtpu_hdr()
163 return -EINVAL; in iavf_fill_fdir_gtpu_hdr()
164 ehdr->buffer[IAVF_GTPU_EH_QFI_IDX] = in iavf_fill_fdir_gtpu_hdr()
165 fltr->flex_words[i].word & in iavf_fill_fdir_gtpu_hdr()
170 return -EINVAL; in iavf_fill_fdir_gtpu_hdr()
174 uhdr->field_selector = 0; /* The PF ignores the UDP header fields */ in iavf_fill_fdir_gtpu_hdr()
180 * iavf_fill_fdir_pfcp_hdr - fill the PFCP protocol header
182 * @proto_hdrs: Flow Director protocol headers data structure
184 * Returns 0 if the PFCP protocol header is set successfully
190 struct virtchnl_proto_hdr *uhdr = &proto_hdrs->proto_hdr[proto_hdrs->count - 1]; in iavf_fill_fdir_pfcp_hdr()
191 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_pfcp_hdr()
199 for (i = 0; i < fltr->flex_cnt; i++) { in iavf_fill_fdir_pfcp_hdr()
201 if (fltr->flex_words[i].offset < adj_offs) in iavf_fill_fdir_pfcp_hdr()
202 return -EINVAL; in iavf_fill_fdir_pfcp_hdr()
204 hdr_offs = fltr->flex_words[i].offset - adj_offs; in iavf_fill_fdir_pfcp_hdr()
208 hdr->buffer[0] = (fltr->flex_words[i].word >> 8) & 0xff; in iavf_fill_fdir_pfcp_hdr()
212 return -EINVAL; in iavf_fill_fdir_pfcp_hdr()
216 uhdr->field_selector = 0; /* The PF ignores the UDP header fields */ in iavf_fill_fdir_pfcp_hdr()
222 * iavf_fill_fdir_nat_t_esp_hdr - fill the NAT-T-ESP protocol header
224 * @proto_hdrs: Flow Director protocol headers data structure
226 * Returns 0 if the NAT-T-ESP protocol header is set successfully
232 struct virtchnl_proto_hdr *uhdr = &proto_hdrs->proto_hdr[proto_hdrs->count - 1]; in iavf_fill_fdir_nat_t_esp_hdr()
233 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_nat_t_esp_hdr()
242 for (i = 0; i < fltr->flex_cnt; i++) { in iavf_fill_fdir_nat_t_esp_hdr()
245 if (fltr->flex_words[i].offset < adj_offs) in iavf_fill_fdir_nat_t_esp_hdr()
246 return -EINVAL; in iavf_fill_fdir_nat_t_esp_hdr()
248 hdr_offs = fltr->flex_words[i].offset - adj_offs; in iavf_fill_fdir_nat_t_esp_hdr()
252 spi |= fltr->flex_words[i].word << 16; in iavf_fill_fdir_nat_t_esp_hdr()
255 spi |= fltr->flex_words[i].word; in iavf_fill_fdir_nat_t_esp_hdr()
258 return -EINVAL; in iavf_fill_fdir_nat_t_esp_hdr()
263 return -EOPNOTSUPP; /* Not support IKE Header Format with SPI 0 */ in iavf_fill_fdir_nat_t_esp_hdr()
265 *(__be32 *)hdr->buffer = htonl(spi); in iavf_fill_fdir_nat_t_esp_hdr()
268 uhdr->field_selector = 0; /* The PF ignores the UDP header fields */ in iavf_fill_fdir_nat_t_esp_hdr()
274 * iavf_fill_fdir_udp_flex_pay_hdr - fill the UDP payload header
276 * @proto_hdrs: Flow Director protocol headers data structure
278 * Returns 0 if the UDP payload defined protocol header is set successfully
286 switch (ntohs(fltr->ip_data.dst_port)) { in iavf_fill_fdir_udp_flex_pay_hdr()
297 err = -EOPNOTSUPP; in iavf_fill_fdir_udp_flex_pay_hdr()
305 * iavf_fill_fdir_ip4_hdr - fill the IPv4 protocol header
307 * @proto_hdrs: Flow Director protocol headers data structure
309 * Returns 0 if the IPv4 protocol header is set successfully
315 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_ip4_hdr()
316 struct iphdr *iph = (struct iphdr *)hdr->buffer; in iavf_fill_fdir_ip4_hdr()
320 if (fltr->ip_mask.tos == U8_MAX) { in iavf_fill_fdir_ip4_hdr()
321 iph->tos = fltr->ip_data.tos; in iavf_fill_fdir_ip4_hdr()
325 if (fltr->ip_mask.proto == U8_MAX) { in iavf_fill_fdir_ip4_hdr()
326 iph->protocol = fltr->ip_data.proto; in iavf_fill_fdir_ip4_hdr()
330 if (fltr->ip_mask.v4_addrs.src_ip == htonl(U32_MAX)) { in iavf_fill_fdir_ip4_hdr()
331 iph->saddr = fltr->ip_data.v4_addrs.src_ip; in iavf_fill_fdir_ip4_hdr()
335 if (fltr->ip_mask.v4_addrs.dst_ip == htonl(U32_MAX)) { in iavf_fill_fdir_ip4_hdr()
336 iph->daddr = fltr->ip_data.v4_addrs.dst_ip; in iavf_fill_fdir_ip4_hdr()
344 * iavf_fill_fdir_ip6_hdr - fill the IPv6 protocol header
346 * @proto_hdrs: Flow Director protocol headers data structure
348 * Returns 0 if the IPv6 protocol header is set successfully
354 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_ip6_hdr()
355 struct ipv6hdr *iph = (struct ipv6hdr *)hdr->buffer; in iavf_fill_fdir_ip6_hdr()
359 if (fltr->ip_mask.tclass == U8_MAX) { in iavf_fill_fdir_ip6_hdr()
360 iph->priority = (fltr->ip_data.tclass >> 4) & 0xF; in iavf_fill_fdir_ip6_hdr()
361 iph->flow_lbl[0] = FIELD_PREP(0xF0, fltr->ip_data.tclass); in iavf_fill_fdir_ip6_hdr()
365 if (fltr->ip_mask.proto == U8_MAX) { in iavf_fill_fdir_ip6_hdr()
366 iph->nexthdr = fltr->ip_data.proto; in iavf_fill_fdir_ip6_hdr()
370 if (!memcmp(&fltr->ip_mask.v6_addrs.src_ip, &ipv6_addr_full_mask, in iavf_fill_fdir_ip6_hdr()
372 memcpy(&iph->saddr, &fltr->ip_data.v6_addrs.src_ip, in iavf_fill_fdir_ip6_hdr()
377 if (!memcmp(&fltr->ip_mask.v6_addrs.dst_ip, &ipv6_addr_full_mask, in iavf_fill_fdir_ip6_hdr()
379 memcpy(&iph->daddr, &fltr->ip_data.v6_addrs.dst_ip, in iavf_fill_fdir_ip6_hdr()
388 * iavf_fill_fdir_tcp_hdr - fill the TCP protocol header
390 * @proto_hdrs: Flow Director protocol headers data structure
392 * Returns 0 if the TCP protocol header is set successfully
398 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_tcp_hdr()
399 struct tcphdr *tcph = (struct tcphdr *)hdr->buffer; in iavf_fill_fdir_tcp_hdr()
403 if (fltr->ip_mask.src_port == htons(U16_MAX)) { in iavf_fill_fdir_tcp_hdr()
404 tcph->source = fltr->ip_data.src_port; in iavf_fill_fdir_tcp_hdr()
408 if (fltr->ip_mask.dst_port == htons(U16_MAX)) { in iavf_fill_fdir_tcp_hdr()
409 tcph->dest = fltr->ip_data.dst_port; in iavf_fill_fdir_tcp_hdr()
417 * iavf_fill_fdir_udp_hdr - fill the UDP protocol header
419 * @proto_hdrs: Flow Director protocol headers data structure
421 * Returns 0 if the UDP protocol header is set successfully
427 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_udp_hdr()
428 struct udphdr *udph = (struct udphdr *)hdr->buffer; in iavf_fill_fdir_udp_hdr()
432 if (fltr->ip_mask.src_port == htons(U16_MAX)) { in iavf_fill_fdir_udp_hdr()
433 udph->source = fltr->ip_data.src_port; in iavf_fill_fdir_udp_hdr()
437 if (fltr->ip_mask.dst_port == htons(U16_MAX)) { in iavf_fill_fdir_udp_hdr()
438 udph->dest = fltr->ip_data.dst_port; in iavf_fill_fdir_udp_hdr()
442 if (!fltr->flex_cnt) in iavf_fill_fdir_udp_hdr()
449 * iavf_fill_fdir_sctp_hdr - fill the SCTP protocol header
451 * @proto_hdrs: Flow Director protocol headers data structure
453 * Returns 0 if the SCTP protocol header is set successfully
459 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_sctp_hdr()
460 struct sctphdr *sctph = (struct sctphdr *)hdr->buffer; in iavf_fill_fdir_sctp_hdr()
464 if (fltr->ip_mask.src_port == htons(U16_MAX)) { in iavf_fill_fdir_sctp_hdr()
465 sctph->source = fltr->ip_data.src_port; in iavf_fill_fdir_sctp_hdr()
469 if (fltr->ip_mask.dst_port == htons(U16_MAX)) { in iavf_fill_fdir_sctp_hdr()
470 sctph->dest = fltr->ip_data.dst_port; in iavf_fill_fdir_sctp_hdr()
478 * iavf_fill_fdir_ah_hdr - fill the AH protocol header
480 * @proto_hdrs: Flow Director protocol headers data structure
482 * Returns 0 if the AH protocol header is set successfully
488 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_ah_hdr()
489 struct ip_auth_hdr *ah = (struct ip_auth_hdr *)hdr->buffer; in iavf_fill_fdir_ah_hdr()
493 if (fltr->ip_mask.spi == htonl(U32_MAX)) { in iavf_fill_fdir_ah_hdr()
494 ah->spi = fltr->ip_data.spi; in iavf_fill_fdir_ah_hdr()
502 * iavf_fill_fdir_esp_hdr - fill the ESP protocol header
504 * @proto_hdrs: Flow Director protocol headers data structure
506 * Returns 0 if the ESP protocol header is set successfully
512 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_esp_hdr()
513 struct ip_esp_hdr *esph = (struct ip_esp_hdr *)hdr->buffer; in iavf_fill_fdir_esp_hdr()
517 if (fltr->ip_mask.spi == htonl(U32_MAX)) { in iavf_fill_fdir_esp_hdr()
518 esph->spi = fltr->ip_data.spi; in iavf_fill_fdir_esp_hdr()
526 * iavf_fill_fdir_l4_hdr - fill the L4 protocol header
528 * @proto_hdrs: Flow Director protocol headers data structure
530 * Returns 0 if the L4 protocol header is set successfully
539 if (!fltr->ip_mask.proto) /* IPv4/IPv6 header only */ in iavf_fill_fdir_l4_hdr()
542 hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_l4_hdr()
543 l4_4_data = (__be32 *)hdr->buffer; in iavf_fill_fdir_l4_hdr()
545 /* L2TPv3 over IP with 'Session ID' */ in iavf_fill_fdir_l4_hdr()
546 if (fltr->ip_data.proto == 115 && fltr->ip_mask.l4_header == htonl(U32_MAX)) { in iavf_fill_fdir_l4_hdr()
550 *l4_4_data = fltr->ip_data.l4_header; in iavf_fill_fdir_l4_hdr()
552 return -EOPNOTSUPP; in iavf_fill_fdir_l4_hdr()
559 * iavf_fill_fdir_eth_hdr - fill the Ethernet protocol header
561 * @proto_hdrs: Flow Director protocol headers data structure
563 * Returns 0 if the Ethernet protocol header is set successfully
569 struct virtchnl_proto_hdr *hdr = &proto_hdrs->proto_hdr[proto_hdrs->count++]; in iavf_fill_fdir_eth_hdr()
570 struct ethhdr *ehdr = (struct ethhdr *)hdr->buffer; in iavf_fill_fdir_eth_hdr()
574 if (fltr->eth_mask.etype == htons(U16_MAX)) { in iavf_fill_fdir_eth_hdr()
575 if (fltr->eth_data.etype == htons(ETH_P_IP) || in iavf_fill_fdir_eth_hdr()
576 fltr->eth_data.etype == htons(ETH_P_IPV6)) in iavf_fill_fdir_eth_hdr()
577 return -EOPNOTSUPP; in iavf_fill_fdir_eth_hdr()
579 ehdr->h_proto = fltr->eth_data.etype; in iavf_fill_fdir_eth_hdr()
587 * iavf_fill_fdir_add_msg - fill the Flow Director filter into virtchnl message
595 struct virtchnl_fdir_add *vc_msg = &fltr->vc_add_msg; in iavf_fill_fdir_add_msg()
599 proto_hdrs = &vc_msg->rule_cfg.proto_hdrs; in iavf_fill_fdir_add_msg()
605 switch (fltr->flow_type) { in iavf_fill_fdir_add_msg()
657 err = -EINVAL; in iavf_fill_fdir_add_msg()
664 vc_msg->vsi_id = adapter->vsi.id; in iavf_fill_fdir_add_msg()
665 vc_msg->rule_cfg.action_set.count = 1; in iavf_fill_fdir_add_msg()
666 vc_msg->rule_cfg.action_set.actions[0].type = fltr->action; in iavf_fill_fdir_add_msg()
667 vc_msg->rule_cfg.action_set.actions[0].act_conf.queue.index = fltr->q_index; in iavf_fill_fdir_add_msg()
673 * iavf_fdir_flow_proto_name - get the flow protocol name
713 const char *proto = iavf_fdir_flow_proto_name(fltr->flow_type); in iavf_print_fdir_fltr()
718 switch (fltr->flow_type) { in iavf_print_fdir_fltr()
722 …dev_info(&adapter->pdev->dev, "Rule ID: %u dst_ip: %pI4 src_ip %pI4 %s: dst_port %hu src_port %hu\… in iavf_print_fdir_fltr()
723 fltr->loc, in iavf_print_fdir_fltr()
724 &fltr->ip_data.v4_addrs.dst_ip, in iavf_print_fdir_fltr()
725 &fltr->ip_data.v4_addrs.src_ip, in iavf_print_fdir_fltr()
727 ntohs(fltr->ip_data.dst_port), in iavf_print_fdir_fltr()
728 ntohs(fltr->ip_data.src_port)); in iavf_print_fdir_fltr()
732 dev_info(&adapter->pdev->dev, "Rule ID: %u dst_ip: %pI4 src_ip %pI4 %s: SPI %u\n", in iavf_print_fdir_fltr()
733 fltr->loc, in iavf_print_fdir_fltr()
734 &fltr->ip_data.v4_addrs.dst_ip, in iavf_print_fdir_fltr()
735 &fltr->ip_data.v4_addrs.src_ip, in iavf_print_fdir_fltr()
737 ntohl(fltr->ip_data.spi)); in iavf_print_fdir_fltr()
740 dev_info(&adapter->pdev->dev, "Rule ID: %u dst_ip: %pI4 src_ip %pI4 proto: %u L4_bytes: 0x%x\n", in iavf_print_fdir_fltr()
741 fltr->loc, in iavf_print_fdir_fltr()
742 &fltr->ip_data.v4_addrs.dst_ip, in iavf_print_fdir_fltr()
743 &fltr->ip_data.v4_addrs.src_ip, in iavf_print_fdir_fltr()
744 fltr->ip_data.proto, in iavf_print_fdir_fltr()
745 ntohl(fltr->ip_data.l4_header)); in iavf_print_fdir_fltr()
750 …dev_info(&adapter->pdev->dev, "Rule ID: %u dst_ip: %pI6 src_ip %pI6 %s: dst_port %hu src_port %hu\… in iavf_print_fdir_fltr()
751 fltr->loc, in iavf_print_fdir_fltr()
752 &fltr->ip_data.v6_addrs.dst_ip, in iavf_print_fdir_fltr()
753 &fltr->ip_data.v6_addrs.src_ip, in iavf_print_fdir_fltr()
755 ntohs(fltr->ip_data.dst_port), in iavf_print_fdir_fltr()
756 ntohs(fltr->ip_data.src_port)); in iavf_print_fdir_fltr()
760 dev_info(&adapter->pdev->dev, "Rule ID: %u dst_ip: %pI6 src_ip %pI6 %s: SPI %u\n", in iavf_print_fdir_fltr()
761 fltr->loc, in iavf_print_fdir_fltr()
762 &fltr->ip_data.v6_addrs.dst_ip, in iavf_print_fdir_fltr()
763 &fltr->ip_data.v6_addrs.src_ip, in iavf_print_fdir_fltr()
765 ntohl(fltr->ip_data.spi)); in iavf_print_fdir_fltr()
768 dev_info(&adapter->pdev->dev, "Rule ID: %u dst_ip: %pI6 src_ip %pI6 proto: %u L4_bytes: 0x%x\n", in iavf_print_fdir_fltr()
769 fltr->loc, in iavf_print_fdir_fltr()
770 &fltr->ip_data.v6_addrs.dst_ip, in iavf_print_fdir_fltr()
771 &fltr->ip_data.v6_addrs.src_ip, in iavf_print_fdir_fltr()
772 fltr->ip_data.proto, in iavf_print_fdir_fltr()
773 ntohl(fltr->ip_data.l4_header)); in iavf_print_fdir_fltr()
776 dev_info(&adapter->pdev->dev, "Rule ID: %u eth_type: 0x%x\n", in iavf_print_fdir_fltr()
777 fltr->loc, in iavf_print_fdir_fltr()
778 ntohs(fltr->eth_data.etype)); in iavf_print_fdir_fltr()
786 * iavf_fdir_is_dup_fltr - test if filter is already in list
797 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_fdir_is_dup_fltr()
798 list_for_each_entry(tmp, &adapter->fdir_list_head, list) { in iavf_fdir_is_dup_fltr()
802 if (tmp->flow_type != fltr->flow_type) in iavf_fdir_is_dup_fltr()
805 if (!memcmp(&tmp->eth_data, &fltr->eth_data, in iavf_fdir_is_dup_fltr()
806 sizeof(fltr->eth_data)) && in iavf_fdir_is_dup_fltr()
807 !memcmp(&tmp->ip_data, &fltr->ip_data, in iavf_fdir_is_dup_fltr()
808 sizeof(fltr->ip_data)) && in iavf_fdir_is_dup_fltr()
809 !memcmp(&tmp->ext_data, &fltr->ext_data, in iavf_fdir_is_dup_fltr()
810 sizeof(fltr->ext_data))) { in iavf_fdir_is_dup_fltr()
815 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_fdir_is_dup_fltr()
821 * iavf_find_fdir_fltr - find FDIR filter
824 * @data: data to ID the filter, type dependent
833 list_for_each_entry(rule, &adapter->fdir_list_head, list) { in iavf_find_fdir_fltr()
834 if ((is_raw && rule->cls_u32_handle == data) || in iavf_find_fdir_fltr()
835 (!is_raw && rule->loc == data)) in iavf_find_fdir_fltr()
843 * iavf_fdir_add_fltr - add a new node to the flow director filter list
854 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_fdir_add_fltr()
856 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_fdir_add_fltr()
857 dev_err(&adapter->pdev->dev, in iavf_fdir_add_fltr()
860 return -ENOSPC; in iavf_fdir_add_fltr()
863 list_for_each_entry(rule, &adapter->fdir_list_head, list) { in iavf_fdir_add_fltr()
867 if (rule->loc >= fltr->loc) in iavf_fdir_add_fltr()
873 list_add(&fltr->list, &parent->list); in iavf_fdir_add_fltr()
875 list_add(&fltr->list, &adapter->fdir_list_head); in iavf_fdir_add_fltr()
879 if (adapter->link_up) in iavf_fdir_add_fltr()
880 fltr->state = IAVF_FDIR_FLTR_ADD_REQUEST; in iavf_fdir_add_fltr()
882 fltr->state = IAVF_FDIR_FLTR_INACTIVE; in iavf_fdir_add_fltr()
883 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_fdir_add_fltr()
885 if (adapter->link_up) in iavf_fdir_add_fltr()
892 * iavf_fdir_del_fltr - delete a flow director filter from the list
895 * @data: data to ID the filter, type dependent
904 spin_lock_bh(&adapter->fdir_fltr_lock); in iavf_fdir_del_fltr()
908 if (fltr->state == IAVF_FDIR_FLTR_ACTIVE) { in iavf_fdir_del_fltr()
909 fltr->state = IAVF_FDIR_FLTR_DEL_REQUEST; in iavf_fdir_del_fltr()
910 } else if (fltr->state == IAVF_FDIR_FLTR_INACTIVE) { in iavf_fdir_del_fltr()
911 list_del(&fltr->list); in iavf_fdir_del_fltr()
916 err = -EBUSY; in iavf_fdir_del_fltr()
918 } else if (adapter->fdir_active_fltr) { in iavf_fdir_del_fltr()
919 err = -EINVAL; in iavf_fdir_del_fltr()
922 if (fltr && fltr->state == IAVF_FDIR_FLTR_DEL_REQUEST) in iavf_fdir_del_fltr()
925 spin_unlock_bh(&adapter->fdir_fltr_lock); in iavf_fdir_del_fltr()