-/*
- * Convert DPDK rte_eth_fdir_filter struct to ixgbe_atr_input union that is used
- * by the IXGBE driver code.
- */
-static int
-ixgbe_fdir_filter_to_atr_input(const struct rte_eth_fdir_filter *fdir_filter,
- union ixgbe_atr_input *input, enum rte_fdir_mode mode)
-{
- input->formatted.vlan_id = fdir_filter->input.flow_ext.vlan_tci;
- input->formatted.flex_bytes = (uint16_t)(
- (fdir_filter->input.flow_ext.flexbytes[1] << 8 & 0xFF00) |
- (fdir_filter->input.flow_ext.flexbytes[0] & 0xFF));
-
- switch (fdir_filter->input.flow_type) {
- case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_UDPV4;
- break;
- case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_TCPV4;
- break;
- case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_SCTPV4;
- break;
- case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV4;
- break;
- case RTE_ETH_FLOW_NONFRAG_IPV6_UDP:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_UDPV6;
- break;
- case RTE_ETH_FLOW_NONFRAG_IPV6_TCP:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_TCPV6;
- break;
- case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_SCTPV6;
- break;
- case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER:
- input->formatted.flow_type = IXGBE_ATR_FLOW_TYPE_IPV6;
- break;
- default:
- break;
- }
-
- switch (fdir_filter->input.flow_type) {
- case RTE_ETH_FLOW_NONFRAG_IPV4_UDP:
- case RTE_ETH_FLOW_NONFRAG_IPV4_TCP:
- input->formatted.src_port =
- fdir_filter->input.flow.udp4_flow.src_port;
- input->formatted.dst_port =
- fdir_filter->input.flow.udp4_flow.dst_port;
- /* fall-through */
- /*for SCTP flow type, port and verify_tag are meaningless in ixgbe.*/
- case RTE_ETH_FLOW_NONFRAG_IPV4_SCTP:
- case RTE_ETH_FLOW_NONFRAG_IPV4_OTHER:
- input->formatted.src_ip[0] =
- fdir_filter->input.flow.ip4_flow.src_ip;
- input->formatted.dst_ip[0] =
- fdir_filter->input.flow.ip4_flow.dst_ip;
- break;
-
- case RTE_ETH_FLOW_NONFRAG_IPV6_UDP:
- case RTE_ETH_FLOW_NONFRAG_IPV6_TCP:
- input->formatted.src_port =
- fdir_filter->input.flow.udp6_flow.src_port;
- input->formatted.dst_port =
- fdir_filter->input.flow.udp6_flow.dst_port;
- /* fall-through */
- /*for SCTP flow type, port and verify_tag are meaningless in ixgbe.*/
- case RTE_ETH_FLOW_NONFRAG_IPV6_SCTP:
- case RTE_ETH_FLOW_NONFRAG_IPV6_OTHER:
- rte_memcpy(input->formatted.src_ip,
- fdir_filter->input.flow.ipv6_flow.src_ip,
- sizeof(input->formatted.src_ip));
- rte_memcpy(input->formatted.dst_ip,
- fdir_filter->input.flow.ipv6_flow.dst_ip,
- sizeof(input->formatted.dst_ip));
- break;
- default:
- break;
- }
-
- if (mode == RTE_FDIR_MODE_PERFECT_MAC_VLAN) {
- rte_memcpy(
- input->formatted.inner_mac,
- fdir_filter->input.flow.mac_vlan_flow.mac_addr.addr_bytes,
- sizeof(input->formatted.inner_mac));
- } else if (mode == RTE_FDIR_MODE_PERFECT_TUNNEL) {
- rte_memcpy(
- input->formatted.inner_mac,
- fdir_filter->input.flow.tunnel_flow.mac_addr.addr_bytes,
- sizeof(input->formatted.inner_mac));
- input->formatted.tunnel_type =
- fdir_filter->input.flow.tunnel_flow.tunnel_type;
- input->formatted.tni_vni =
- fdir_filter->input.flow.tunnel_flow.tunnel_id;
- }
-
- return 0;
-}
-