drivers: mark internal NXP symbols
[dpdk.git] / drivers / net / dpaa2 / dpaa2_ethdev.h
index e7728ba..c7fb653 100644 (file)
@@ -1,39 +1,18 @@
-/*-
- *   BSD LICENSE
+/* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright (c) 2016 NXP. All rights reserved.
+ *   Copyright 2016-2019 NXP
  *
- *   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 Freescale Semiconductor, Inc 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.
  */
 
 #ifndef _DPAA2_ETHDEV_H
 #define _DPAA2_ETHDEV_H
 
+#include <rte_event_eth_rx_adapter.h>
+#include <rte_pmd_dpaa2.h>
+
+#include <dpaa2_hw_pvt.h>
+
 #include <mc/fsl_dpni.h>
 #include <mc/fsl_mc_sys.h>
 
 #define DPAA2_MAX_RX_PKT_LEN  10240 /*WRIOP support*/
 
 #define MAX_TCS                        DPNI_MAX_TC
-#define MAX_RX_QUEUES          16
+#define MAX_RX_QUEUES          128
 #define MAX_TX_QUEUES          16
+#define MAX_DPNI               8
+
+#define DPAA2_RX_DEFAULT_NBDESC 512
 
 /*default tc to be used for ,congestion, distribution etc configuration. */
 #define DPAA2_DEF_TC           0
 
-/* Threshold for a queue to *Enter* Congestion state.
- * It is set to 32KB
+/* Threshold for a Tx queue to *Enter* Congestion state.
  */
-#define CONG_ENTER_TX_THRESHOLD   (32 * 1024)
+#define CONG_ENTER_TX_THRESHOLD   512
 
 /* Threshold for a queue to *Exit* Congestion state.
  */
-#define CONG_EXIT_TX_THRESHOLD    (24 * 1024)
+#define CONG_EXIT_TX_THRESHOLD    480
+
+#define CONG_RETRY_COUNT 18000
+
+/* RX queue tail drop threshold
+ * currently considering 64 KB packets
+ */
+#define CONG_THRESHOLD_RX_BYTES_Q  (64 * 1024)
+#define CONG_RX_OAL    128
 
 /* Size of the input SMMU mapped memory required by MC */
 #define DIST_PARAM_IOVA_SIZE 256
 /* Enable TX Congestion control support
  * default is disable
  */
-#define DPAA2_TX_CGR_SUPPORT   0x01
+#define DPAA2_TX_CGR_OFF       0x01
+
+/* Disable RX tail drop, default is enable */
+#define DPAA2_RX_TAILDROP_OFF  0x04
+
+#define DPAA2_RSS_OFFLOAD_ALL ( \
+       ETH_RSS_L2_PAYLOAD | \
+       ETH_RSS_IP | \
+       ETH_RSS_UDP | \
+       ETH_RSS_TCP | \
+       ETH_RSS_SCTP)
+
+/* LX2 FRC Parsed values (Little Endian) */
+#define DPAA2_PKT_TYPE_ETHER           0x0060
+#define DPAA2_PKT_TYPE_IPV4            0x0000
+#define DPAA2_PKT_TYPE_IPV6            0x0020
+#define DPAA2_PKT_TYPE_IPV4_EXT \
+                       (0x0001 | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_EXT \
+                       (0x0001 | DPAA2_PKT_TYPE_IPV6)
+#define DPAA2_PKT_TYPE_IPV4_TCP \
+                       (0x000e | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_TCP \
+                       (0x000e | DPAA2_PKT_TYPE_IPV6)
+#define DPAA2_PKT_TYPE_IPV4_UDP \
+                       (0x0010 | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_UDP \
+                       (0x0010 | DPAA2_PKT_TYPE_IPV6)
+#define DPAA2_PKT_TYPE_IPV4_SCTP       \
+                       (0x000f | DPAA2_PKT_TYPE_IPV4)
+#define DPAA2_PKT_TYPE_IPV6_SCTP       \
+                       (0x000f | DPAA2_PKT_TYPE_IPV6)
+#define DPAA2_PKT_TYPE_IPV4_ICMP \
+                       (0x0003 | DPAA2_PKT_TYPE_IPV4_EXT)
+#define DPAA2_PKT_TYPE_IPV6_ICMP \
+                       (0x0003 | DPAA2_PKT_TYPE_IPV6_EXT)
+#define DPAA2_PKT_TYPE_VLAN_1          0x0160
+#define DPAA2_PKT_TYPE_VLAN_2          0x0260
+
+/* enable timestamp in mbuf*/
+extern enum pmd_dpaa2_ts dpaa2_enable_ts;
+
+#define DPAA2_QOS_TABLE_RECONFIGURE    1
+#define DPAA2_FS_TABLE_RECONFIGURE     2
+
+/*Externaly defined*/
+extern const struct rte_flow_ops dpaa2_flow_ops;
+extern enum rte_filter_type dpaa2_filter_type;
 
 struct dpaa2_dev_priv {
        void *hw;
@@ -71,28 +107,115 @@ struct dpaa2_dev_priv {
        uint16_t token;
        uint8_t nb_tx_queues;
        uint8_t nb_rx_queues;
+       uint32_t options;
        void *rx_vq[MAX_RX_QUEUES];
        void *tx_vq[MAX_TX_QUEUES];
-
        struct dpaa2_bp_list *bp_list; /**<Attached buffer pool list */
-       uint32_t options;
-       uint16_t num_dist_per_tc[MAX_TCS];
+       void *tx_conf_vq[MAX_TX_QUEUES];
+       uint8_t tx_conf_en;
        uint8_t max_mac_filters;
        uint8_t max_vlan_filters;
-       uint8_t num_tc;
+       uint8_t num_rx_tc;
        uint8_t flags; /*dpaa2 config flags */
+       uint8_t en_ordered;
+       uint8_t en_loose_ordered;
+       uint8_t max_cgs;
+       uint8_t cgid_in_use[MAX_RX_QUEUES];
+
+       struct pattern_s {
+               uint8_t item_count;
+               uint8_t pattern_type[DPKG_MAX_NUM_OF_EXTRACTS];
+       } pattern[MAX_TCS + 1];
+
+       struct extract_s {
+               struct dpkg_profile_cfg qos_key_cfg;
+               struct dpkg_profile_cfg fs_key_cfg[MAX_TCS];
+               uint64_t qos_extract_param;
+               uint64_t fs_extract_param[MAX_TCS];
+       } extract;
+
+       uint16_t ss_offset;
+       uint64_t ss_iova;
+       uint64_t ss_param_iova;
+#if defined(RTE_LIBRTE_IEEE1588)
+       /*stores timestamp of last received packet on dev*/
+       uint64_t rx_timestamp;
+       /*stores timestamp of last received tx confirmation packet on dev*/
+       uint64_t tx_timestamp;
+       /* stores pointer to next tx_conf queue that should be processed,
+        * it corresponds to last packet transmitted
+        */
+       struct dpaa2_queue *next_tx_conf_queue;
+#endif
+
+       struct rte_eth_dev *eth_dev; /**< Pointer back to holding ethdev */
+
+       LIST_HEAD(, rte_flow) flows; /**< Configured flow rule handles. */
 };
 
+int dpaa2_distset_to_dpkg_profile_cfg(uint64_t req_dist_set,
+                                     struct dpkg_profile_cfg *kg_cfg);
+
 int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
-                         uint32_t req_dist_set);
+                         uint64_t req_dist_set);
 
 int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
                           uint8_t tc_index);
 
 int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
 
+__rte_internal
+int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
+               int eth_rx_queue_id,
+               struct dpaa2_dpcon_dev *dpcon,
+               const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
+
+__rte_internal
+int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
+               int eth_rx_queue_id);
+
+uint16_t dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
+
+uint16_t dpaa2_dev_loopback_rx(void *queue, struct rte_mbuf **bufs,
+                               uint16_t nb_pkts);
+
 uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
                               uint16_t nb_pkts);
+void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
+                                     const struct qbman_fd *fd,
+                                     const struct qbman_result *dq,
+                                     struct dpaa2_queue *rxq,
+                                     struct rte_event *ev);
+void dpaa2_dev_process_atomic_event(struct qbman_swp *swp,
+                                   const struct qbman_fd *fd,
+                                   const struct qbman_result *dq,
+                                   struct dpaa2_queue *rxq,
+                                   struct rte_event *ev);
+void dpaa2_dev_process_ordered_event(struct qbman_swp *swp,
+                                    const struct qbman_fd *fd,
+                                    const struct qbman_result *dq,
+                                    struct dpaa2_queue *rxq,
+                                    struct rte_event *ev);
 uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
-
+uint16_t dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs,
+                             uint16_t nb_pkts);
+uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
+void dpaa2_dev_free_eqresp_buf(uint16_t eqresp_ci);
+void dpaa2_flow_clean(struct rte_eth_dev *dev);
+uint16_t dpaa2_dev_tx_conf(void *queue)  __rte_unused;
+
+#if defined(RTE_LIBRTE_IEEE1588)
+int dpaa2_timesync_enable(struct rte_eth_dev *dev);
+int dpaa2_timesync_disable(struct rte_eth_dev *dev);
+int dpaa2_timesync_read_time(struct rte_eth_dev *dev,
+                                       struct timespec *timestamp);
+int dpaa2_timesync_write_time(struct rte_eth_dev *dev,
+                                       const struct timespec *timestamp);
+int dpaa2_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta);
+int dpaa2_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
+                                               struct timespec *timestamp,
+                                               uint32_t flags __rte_unused);
+int dpaa2_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
+                                         struct timespec *timestamp);
+#endif
 #endif /* _DPAA2_ETHDEV_H */