xref: /dpdk/drivers/net/dpaa2/rte_pmd_dpaa2.h (revision 7917b0d38e92e8b9ec5a870415b791420e10f11a)
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright 2018-2021 NXP
3  */
4 
5 #ifndef _RTE_PMD_DPAA2_H
6 #define _RTE_PMD_DPAA2_H
7 
8 /**
9  * @file rte_pmd_dpaa2.h
10  *
11  * NXP dpaa2 PMD specific functions.
12  */
13 
14 #include <rte_compat.h>
15 #include <rte_flow.h>
16 
17 /**
18  * Create a flow rule to demultiplex ethernet traffic to separate network
19  * interfaces.
20  *
21  * @param dpdmux_id
22  *    ID of the DPDMUX MC object.
23  * @param[in] pattern
24  *    Pattern specification.
25  * @param[in] actions
26  *    Associated actions.
27  *
28  * @return
29  *    A valid handle in case of success, NULL otherwise.
30  */
31 struct rte_flow *
32 rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id,
33 			      struct rte_flow_item *pattern[],
34 			      struct rte_flow_action *actions[]);
35 
36 /**
37  * @warning
38  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
39  *
40  * demultiplex interface max rx frame length configure
41  *
42  * @param dpdmux_id
43  *    ID of the DPDMUX MC object.
44  * @param max_rx_frame_len
45  *    maximum receive frame length (will be checked to be minimux of all dpnis)
46  *
47  */
48 __rte_experimental
49 int
50 rte_pmd_dpaa2_mux_rx_frame_len(uint32_t dpdmux_id, uint16_t max_rx_frame_len);
51 
52 /**
53  * Create a custom hash key on basis of offset of start of packet and size.
54  * for e.g. if we need GRE packets (non-vlan and without any extra headers)
55  * to be hashed on basis of inner IP header, we will provide offset as:
56  * 14 (eth) + 20 (IP) + 4 (GRE) + 12 (Inner Src offset) = 50 and size
57  * as 8 bytes.
58  *
59  * @param port_id
60  *    The port identifier of the Ethernet device.
61  * @param offset
62  *    Offset from the start of packet which needs to be included to
63  *    calculate hash
64  * @param size
65  *    Size of the hash input key
66  *
67  * @return
68  *   - 0 if successful.
69  *   - Negative in case of failure.
70  */
71 int
72 rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
73 			      uint16_t offset,
74 			      uint8_t size);
75 
76 /**
77  * @warning
78  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
79  *
80  * Do thread specific initialization
81  */
82 __rte_experimental
83 void
84 rte_pmd_dpaa2_thread_init(void);
85 
86 /**
87  * @warning
88  * @b EXPERIMENTAL: this API may change, or be removed, without prior notice
89  *
90  * Generate the DPAA2 WRIOP based hash value
91  *
92  * @param key
93  *    Array of key data
94  * @param size
95  *    Size of the hash input key in bytes
96  *
97  * @return
98  *   - 0 if successful.
99  *   - Negative in case of failure.
100  */
101 
102 __rte_experimental
103 uint32_t
104 rte_pmd_dpaa2_get_tlu_hash(uint8_t *key, int size);
105 #endif /* _RTE_PMD_DPAA2_H */
106