xref: /dpdk/drivers/net/dpaa2/dpaa2_ethdev.h (revision 131a75b6)
1*131a75b6SHemant Agrawal /* SPDX-License-Identifier: BSD-3-Clause
2c147eae0SHemant Agrawal  *
3c147eae0SHemant Agrawal  *   Copyright (c) 2015-2016 Freescale Semiconductor, Inc. All rights reserved.
4*131a75b6SHemant Agrawal  *   Copyright 2016 NXP
5c147eae0SHemant Agrawal  *
6c147eae0SHemant Agrawal  */
7c147eae0SHemant Agrawal 
8c147eae0SHemant Agrawal #ifndef _DPAA2_ETHDEV_H
9c147eae0SHemant Agrawal #define _DPAA2_ETHDEV_H
10c147eae0SHemant Agrawal 
11b677d4c6SNipun Gupta #include <rte_event_eth_rx_adapter.h>
12b677d4c6SNipun Gupta 
133e5a335dSHemant Agrawal #include <mc/fsl_dpni.h>
143e5a335dSHemant Agrawal #include <mc/fsl_mc_sys.h>
153e5a335dSHemant Agrawal 
16bee61d86SHemant Agrawal #define DPAA2_MIN_RX_BUF_SIZE 512
17bee61d86SHemant Agrawal #define DPAA2_MAX_RX_PKT_LEN  10240 /*WRIOP support*/
18bee61d86SHemant Agrawal 
1989c2ea8fSHemant Agrawal #define MAX_TCS			DPNI_MAX_TC
203e5a335dSHemant Agrawal #define MAX_RX_QUEUES		16
213e5a335dSHemant Agrawal #define MAX_TX_QUEUES		16
223e5a335dSHemant Agrawal 
233e5a335dSHemant Agrawal /*default tc to be used for ,congestion, distribution etc configuration. */
243e5a335dSHemant Agrawal #define DPAA2_DEF_TC		0
253e5a335dSHemant Agrawal 
2629dfa62fSHemant Agrawal /* Threshold for a Tx queue to *Enter* Congestion state.
277ae777d0SHemant Agrawal  */
2829dfa62fSHemant Agrawal #define CONG_ENTER_TX_THRESHOLD   512
297ae777d0SHemant Agrawal 
307ae777d0SHemant Agrawal /* Threshold for a queue to *Exit* Congestion state.
317ae777d0SHemant Agrawal  */
3229dfa62fSHemant Agrawal #define CONG_EXIT_TX_THRESHOLD    480
337ae777d0SHemant Agrawal 
34a0840963SHemant Agrawal #define CONG_RETRY_COUNT 18000
35a0840963SHemant Agrawal 
3623d6a87eSHemant Agrawal /* RX queue tail drop threshold
3723d6a87eSHemant Agrawal  * currently considering 32 KB packets
3823d6a87eSHemant Agrawal  */
3929dfa62fSHemant Agrawal #define CONG_THRESHOLD_RX_Q  (64 * 1024)
40d47f0292SHemant Agrawal #define CONG_RX_OAL	128
4123d6a87eSHemant Agrawal 
4289c2ea8fSHemant Agrawal /* Size of the input SMMU mapped memory required by MC */
4389c2ea8fSHemant Agrawal #define DIST_PARAM_IOVA_SIZE 256
4489c2ea8fSHemant Agrawal 
457ae777d0SHemant Agrawal /* Enable TX Congestion control support
467ae777d0SHemant Agrawal  * default is disable
477ae777d0SHemant Agrawal  */
48a0840963SHemant Agrawal #define DPAA2_TX_CGR_OFF	0x01
497ae777d0SHemant Agrawal 
5023d6a87eSHemant Agrawal /* Disable RX tail drop, default is enable */
5123d6a87eSHemant Agrawal #define DPAA2_RX_TAILDROP_OFF	0x04
5223d6a87eSHemant Agrawal 
53c147eae0SHemant Agrawal struct dpaa2_dev_priv {
54c147eae0SHemant Agrawal 	void *hw;
55c147eae0SHemant Agrawal 	int32_t hw_id;
563e5a335dSHemant Agrawal 	int32_t qdid;
57c147eae0SHemant Agrawal 	uint16_t token;
583e5a335dSHemant Agrawal 	uint8_t nb_tx_queues;
593e5a335dSHemant Agrawal 	uint8_t nb_rx_queues;
603e5a335dSHemant Agrawal 	void *rx_vq[MAX_RX_QUEUES];
613e5a335dSHemant Agrawal 	void *tx_vq[MAX_TX_QUEUES];
62c147eae0SHemant Agrawal 
63bee61d86SHemant Agrawal 	struct dpaa2_bp_list *bp_list; /**<Attached buffer pool list */
6433fad432SHemant Agrawal 	uint32_t options;
6533fad432SHemant Agrawal 	uint8_t max_mac_filters;
6633fad432SHemant Agrawal 	uint8_t max_vlan_filters;
6716bbc98aSShreyansh Jain 	uint8_t num_rx_tc;
68c147eae0SHemant Agrawal 	uint8_t flags; /*dpaa2 config flags */
69c147eae0SHemant Agrawal };
7089c2ea8fSHemant Agrawal 
7189c2ea8fSHemant Agrawal int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
72bd4d9419SHemant Agrawal 			  uint64_t req_dist_set);
7389c2ea8fSHemant Agrawal 
7489c2ea8fSHemant Agrawal int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
7589c2ea8fSHemant Agrawal 			   uint8_t tc_index);
7689c2ea8fSHemant Agrawal 
77bee61d86SHemant Agrawal int dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv, void *blist);
78bee61d86SHemant Agrawal 
79b677d4c6SNipun Gupta int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
80b677d4c6SNipun Gupta 		int eth_rx_queue_id,
81b677d4c6SNipun Gupta 		uint16_t dpcon_id,
82b677d4c6SNipun Gupta 		const struct rte_event_eth_rx_adapter_queue_conf *queue_conf);
83b677d4c6SNipun Gupta 
84b677d4c6SNipun Gupta int dpaa2_eth_eventq_detach(const struct rte_eth_dev *dev,
85b677d4c6SNipun Gupta 		int eth_rx_queue_id);
86b677d4c6SNipun Gupta 
875c6942fdSHemant Agrawal uint16_t dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs,
885c6942fdSHemant Agrawal 			       uint16_t nb_pkts);
89b677d4c6SNipun Gupta void dpaa2_dev_process_parallel_event(struct qbman_swp *swp,
90b677d4c6SNipun Gupta 				      const struct qbman_fd *fd,
91b677d4c6SNipun Gupta 				      const struct qbman_result *dq,
92b677d4c6SNipun Gupta 				      struct dpaa2_queue *rxq,
93b677d4c6SNipun Gupta 				      struct rte_event *ev);
94cd9935ceSHemant Agrawal uint16_t dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
95a1f3a12cSHemant Agrawal uint16_t dummy_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts);
96c147eae0SHemant Agrawal #endif /* _DPAA2_ETHDEV_H */
97