New upstream version 18.02
[deb_dpdk.git] / drivers / net / ark / ark_ext.h
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright (c) 2015-2017 Atomic Rules LLC
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above copyright
14  * notice, this list of conditions and the following disclaimer in
15  * the documentation and/or other materials provided with the
16  * distribution.
17  * * Neither the name of copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _ARK_EXT_H_
35 #define _ARK_EXT_H_
36
37 #include <rte_ethdev_driver.h>
38
39 /*
40  * This is the template file for users who which to define a dynamic
41  * extension to the Arkville PMD.   User's who create an extension
42  * should include this file and define the necessary and desired
43  * functions.
44  * Only 1 function is required for an extension, dev_init(); all other
45  * functions prototyped in this file are optional.
46  */
47
48 /*
49  * Called post PMD init.
50  * The implementation returns its private data that gets passed into
51  * all other functions as user_data
52  * The ARK extension implementation MUST implement this function
53  */
54 void *dev_init(struct rte_eth_dev *dev, void *a_bar, int port_id);
55
56 /* Called during device shutdown */
57 void dev_uninit(struct rte_eth_dev *dev, void *user_data);
58
59 /* This call is optional and allows the
60  * extension to specify the number of supported ports.
61  */
62 uint8_t dev_get_port_count(struct rte_eth_dev *dev,
63                            void *user_data);
64
65 /*
66  * The following functions are optional and are directly mapped
67  * from the DPDK PMD ops structure.
68  * Each function if implemented is called after the ARK PMD
69  * implementation executes.
70  */
71
72 int dev_configure(struct rte_eth_dev *dev,
73                   void *user_data);
74
75 int dev_start(struct rte_eth_dev *dev,
76               void *user_data);
77
78 void dev_stop(struct rte_eth_dev *dev,
79               void *user_data);
80
81 void dev_close(struct rte_eth_dev *dev,
82                void *user_data);
83
84 int link_update(struct rte_eth_dev *dev,
85                 int wait_to_complete,
86                 void *user_data);
87
88 int dev_set_link_up(struct rte_eth_dev *dev,
89                     void *user_data);
90
91 int dev_set_link_down(struct rte_eth_dev *dev,
92                       void *user_data);
93
94 int stats_get(struct rte_eth_dev *dev,
95                struct rte_eth_stats *stats,
96                void *user_data);
97
98 void stats_reset(struct rte_eth_dev *dev,
99                  void *user_data);
100
101 void mac_addr_add(struct rte_eth_dev *dev,
102                   struct ether_addr *macadr,
103                   uint32_t index,
104                   uint32_t pool,
105                   void *user_data);
106
107 void mac_addr_remove(struct rte_eth_dev *dev,
108                      uint32_t index,
109                      void *user_data);
110
111 void mac_addr_set(struct rte_eth_dev *dev,
112                   struct ether_addr *mac_addr,
113                   void *user_data);
114
115 int set_mtu(struct rte_eth_dev *dev,
116             uint16_t size,
117             void *user_data);
118
119 #endif