]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/blob - drivers/net/ethernet/nvidia/eqos/drv.h
945336509d1b2cb25aff1c90fe17e70de1a764b9
[hercules2020/nv-tegra/linux-4.4.git] / drivers / net / ethernet / nvidia / eqos / drv.h
1 /* =========================================================================
2  * The Synopsys DWC ETHER QOS Software Driver and documentation (hereinafter
3  * "Software") is an unsupported proprietary work of Synopsys, Inc. unless
4  * otherwise expressly agreed to in writing between Synopsys and you.
5  *
6  * The Software IS NOT an item of Licensed Software or Licensed Product under
7  * any End User Software License Agreement or Agreement for Licensed Product
8  * with Synopsys or any supplement thereto.  Permission is hereby granted,
9  * free of charge, to any person obtaining a copy of this software annotated
10  * with this license and the Software, to deal in the Software without
11  * restriction, including without limitation the rights to use, copy, modify,
12  * merge, publish, distribute, sublicense, and/or sell copies of the Software,
13  * and to permit persons to whom the Software is furnished to do so, subject
14  * to the following conditions:
15  *
16  * The above copyright notice and this permission notice shall be included in
17  * all copies or substantial portions of the Software.
18  *
19  * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS
20  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT,
23  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29  * DAMAGE.
30  * =========================================================================
31  */
32 /*
33  * Copyright (c) 2015-2017, NVIDIA CORPORATION.  All rights reserved.
34  *
35  * This program is free software; you can redistribute it and/or modify it
36  * under the terms and conditions of the GNU General Public License,
37  * version 2, as published by the Free Software Foundation.
38  *
39  * This program is distributed in the hope it will be useful, but WITHOUT
40  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
41  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
42  * more details.
43  */
44 #ifndef __EQOS_DRV_H__
45
46 #define __EQOS_DRV_H__
47
48 static int eqos_open(struct net_device *);
49
50 static int eqos_close(struct net_device *);
51
52 static void eqos_set_rx_mode(struct net_device *);
53
54 static int eqos_start_xmit(struct sk_buff *, struct net_device *);
55
56 static void process_tx_completions(struct net_device *,
57                                    struct eqos_prv_data *,
58                                    uint qinx);
59
60 static struct net_device_stats *eqos_get_stats(struct net_device *);
61
62 static int eqos_set_features(struct net_device *dev,
63         netdev_features_t features);
64
65 INT eqos_configure_remotewakeup(struct net_device *,
66                                        struct ifr_data_struct *);
67
68 static void eqos_program_dcb_algorithm(struct eqos_prv_data *pdata,
69                 struct ifr_data_struct *req);
70
71 static void eqos_program_avb_algorithm(struct eqos_prv_data *pdata,
72                 struct ifr_data_struct *req);
73
74 static void eqos_config_tx_pbl(struct eqos_prv_data *pdata,
75                                       UINT tx_pbl, UINT ch_no);
76 static void eqos_config_rx_pbl(struct eqos_prv_data *pdata,
77                                       UINT rx_pbl, UINT ch_no);
78
79 static int eqos_handle_prv_ioctl(struct eqos_prv_data *pdata,
80                                         struct ifr_data_struct *req);
81
82 static int eqos_ioctl(struct net_device *, struct ifreq *, int);
83
84 irqreturn_t eqos_isr(int, void *);
85
86 static INT eqos_change_mtu(struct net_device *dev, INT new_mtu);
87
88 static int process_rx_completions(struct eqos_prv_data *pdata,
89                                   int quota, UINT qinx);
90
91 static void eqos_receive_skb(struct eqos_prv_data *pdata,
92                                     struct net_device *dev,
93                                     struct sk_buff *skb,
94                                     UINT qinx);
95
96 static void eqos_configure_rx_fun_ptr(struct eqos_prv_data
97                                              *pdata);
98
99
100 static int eqos_alloc_rx_buf(struct eqos_prv_data *pdata,
101                                     struct rx_swcx_desc *buffer,
102                                     gfp_t gfp);
103
104 static void eqos_default_common_confs(struct eqos_prv_data
105                                              *pdata);
106 static void eqos_default_tx_confs(struct eqos_prv_data *pdata);
107 static void eqos_default_tx_confs_single_q(struct eqos_prv_data
108                                                   *pdata, UINT qinx);
109 static void eqos_default_rx_confs(struct eqos_prv_data *pdata);
110 static void eqos_default_rx_confs_single_q(struct eqos_prv_data
111                                                   *pdata, UINT qinx);
112
113 static void eqos_mmc_setup(struct eqos_prv_data *pdata);
114 inline unsigned int eqos_reg_read(volatile ULONG *ptr);
115 static int eqos_vlan_rx_add_vid(struct net_device *dev, __be16 proto, u16 vid);
116 static int eqos_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid);
117 void eqos_stop_dev(struct eqos_prv_data *pdata);
118 void eqos_start_dev(struct eqos_prv_data *pdata);
119 int eqos_config_mac_loopback_mode(struct net_device *dev, unsigned int flags);
120 #endif