net/i40e: refine consistent tunnel filter
authorBeilei Xing <beilei.xing@intel.com>
Tue, 28 Mar 2017 09:28:44 +0000 (17:28 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:56 +0000 (19:02 +0200)
Add i40e_tunnel_type enumeration type to refine consistent
tunnel filter, it will be esay to add new tunnel type for
i40e.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_ethdev.h
drivers/net/i40e/i40e_flow.c

index ea9e0fe..32c9b70 100644 (file)
@@ -6974,7 +6974,7 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 
        pfilter->element.inner_vlan =
                rte_cpu_to_le_16(tunnel_filter->inner_vlan);
-       if (tunnel_filter->ip_type == RTE_TUNNEL_IPTYPE_IPV4) {
+       if (tunnel_filter->ip_type == I40E_TUNNEL_IPTYPE_IPV4) {
                ip_type = I40E_AQC_ADD_CLOUD_FLAGS_IPV4;
                ipv4_addr = rte_be_to_cpu_32(tunnel_filter->ip_addr.ipv4_addr);
                rte_memcpy(&pfilter->element.ipaddr.v4.data,
@@ -6994,13 +6994,13 @@ i40e_dev_consistent_tunnel_filter_set(struct i40e_pf *pf,
 
        /* check tunneled type */
        switch (tunnel_filter->tunnel_type) {
-       case RTE_TUNNEL_TYPE_VXLAN:
+       case I40E_TUNNEL_TYPE_VXLAN:
                tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_VXLAN;
                break;
-       case RTE_TUNNEL_TYPE_NVGRE:
+       case I40E_TUNNEL_TYPE_NVGRE:
                tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_NVGRE_OMAC;
                break;
-       case RTE_TUNNEL_TYPE_IP_IN_GRE:
+       case I40E_TUNNEL_TYPE_IP_IN_GRE:
                tun_type = I40E_AQC_ADD_CLOUD_TNL_TYPE_IP;
                break;
        default:
index e5c67df..9aacff7 100644 (file)
@@ -532,6 +532,20 @@ struct i40e_tunnel_rule {
        struct rte_hash *hash_table;
 };
 
+/**
+ * Tunnel type.
+ */
+enum i40e_tunnel_type {
+       I40E_TUNNEL_TYPE_NONE = 0,
+       I40E_TUNNEL_TYPE_VXLAN,
+       I40E_TUNNEL_TYPE_GENEVE,
+       I40E_TUNNEL_TYPE_TEREDO,
+       I40E_TUNNEL_TYPE_NVGRE,
+       I40E_TUNNEL_TYPE_IP_IN_GRE,
+       I40E_L2_TUNNEL_TYPE_E_TAG,
+       I40E_TUNNEL_TYPE_MAX,
+};
+
 /**
  * Tunneling Packet filter configuration.
  */
@@ -540,7 +554,7 @@ struct i40e_tunnel_filter_conf {
        struct ether_addr inner_mac;    /**< Inner MAC address to match. */
        uint16_t inner_vlan;            /**< Inner VLAN to match. */
        uint32_t outer_vlan;            /**< Outer VLAN to match */
-       enum rte_tunnel_iptype ip_type; /**< IP address type. */
+       enum i40e_tunnel_iptype ip_type; /**< IP address type. */
        /**
         * Outer destination IP address to match if ETH_TUNNEL_FILTER_OIP
         * is set in filter_type, or inner destination IP address to match
@@ -552,7 +566,7 @@ struct i40e_tunnel_filter_conf {
        } ip_addr;
        /** Flags from ETH_TUNNEL_FILTER_XX - see above. */
        uint16_t filter_type;
-       enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */
+       enum i40e_tunnel_type tunnel_type; /**< Tunnel Type. */
        uint32_t tenant_id;     /**< Tenant ID to match. VNI, GRE key... */
        uint16_t queue_id;      /**< Queue assigned to if match. */
        uint8_t is_to_vf;       /**< 0 - to PF, 1 - to VF */
index 2239c30..148e519 100644 (file)
@@ -1324,7 +1324,7 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev,
                        }
                        break;
                case RTE_FLOW_ITEM_TYPE_IPV4:
-                       filter->ip_type = RTE_TUNNEL_IPTYPE_IPV4;
+                       filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
                        /* IPv4 is used to describe protocol,
                         * spec and mask should be NULL.
                         */
@@ -1337,7 +1337,7 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev,
                        }
                        break;
                case RTE_FLOW_ITEM_TYPE_IPV6:
-                       filter->ip_type = RTE_TUNNEL_IPTYPE_IPV6;
+                       filter->ip_type = I40E_TUNNEL_IPTYPE_IPV6;
                        /* IPv6 is used to describe protocol,
                         * spec and mask should be NULL.
                         */
@@ -1480,7 +1480,7 @@ i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev,
                return -rte_errno;
        }
 
-       filter->tunnel_type = RTE_TUNNEL_TYPE_VXLAN;
+       filter->tunnel_type = I40E_TUNNEL_TYPE_VXLAN;
 
        return 0;
 }