net: add rte prefix to IP structure
[dpdk.git] / drivers / net / mlx5 / mlx5_flow_dv.c
index 7197c82..3aef9f6 100644 (file)
 #endif
 
 #ifndef HAVE_MLX5DV_DR_ESWITCH
+#ifndef MLX5DV_FLOW_TABLE_TYPE_FDB
 #define MLX5DV_FLOW_TABLE_TYPE_FDB 0
 #endif
+#endif
 
 #ifndef HAVE_MLX5DV_DR
 #define MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL 1
@@ -943,15 +945,15 @@ flow_dv_encap_decap_resource_register
        struct mlx5_ibv_shared *sh = priv->sh;
        struct mlx5_flow_dv_encap_decap_resource *cache_resource;
        struct rte_flow *flow = dev_flow->flow;
-       struct mlx5dv_dr_ns *ns;
+       struct mlx5dv_dr_domain *domain;
 
        resource->flags = flow->group ? 0 : 1;
        if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)
-               ns = sh->fdb_ns;
+               domain = sh->fdb_domain;
        else if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_RX)
-               ns = sh->rx_ns;
+               domain = sh->rx_domain;
        else
-               ns = sh->tx_ns;
+               domain = sh->tx_domain;
 
        /* Lookup a matching resource from cache. */
        LIST_FOREACH(cache_resource, &sh->encaps_decaps, next) {
@@ -980,7 +982,7 @@ flow_dv_encap_decap_resource_register
        cache_resource->verbs_action =
                mlx5_glue->dv_create_flow_action_packet_reformat
                        (sh->ctx, cache_resource->reformat_type,
-                        cache_resource->ft_type, ns, cache_resource->flags,
+                        cache_resource->ft_type, domain, cache_resource->flags,
                         cache_resource->size,
                         (cache_resource->size ? cache_resource->buf : NULL));
        if (!cache_resource->verbs_action) {
@@ -1108,8 +1110,8 @@ flow_dv_port_id_action_resource_register
                                          "cannot allocate resource memory");
        *cache_resource = *resource;
        cache_resource->action =
-               mlx5_glue->dr_create_flow_action_dest_vport(priv->sh->fdb_ns,
-                                                           resource->port_id);
+               mlx5_glue->dr_create_flow_action_dest_vport
+                       (priv->sh->fdb_domain, resource->port_id);
        if (!cache_resource->action) {
                rte_free(cache_resource);
                return rte_flow_error_set(error, ENOMEM,
@@ -1209,14 +1211,14 @@ static int
 flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                           size_t *size, struct rte_flow_error *error)
 {
-       struct ether_hdr *eth = NULL;
-       struct vlan_hdr *vlan = NULL;
-       struct ipv4_hdr *ipv4 = NULL;
-       struct ipv6_hdr *ipv6 = NULL;
+       struct rte_ether_hdr *eth = NULL;
+       struct rte_vlan_hdr *vlan = NULL;
+       struct rte_ipv4_hdr *ipv4 = NULL;
+       struct rte_ipv6_hdr *ipv6 = NULL;
        struct udp_hdr *udp = NULL;
-       struct vxlan_hdr *vxlan = NULL;
-       struct vxlan_gpe_hdr *vxlan_gpe = NULL;
-       struct gre_hdr *gre = NULL;
+       struct rte_vxlan_hdr *vxlan = NULL;
+       struct rte_vxlan_gpe_hdr *vxlan_gpe = NULL;
+       struct rte_gre_hdr *gre = NULL;
        size_t len;
        size_t temp_size = 0;
 
@@ -1235,20 +1237,20 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                rte_memcpy((void *)&buf[temp_size], items->spec, len);
                switch (items->type) {
                case RTE_FLOW_ITEM_TYPE_ETH:
-                       eth = (struct ether_hdr *)&buf[temp_size];
+                       eth = (struct rte_ether_hdr *)&buf[temp_size];
                        break;
                case RTE_FLOW_ITEM_TYPE_VLAN:
-                       vlan = (struct vlan_hdr *)&buf[temp_size];
+                       vlan = (struct rte_vlan_hdr *)&buf[temp_size];
                        if (!eth)
                                return rte_flow_error_set(error, EINVAL,
                                                RTE_FLOW_ERROR_TYPE_ACTION,
                                                (void *)items->type,
                                                "eth header not found");
                        if (!eth->ether_type)
-                               eth->ether_type = RTE_BE16(ETHER_TYPE_VLAN);
+                               eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_VLAN);
                        break;
                case RTE_FLOW_ITEM_TYPE_IPV4:
-                       ipv4 = (struct ipv4_hdr *)&buf[temp_size];
+                       ipv4 = (struct rte_ipv4_hdr *)&buf[temp_size];
                        if (!vlan && !eth)
                                return rte_flow_error_set(error, EINVAL,
                                                RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1256,9 +1258,9 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                                                "neither eth nor vlan"
                                                " header found");
                        if (vlan && !vlan->eth_proto)
-                               vlan->eth_proto = RTE_BE16(ETHER_TYPE_IPv4);
+                               vlan->eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPv4);
                        else if (eth && !eth->ether_type)
-                               eth->ether_type = RTE_BE16(ETHER_TYPE_IPv4);
+                               eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_IPv4);
                        if (!ipv4->version_ihl)
                                ipv4->version_ihl = MLX5_ENCAP_IPV4_VERSION |
                                                    MLX5_ENCAP_IPV4_IHL_MIN;
@@ -1266,7 +1268,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                                ipv4->time_to_live = MLX5_ENCAP_IPV4_TTL_DEF;
                        break;
                case RTE_FLOW_ITEM_TYPE_IPV6:
-                       ipv6 = (struct ipv6_hdr *)&buf[temp_size];
+                       ipv6 = (struct rte_ipv6_hdr *)&buf[temp_size];
                        if (!vlan && !eth)
                                return rte_flow_error_set(error, EINVAL,
                                                RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1274,9 +1276,9 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                                                "neither eth nor vlan"
                                                " header found");
                        if (vlan && !vlan->eth_proto)
-                               vlan->eth_proto = RTE_BE16(ETHER_TYPE_IPv6);
+                               vlan->eth_proto = RTE_BE16(RTE_ETHER_TYPE_IPv6);
                        else if (eth && !eth->ether_type)
-                               eth->ether_type = RTE_BE16(ETHER_TYPE_IPv6);
+                               eth->ether_type = RTE_BE16(RTE_ETHER_TYPE_IPv6);
                        if (!ipv6->vtc_flow)
                                ipv6->vtc_flow =
                                        RTE_BE32(MLX5_ENCAP_IPV6_VTC_FLOW);
@@ -1296,7 +1298,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                                ipv6->proto = IPPROTO_UDP;
                        break;
                case RTE_FLOW_ITEM_TYPE_VXLAN:
-                       vxlan = (struct vxlan_hdr *)&buf[temp_size];
+                       vxlan = (struct rte_vxlan_hdr *)&buf[temp_size];
                        if (!udp)
                                return rte_flow_error_set(error, EINVAL,
                                                RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1309,7 +1311,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                                        RTE_BE32(MLX5_ENCAP_VXLAN_FLAGS);
                        break;
                case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
-                       vxlan_gpe = (struct vxlan_gpe_hdr *)&buf[temp_size];
+                       vxlan_gpe = (struct rte_vxlan_gpe_hdr *)&buf[temp_size];
                        if (!udp)
                                return rte_flow_error_set(error, EINVAL,
                                                RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1329,7 +1331,7 @@ flow_dv_convert_encap_data(const struct rte_flow_item *items, uint8_t *buf,
                        break;
                case RTE_FLOW_ITEM_TYPE_GRE:
                case RTE_FLOW_ITEM_TYPE_NVGRE:
-                       gre = (struct gre_hdr *)&buf[temp_size];
+                       gre = (struct rte_gre_hdr *)&buf[temp_size];
                        if (!gre->proto)
                                return rte_flow_error_set(error, EINVAL,
                                                RTE_FLOW_ERROR_TYPE_ACTION,
@@ -1826,14 +1828,14 @@ flow_dv_modify_hdr_resource_register
        struct mlx5_priv *priv = dev->data->dev_private;
        struct mlx5_ibv_shared *sh = priv->sh;
        struct mlx5_flow_dv_modify_hdr_resource *cache_resource;
-       struct mlx5dv_dr_ns *ns;
+       struct mlx5dv_dr_domain *ns;
 
        if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_FDB)
-               ns = sh->fdb_ns;
+               ns = sh->fdb_domain;
        else if (resource->ft_type == MLX5DV_FLOW_TABLE_TYPE_NIC_TX)
-               ns = sh->tx_ns;
+               ns = sh->tx_domain;
        else
-               ns = sh->rx_ns;
+               ns = sh->rx_domain;
        resource->flags =
                dev_flow->flow->group ? 0 : MLX5DV_DR_ACTION_FLAGS_ROOT_LEVEL;
        /* Lookup a matching resource from cache. */
@@ -3092,7 +3094,7 @@ flow_dv_translate_item_mpls(void *matcher, void *key,
        case MLX5_FLOW_LAYER_GRE:
                MLX5_SET(fte_match_set_misc, misc_m, gre_protocol, 0xffff);
                MLX5_SET(fte_match_set_misc, misc_v, gre_protocol,
-                        ETHER_TYPE_MPLS);
+                        RTE_ETHER_TYPE_MPLS);
                break;
        default:
                MLX5_SET(fte_match_set_lyr_2_4, headers_m, ip_protocol, 0xff);
@@ -3305,17 +3307,17 @@ flow_dv_tbl_resource_get(struct rte_eth_dev *dev,
                tbl = &sh->fdb_tbl[table_id];
                if (!tbl->obj)
                        tbl->obj = mlx5_glue->dr_create_flow_tbl
-                               (sh->fdb_ns, table_id);
+                               (sh->fdb_domain, table_id);
        } else if (egress) {
                tbl = &sh->tx_tbl[table_id];
                if (!tbl->obj)
                        tbl->obj = mlx5_glue->dr_create_flow_tbl
-                               (sh->tx_ns, table_id);
+                               (sh->tx_domain, table_id);
        } else {
                tbl = &sh->rx_tbl[table_id];
                if (!tbl->obj)
                        tbl->obj = mlx5_glue->dr_create_flow_tbl
-                               (sh->rx_ns, table_id);
+                               (sh->rx_domain, table_id);
        }
        if (!tbl->obj) {
                rte_flow_error_set(error, ENOMEM,