eal/ppc: remove the braces in memory barrier macros
[dpdk.git] / lib / librte_ether / rte_eth_ctrl.h
index f71669c..668f59a 100644 (file)
@@ -1,39 +1,14 @@
-/*-
- *   BSD LICENSE
- *
- *   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
- *   All rights reserved.
- *
- *   Redistribution and use in source and binary forms, with or without
- *   modification, are permitted provided that the following conditions
- *   are met:
- *
- *     * Redistributions of source code must retain the above copyright
- *       notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above copyright
- *       notice, this list of conditions and the following disclaimer in
- *       the documentation and/or other materials provided with the
- *       distribution.
- *     * Neither the name of Intel Corporation nor the names of its
- *       contributors may be used to endorse or promote products derived
- *       from this software without specific prior written permission.
- *
- *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2015 Intel Corporation
  */
 
 #ifndef _RTE_ETH_CTRL_H_
 #define _RTE_ETH_CTRL_H_
 
+#include <stdint.h>
+#include <rte_common.h>
+#include "rte_ether.h"
+
 /**
  * @file
  *
@@ -74,7 +49,12 @@ extern "C" {
 #define RTE_ETH_FLOW_IPV6_EX            15
 #define RTE_ETH_FLOW_IPV6_TCP_EX        16
 #define RTE_ETH_FLOW_IPV6_UDP_EX        17
-#define RTE_ETH_FLOW_MAX                18
+#define RTE_ETH_FLOW_PORT               18
+       /**< Consider device port number as a flow differentiator */
+#define RTE_ETH_FLOW_VXLAN              19 /**< VXLAN protocol based flow */
+#define RTE_ETH_FLOW_GENEVE             20 /**< GENEVE protocol based flow */
+#define RTE_ETH_FLOW_NVGRE              21 /**< NVGRE protocol based flow */
+#define RTE_ETH_FLOW_MAX                22
 
 /**
  * Feature filter types
@@ -89,6 +69,8 @@ enum rte_filter_type {
        RTE_ETH_FILTER_TUNNEL,
        RTE_ETH_FILTER_FDIR,
        RTE_ETH_FILTER_HASH,
+       RTE_ETH_FILTER_L2_TUNNEL,
+       RTE_ETH_FILTER_GENERIC,
        RTE_ETH_FILTER_MAX
 };
 
@@ -244,6 +226,8 @@ enum rte_eth_tunnel_type {
        RTE_TUNNEL_TYPE_GENEVE,
        RTE_TUNNEL_TYPE_TEREDO,
        RTE_TUNNEL_TYPE_NVGRE,
+       RTE_TUNNEL_TYPE_IP_IN_GRE,
+       RTE_L2_TUNNEL_TYPE_E_TAG,
        RTE_TUNNEL_TYPE_MAX,
 };
 
@@ -280,19 +264,22 @@ enum rte_tunnel_iptype {
  * Tunneling Packet filter configuration.
  */
 struct rte_eth_tunnel_filter_conf {
-       struct ether_addr *outer_mac;  /**< Outer MAC address filter. */
-       struct ether_addr *inner_mac;  /**< Inner MAC address filter. */
-       uint16_t inner_vlan;           /**< Inner VLAN filter. */
+       struct ether_addr outer_mac;    /**< Outer MAC address to match. */
+       struct ether_addr inner_mac;    /**< Inner MAC address to match. */
+       uint16_t inner_vlan;            /**< Inner VLAN to match. */
        enum rte_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
+           if ETH_TUNNEL_FILTER_IIP is set in filter_type . */
        union {
-               uint32_t ipv4_addr;    /**< IPv4 source address to match. */
-               uint32_t ipv6_addr[4]; /**< IPv6 source address to match. */
-       } ip_addr; /**< IPv4/IPv6 source address to match (union of above). */
-
-       uint16_t filter_type;   /**< Filter type. */
+               uint32_t ipv4_addr;     /**< IPv4 address in big endian. */
+               uint32_t ipv6_addr[4];  /**< IPv6 address in big endian. */
+       } ip_addr;
+       /** Flags from ETH_TUNNEL_FILTER_XX - see above. */
+       uint16_t filter_type;
        enum rte_eth_tunnel_type tunnel_type; /**< Tunnel Type. */
-       uint32_t tenant_id;     /** < Tenant number. */
-       uint16_t queue_id;      /** < queue number. */
+       uint32_t tenant_id;     /**< Tenant ID to match. VNI, GRE key... */
+       uint16_t queue_id;      /**< Queue assigned to if match. */
 };
 
 /**
@@ -315,8 +302,8 @@ struct rte_eth_global_cfg {
        } cfg;
 };
 
-#define RTE_ETH_FDIR_MAX_FLEXLEN 16  /** < Max length of flexbytes. */
-#define RTE_ETH_INSET_SIZE_MAX   128 /** < Max length of input set. */
+#define RTE_ETH_FDIR_MAX_FLEXLEN 16  /**< Max length of flexbytes. */
+#define RTE_ETH_INSET_SIZE_MAX   128 /**< Max length of input set. */
 
 /**
  * Input set fields for Flow Director and Hash filters
@@ -340,6 +327,8 @@ enum rte_eth_input_set_field {
        RTE_ETH_INPUT_SET_L3_IP4_PROTO,
        RTE_ETH_INPUT_SET_L3_IP6_TC,
        RTE_ETH_INPUT_SET_L3_IP6_NEXT_HEADER,
+       RTE_ETH_INPUT_SET_L3_IP4_TTL,
+       RTE_ETH_INPUT_SET_L3_IP6_HOP_LIMITS,
 
        /* L4 */
        RTE_ETH_INPUT_SET_L4_UDP_SRC_PORT = 257,
@@ -398,15 +387,18 @@ struct rte_eth_input_set_conf {
  * A structure used to define the input for L2 flow
  */
 struct rte_eth_l2_flow {
-       uint16_t ether_type;          /**< Ether type to match */
+       uint16_t ether_type;          /**< Ether type in big endian */
 };
 
 /**
  * A structure used to define the input for IPV4 flow
  */
 struct rte_eth_ipv4_flow {
-       uint32_t src_ip;      /**< IPv4 source address to match. */
-       uint32_t dst_ip;      /**< IPv4 destination address to match. */
+       uint32_t src_ip;      /**< IPv4 source address in big endian. */
+       uint32_t dst_ip;      /**< IPv4 destination address in big endian. */
+       uint8_t  tos;         /**< Type of service to match. */
+       uint8_t  ttl;         /**< Time to live to match. */
+       uint8_t  proto;       /**< Protocol, next header in big endian. */
 };
 
 /**
@@ -414,8 +406,8 @@ struct rte_eth_ipv4_flow {
  */
 struct rte_eth_udpv4_flow {
        struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
-       uint16_t src_port;           /**< UDP source port to match. */
-       uint16_t dst_port;           /**< UDP destination port to match. */
+       uint16_t src_port;           /**< UDP source port in big endian. */
+       uint16_t dst_port;           /**< UDP destination port in big endian. */
 };
 
 /**
@@ -423,8 +415,8 @@ struct rte_eth_udpv4_flow {
  */
 struct rte_eth_tcpv4_flow {
        struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
-       uint16_t src_port;           /**< TCP source port to match. */
-       uint16_t dst_port;           /**< TCP destination port to match. */
+       uint16_t src_port;           /**< TCP source port in big endian. */
+       uint16_t dst_port;           /**< TCP destination port in big endian. */
 };
 
 /**
@@ -432,17 +424,20 @@ struct rte_eth_tcpv4_flow {
  */
 struct rte_eth_sctpv4_flow {
        struct rte_eth_ipv4_flow ip; /**< IPv4 fields to match. */
-       uint16_t src_port;           /**< SCTP source port to match. */
-       uint16_t dst_port;           /**< SCTP destination port to match. */
-       uint32_t verify_tag;         /**< Verify tag to match */
+       uint16_t src_port;           /**< SCTP source port in big endian. */
+       uint16_t dst_port;           /**< SCTP destination port in big endian. */
+       uint32_t verify_tag;         /**< Verify tag in big endian */
 };
 
 /**
  * A structure used to define the input for IPV6 flow
  */
 struct rte_eth_ipv6_flow {
-       uint32_t src_ip[4];      /**< IPv6 source address to match. */
-       uint32_t dst_ip[4];      /**< IPv6 destination address to match. */
+       uint32_t src_ip[4];      /**< IPv6 source address in big endian. */
+       uint32_t dst_ip[4];      /**< IPv6 destination address in big endian. */
+       uint8_t  tc;             /**< Traffic class to match. */
+       uint8_t  proto;          /**< Protocol, next header to match. */
+       uint8_t  hop_limits;     /**< Hop limits to match. */
 };
 
 /**
@@ -450,8 +445,8 @@ struct rte_eth_ipv6_flow {
  */
 struct rte_eth_udpv6_flow {
        struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
-       uint16_t src_port;           /**< UDP source port to match. */
-       uint16_t dst_port;           /**< UDP destination port to match. */
+       uint16_t src_port;           /**< UDP source port in big endian. */
+       uint16_t dst_port;           /**< UDP destination port in big endian. */
 };
 
 /**
@@ -459,8 +454,8 @@ struct rte_eth_udpv6_flow {
  */
 struct rte_eth_tcpv6_flow {
        struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
-       uint16_t src_port;           /**< TCP source port to match. */
-       uint16_t dst_port;           /**< TCP destination port to match. */
+       uint16_t src_port;           /**< TCP source port to in big endian. */
+       uint16_t dst_port;           /**< TCP destination port in big endian. */
 };
 
 /**
@@ -468,9 +463,9 @@ struct rte_eth_tcpv6_flow {
  */
 struct rte_eth_sctpv6_flow {
        struct rte_eth_ipv6_flow ip; /**< IPv6 fields to match. */
-       uint16_t src_port;           /**< SCTP source port to match. */
-       uint16_t dst_port;           /**< SCTP destination port to match. */
-       uint32_t verify_tag;         /**< Verify tag to match */
+       uint16_t src_port;           /**< SCTP source port in big endian. */
+       uint16_t dst_port;           /**< SCTP destination port in big endian. */
+       uint32_t verify_tag;         /**< Verify tag in big endian. */
 };
 
 /**
@@ -495,12 +490,14 @@ enum rte_eth_fdir_tunnel_type {
  */
 struct rte_eth_tunnel_flow {
        enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
-       uint32_t tunnel_id;                        /**< Tunnel ID to match. TNI, VNI... */
+       /** Tunnel ID to match. TNI, VNI... in big endian. */
+       uint32_t tunnel_id;
        struct ether_addr mac_addr;                /**< Mac address to match. */
 };
 
 /**
  * An union contains the inputs for all types of flow
+ * Items in flows need to be in big endian
  */
 union rte_eth_fdir_flow {
        struct rte_eth_l2_flow     l2_flow;
@@ -523,6 +520,8 @@ struct rte_eth_fdir_flow_ext {
        uint16_t vlan_tci;
        uint8_t flexbytes[RTE_ETH_FDIR_MAX_FLEXLEN];
        /**< It is filled by the flexible payload to match. */
+       uint8_t is_vf;   /**< 1 for VF, 0 for port dev */
+       uint16_t dst_id; /**< VF ID, available when is_vf is 1*/
 };
 
 /**
@@ -542,6 +541,7 @@ struct rte_eth_fdir_input {
 enum rte_eth_fdir_behavior {
        RTE_ETH_FDIR_ACCEPT = 0,
        RTE_ETH_FDIR_REJECT,
+       RTE_ETH_FDIR_PASSTHRU,
 };
 
 /**
@@ -585,14 +585,22 @@ struct rte_eth_fdir_filter {
  *  to match the various fields of RX packet headers.
  */
 struct rte_eth_fdir_masks {
-       uint16_t vlan_tci_mask;
+       uint16_t vlan_tci_mask;   /**< Bit mask for vlan_tci in big endian */
+       /** Bit mask for ipv4 flow in big endian. */
        struct rte_eth_ipv4_flow   ipv4_mask;
+       /** Bit maks for ipv6 flow in big endian. */
        struct rte_eth_ipv6_flow   ipv6_mask;
+       /** Bit mask for L4 source port in big endian. */
        uint16_t src_port_mask;
+       /** Bit mask for L4 destination port in big endian. */
        uint16_t dst_port_mask;
-       uint8_t mac_addr_byte_mask;  /** Per byte MAC address mask */
-       uint32_t tunnel_id_mask;  /** tunnel ID mask */
-       uint8_t tunnel_type_mask;
+       /** 6 bit mask for proper 6 bytes of Mac address, bit 0 matches the
+           first byte on the wire */
+       uint8_t mac_addr_byte_mask;
+       /** Bit mask for tunnel ID in big endian. */
+       uint32_t tunnel_id_mask;
+       uint8_t tunnel_type_mask; /**< 1 - Match tunnel type,
+                                      0 - Ignore tunnel type. */
 };
 
 /**
@@ -654,9 +662,9 @@ enum rte_fdir_mode {
        RTE_FDIR_MODE_PERFECT_TUNNEL,   /**< Enable FDIR filter mode - tunnel. */
 };
 
-#define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
+#define UINT64_BIT (CHAR_BIT * sizeof(uint64_t))
 #define RTE_FLOW_MASK_ARRAY_SIZE \
-       (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
+       (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
 
 /**
  * A structure used to get the information of flow director filter.
@@ -673,7 +681,7 @@ struct rte_eth_fdir_info {
        uint32_t guarant_spc; /**< Guaranteed spaces.*/
        uint32_t best_spc; /**< Best effort spaces.*/
        /** Bit mask for every supported flow type. */
-       uint32_t flow_types_mask[RTE_FLOW_MASK_ARRAY_SIZE];
+       uint64_t flow_types_mask[RTE_FLOW_MASK_ARRAY_SIZE];
        uint32_t max_flexpayload; /**< Total flex payload in bytes. */
        /** Flexible payload unit in bytes. Size and alignments of all flex
            payload segments should be multiplies of this value. */
@@ -766,7 +774,7 @@ enum rte_eth_hash_function {
 };
 
 #define RTE_SYM_HASH_MASK_ARRAY_SIZE \
-       (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT32_BIT)/UINT32_BIT)
+       (RTE_ALIGN(RTE_ETH_FLOW_MAX, UINT64_BIT)/UINT64_BIT)
 /**
  * A structure used to set or get global hash function configurations which
  * include symmetric hash enable per flow type and hash function type.
@@ -779,9 +787,9 @@ enum rte_eth_hash_function {
 struct rte_eth_hash_global_conf {
        enum rte_eth_hash_function hash_func; /**< Hash function type */
        /** Bit mask for symmetric hash enable per flow type */
-       uint32_t sym_hash_enable_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
+       uint64_t sym_hash_enable_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
        /** Bit mask indicates if the corresponding bit is valid */
-       uint32_t valid_bit_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
+       uint64_t valid_bit_mask[RTE_SYM_HASH_MASK_ARRAY_SIZE];
 };
 
 /**
@@ -801,6 +809,17 @@ struct rte_eth_hash_filter_info {
        } info;
 };
 
+/**
+ * l2 tunnel configuration.
+ */
+struct rte_eth_l2_tunnel_conf {
+       enum rte_eth_tunnel_type l2_tunnel_type;
+       uint16_t ether_type; /* ether type in l2 header */
+       uint32_t tunnel_id; /* port tag id for e-tag */
+       uint16_t vf_id; /* VF id for tag insertion */
+       uint32_t pool; /* destination pool for tag based forwarding */
+};
+
 #ifdef __cplusplus
 }
 #endif