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.
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:
16 * The above copyright notice and this permission notice shall be included in
17 * all copies or substantial portions of the Software.
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
30 * =========================================================================
33 * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved.
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.
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
44 #ifndef __EQOS_DRV_H__
46 #define __EQOS_DRV_H__
48 static int eqos_open(struct net_device *);
50 static int eqos_close(struct net_device *);
52 static void eqos_set_rx_mode(struct net_device *);
54 static int eqos_start_xmit(struct sk_buff *, struct net_device *);
56 static void process_tx_completions(struct net_device *,
57 struct eqos_prv_data *,
60 static struct net_device_stats *eqos_get_stats(struct net_device *);
62 static int eqos_set_features(struct net_device *dev,
63 netdev_features_t features);
65 INT eqos_configure_remotewakeup(struct net_device *,
66 struct ifr_data_struct *);
68 static void eqos_program_dcb_algorithm(struct eqos_prv_data *pdata,
69 struct ifr_data_struct *req);
71 static void eqos_program_avb_algorithm(struct eqos_prv_data *pdata,
72 struct ifr_data_struct *req);
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);
79 static int eqos_handle_prv_ioctl(struct eqos_prv_data *pdata,
80 struct ifr_data_struct *req);
82 static int eqos_ioctl(struct net_device *, struct ifreq *, int);
84 irqreturn_t eqos_isr(int, void *);
86 static INT eqos_change_mtu(struct net_device *dev, INT new_mtu);
88 static int process_rx_completions(struct eqos_prv_data *pdata,
89 int quota, UINT qinx);
91 static void eqos_receive_skb(struct eqos_prv_data *pdata,
92 struct net_device *dev,
96 static void eqos_configure_rx_fun_ptr(struct eqos_prv_data
100 static int eqos_alloc_rx_buf(struct eqos_prv_data *pdata,
101 struct rx_swcx_desc *buffer,
104 static void eqos_default_common_confs(struct eqos_prv_data
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
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
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);