NVIDIA DOCA SDK Data Center on a Chip Framework Documentation
eth_rxq_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2023 NVIDIA CORPORATION AND AFFILIATES. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification, are permitted
5  * provided that the following conditions are met:
6  * * Redistributions of source code must retain the above copyright notice, this list of
7  * conditions and the following disclaimer.
8  * * Redistributions in binary form must reproduce the above copyright notice, this list of
9  * conditions and the following disclaimer in the documentation and/or other materials
10  * provided with the distribution.
11  * * Neither the name of the NVIDIA CORPORATION nor the names of its contributors may be used
12  * to endorse or promote products derived from this software without specific prior written
13  * permission.
14  *
15  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
17  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL NVIDIA CORPORATION BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
19  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
21  * STRICT LIABILITY, OR TOR (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
22  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23  *
24  */
25 
26 #ifndef ETH_RXQ_COMMON_H_
27 #define ETH_RXQ_COMMON_H_
28 
29 #include <unistd.h>
30 
31 #include <doca_flow.h>
32 #include <doca_dev.h>
33 #include <doca_error.h>
34 #include <doca_buf.h>
35 
37  struct doca_flow_port *df_port; /* DOCA flow port */
38  struct doca_flow_pipe *root_pipe; /* DOCA flow root pipe*/
39  struct doca_flow_pipe_entry *root_entry; /* DOCA flow root pipe entry*/
40 };
41 
43  struct doca_dev *dev; /* DOCA device */
44  uint16_t *rxq_flow_queue_ids; /* DOCA ETH RXQ's flow queue IDs */
45  uint16_t nb_queues; /* Number of DOCA FLOW queues wanted */
46 };
47 
48 /*
49  * Initializes DOCA flow for ETH RXQ sample
50  *
51  * @dev [in]: Doca device to use for doca_flow_port
52  * @resources [in]: flow resources
53  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
54  */
56 
57 /*
58  * Allocate DOCA flow resources for ETH RXQ sample
59  *
60  * @cfg [in]: Configuration parameters
61  * @resources [out]: DOCA flow resources for ETH RXQ sample to allocate
62  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
63  */
65 
66 /*
67  * Destroy DOCA flow resources for ETH RXQ sample
68  *
69  * @resources [in]: DOCA flow resources for ETH RXQ sample to destroy
70  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
71  */
73 
74 /*
75  * Get DOCA buf packet headroom size for ETH RXQ sample
76  *
77  * @pkt [in]: DOCA buf packet for ETH RXQ
78  * @headroom_size [out]: packet headroom size
79  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
80  */
81 doca_error_t get_pkt_headroom(struct doca_buf *pkt, uint16_t *headroom_size);
82 
83 /*
84  * Get DOCA buf packet tailroom size for ETH RXQ sample
85  *
86  * @pkt [in]: DOCA buf packet for ETH RXQ
87  * @tailroom_size [out]: packet tailroom size
88  * @return: DOCA_SUCCESS on success and DOCA_ERROR otherwise
89  */
90 doca_error_t get_pkt_tailroom(struct doca_buf *pkt, uint16_t *tailroom_size);
91 
92 #endif /* ETH_RXQ_COMMON_H_ */
doca_error_t destroy_eth_rxq_flow_resources(struct eth_rxq_flow_resources *resources)
doca_error_t get_pkt_tailroom(struct doca_buf *pkt, uint16_t *tailroom_size)
doca_error_t get_pkt_headroom(struct doca_buf *pkt, uint16_t *headroom_size)
doca_error_t allocate_eth_rxq_flow_resources(struct eth_rxq_flow_config *cfg, struct eth_rxq_flow_resources *resources)
doca_error_t rxq_common_init_doca_flow(struct doca_dev *dev, struct eth_rxq_flow_resources *resources)
struct rdma_resources resources
enum doca_error doca_error_t
DOCA API return codes.
const struct ip_frag_config * cfg
Definition: ip_frag_dp.c:0
uint16_t * rxq_flow_queue_ids
struct doca_dev * dev
struct doca_flow_pipe * root_pipe
struct doca_flow_pipe_entry * root_entry
struct doca_flow_port * df_port