blob: cffbb130999a284fda357edf23a13dfe24a2b686 [file] [log] [blame]
Sathya Perla6b7c5b92009-03-11 23:32:03 -07001/*
Vasundhara Volam40263822014-02-12 16:09:07 +05302 * Copyright (C) 2005 - 2014 Emulex
Sathya Perla6b7c5b92009-03-11 23:32:03 -07003 * All rights reserved.
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License version 2
7 * as published by the Free Software Foundation. The full GNU General
8 * Public License is included in this distribution in the file called COPYING.
9 *
10 * Contact Information:
Ajit Khaparded2145cd2011-03-16 08:20:46 +000011 * linux-drivers@emulex.com
Sathya Perla6b7c5b92009-03-11 23:32:03 -070012 *
Ajit Khaparded2145cd2011-03-16 08:20:46 +000013 * Emulex
14 * 3333 Susan Street
15 * Costa Mesa, CA 92626
Sathya Perla6b7c5b92009-03-11 23:32:03 -070016 */
17
18#include "be.h"
Sathya Perla8788fdc2009-07-27 22:52:03 +000019#include "be_cmds.h"
Sathya Perla6b7c5b92009-03-11 23:32:03 -070020#include <linux/ethtool.h>
21
22struct be_ethtool_stat {
23 char desc[ETH_GSTRING_LEN];
24 int type;
25 int size;
26 int offset;
27};
28
Sathya Perlaac124ff2011-07-25 19:10:14 +000029enum {DRVSTAT_TX, DRVSTAT_RX, DRVSTAT};
Sathya Perla6b7c5b92009-03-11 23:32:03 -070030#define FIELDINFO(_struct, field) FIELD_SIZEOF(_struct, field), \
31 offsetof(_struct, field)
Sathya Perla3abcded2010-10-03 22:12:27 -070032#define DRVSTAT_TX_INFO(field) #field, DRVSTAT_TX,\
33 FIELDINFO(struct be_tx_stats, field)
34#define DRVSTAT_RX_INFO(field) #field, DRVSTAT_RX,\
35 FIELDINFO(struct be_rx_stats, field)
Ajit Khaparde609ff3b2011-02-20 11:42:07 +000036#define DRVSTAT_INFO(field) #field, DRVSTAT,\
Sathya Perlaac124ff2011-07-25 19:10:14 +000037 FIELDINFO(struct be_drv_stats, field)
Sathya Perla6b7c5b92009-03-11 23:32:03 -070038
39static const struct be_ethtool_stat et_stats[] = {
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000040 {DRVSTAT_INFO(rx_crc_errors)},
41 {DRVSTAT_INFO(rx_alignment_symbol_errors)},
42 {DRVSTAT_INFO(rx_pause_frames)},
43 {DRVSTAT_INFO(rx_control_frames)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000044 /* Received packets dropped when the Ethernet length field
45 * is not equal to the actual Ethernet data length.
46 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000047 {DRVSTAT_INFO(rx_in_range_errors)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000048 /* Received packets dropped when their length field is >= 1501 bytes
49 * and <= 1535 bytes.
50 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000051 {DRVSTAT_INFO(rx_out_range_errors)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000052 /* Received packets dropped when they are longer than 9216 bytes */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000053 {DRVSTAT_INFO(rx_frame_too_long)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000054 /* Received packets dropped when they don't pass the unicast or
55 * multicast address filtering.
56 */
Suresh Reddy18fb06a2013-04-25 23:03:21 +000057 {DRVSTAT_INFO(rx_address_filtered)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000058 /* Received packets dropped when IP packet length field is less than
59 * the IP header length field.
60 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000061 {DRVSTAT_INFO(rx_dropped_too_small)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000062 /* Received packets dropped when IP length field is greater than
63 * the actual packet length.
64 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000065 {DRVSTAT_INFO(rx_dropped_too_short)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000066 /* Received packets dropped when the IP header length field is less
67 * than 5.
68 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000069 {DRVSTAT_INFO(rx_dropped_header_too_small)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000070 /* Received packets dropped when the TCP header length field is less
71 * than 5 or the TCP header length + IP header length is more
72 * than IP packet length.
73 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000074 {DRVSTAT_INFO(rx_dropped_tcp_length)},
75 {DRVSTAT_INFO(rx_dropped_runt)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000076 /* Number of received packets dropped when a fifo for descriptors going
77 * into the packet demux block overflows. In normal operation, this
78 * fifo must never overflow.
79 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000080 {DRVSTAT_INFO(rxpp_fifo_overflow_drop)},
81 {DRVSTAT_INFO(rx_input_fifo_overflow_drop)},
82 {DRVSTAT_INFO(rx_ip_checksum_errs)},
83 {DRVSTAT_INFO(rx_tcp_checksum_errs)},
84 {DRVSTAT_INFO(rx_udp_checksum_errs)},
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000085 {DRVSTAT_INFO(tx_pauseframes)},
86 {DRVSTAT_INFO(tx_controlframes)},
87 {DRVSTAT_INFO(rx_priority_pause_frames)},
Ajit Khapardeb5adffc42013-05-01 09:38:00 +000088 {DRVSTAT_INFO(tx_priority_pauseframes)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000089 /* Received packets dropped when an internal fifo going into
90 * main packet buffer tank (PMEM) overflows.
91 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000092 {DRVSTAT_INFO(pmem_fifo_overflow_drop)},
93 {DRVSTAT_INFO(jabber_events)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000094 /* Received packets dropped due to lack of available HW packet buffers
95 * used to temporarily hold the received packets.
96 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +000097 {DRVSTAT_INFO(rx_drops_no_pbuf)},
Sathya Perlad45b9d32012-01-29 20:17:39 +000098 /* Received packets dropped due to input receive buffer
99 * descriptor fifo overflowing.
100 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +0000101 {DRVSTAT_INFO(rx_drops_no_erx_descr)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000102 /* Packets dropped because the internal FIFO to the offloaded TCP
103 * receive processing block is full. This could happen only for
104 * offloaded iSCSI or FCoE trarffic.
105 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +0000106 {DRVSTAT_INFO(rx_drops_no_tpre_descr)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000107 /* Received packets dropped when they need more than 8
108 * receive buffers. This cannot happen as the driver configures
109 * 2048 byte receive buffers.
110 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +0000111 {DRVSTAT_INFO(rx_drops_too_many_frags)},
Ajit Khaparde89a88ab2011-05-16 07:36:18 +0000112 {DRVSTAT_INFO(forwarded_packets)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000113 /* Received packets dropped when the frame length
114 * is more than 9018 bytes
115 */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +0000116 {DRVSTAT_INFO(rx_drops_mtu)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000117 /* Number of packets dropped due to random early drop function */
Ajit Khaparde89a88ab2011-05-16 07:36:18 +0000118 {DRVSTAT_INFO(eth_red_drops)},
Ajit Khaparde461ae372013-10-03 16:16:50 -0500119 {DRVSTAT_INFO(be_on_die_temperature)},
120 {DRVSTAT_INFO(rx_roce_bytes_lsd)},
121 {DRVSTAT_INFO(rx_roce_bytes_msd)},
122 {DRVSTAT_INFO(rx_roce_frames)},
123 {DRVSTAT_INFO(roce_drops_payload_len)},
124 {DRVSTAT_INFO(roce_drops_crc)}
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700125};
126#define ETHTOOL_STATS_NUM ARRAY_SIZE(et_stats)
127
Sathya Perlaab1594e2011-07-25 19:10:15 +0000128/* Stats related to multi RX queues: get_stats routine assumes bytes, pkts
129 * are first and second members respectively.
130 */
Sathya Perla3abcded2010-10-03 22:12:27 -0700131static const struct be_ethtool_stat et_rx_stats[] = {
Sathya Perlaab1594e2011-07-25 19:10:15 +0000132 {DRVSTAT_RX_INFO(rx_bytes)},/* If moving this member see above note */
133 {DRVSTAT_RX_INFO(rx_pkts)}, /* If moving this member see above note */
Sathya Perla3abcded2010-10-03 22:12:27 -0700134 {DRVSTAT_RX_INFO(rx_compl)},
135 {DRVSTAT_RX_INFO(rx_mcast_pkts)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000136 /* Number of page allocation failures while posting receive buffers
137 * to HW.
138 */
Sathya Perla3abcded2010-10-03 22:12:27 -0700139 {DRVSTAT_RX_INFO(rx_post_fail)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000140 /* Recevied packets dropped due to skb allocation failure */
Sathya Perlaac124ff2011-07-25 19:10:14 +0000141 {DRVSTAT_RX_INFO(rx_drops_no_skbs)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000142 /* Received packets dropped due to lack of available fetched buffers
143 * posted by the driver.
144 */
Sathya Perlaac124ff2011-07-25 19:10:14 +0000145 {DRVSTAT_RX_INFO(rx_drops_no_frags)}
Sathya Perla3abcded2010-10-03 22:12:27 -0700146};
147#define ETHTOOL_RXSTATS_NUM (ARRAY_SIZE(et_rx_stats))
148
Sathya Perlaab1594e2011-07-25 19:10:15 +0000149/* Stats related to multi TX queues: get_stats routine assumes compl is the
150 * first member
151 */
Sathya Perla3c8def92011-06-12 20:01:58 +0000152static const struct be_ethtool_stat et_tx_stats[] = {
Sathya Perlaab1594e2011-07-25 19:10:15 +0000153 {DRVSTAT_TX_INFO(tx_compl)}, /* If moving this member see above note */
Sathya Perlaac124ff2011-07-25 19:10:14 +0000154 {DRVSTAT_TX_INFO(tx_bytes)},
155 {DRVSTAT_TX_INFO(tx_pkts)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000156 /* Number of skbs queued for trasmission by the driver */
Sathya Perlaac124ff2011-07-25 19:10:14 +0000157 {DRVSTAT_TX_INFO(tx_reqs)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000158 /* Number of TX work request blocks DMAed to HW */
Sathya Perlaac124ff2011-07-25 19:10:14 +0000159 {DRVSTAT_TX_INFO(tx_wrbs)},
Sathya Perlad45b9d32012-01-29 20:17:39 +0000160 /* Number of times the TX queue was stopped due to lack
161 * of spaces in the TXQ.
162 */
Sathya Perlabc617522013-10-01 16:00:01 +0530163 {DRVSTAT_TX_INFO(tx_stops)},
164 /* Pkts dropped in the driver's transmit path */
165 {DRVSTAT_TX_INFO(tx_drv_drops)}
Sathya Perla3c8def92011-06-12 20:01:58 +0000166};
167#define ETHTOOL_TXSTATS_NUM (ARRAY_SIZE(et_tx_stats))
168
Suresh Rff33a6e2009-12-03 16:15:52 -0800169static const char et_self_tests[][ETH_GSTRING_LEN] = {
170 "MAC Loopback test",
171 "PHY Loopback test",
172 "External Loopback test",
Ajit Khaparde4ee77212011-02-20 11:41:20 +0000173 "DDR DMA test",
Sarveshwar Bandi4276e472010-01-19 05:15:36 +0000174 "Link test"
Suresh Rff33a6e2009-12-03 16:15:52 -0800175};
176
177#define ETHTOOL_TESTS_NUM ARRAY_SIZE(et_self_tests)
178#define BE_MAC_LOOPBACK 0x0
179#define BE_PHY_LOOPBACK 0x1
180#define BE_ONE_PORT_EXT_LOOPBACK 0x2
Sarveshwar Bandifced9992009-12-23 04:41:44 +0000181#define BE_NO_LOOPBACK 0xff
Suresh Rff33a6e2009-12-03 16:15:52 -0800182
Sathya Perla04b71172011-09-27 13:30:27 -0400183static void be_get_drvinfo(struct net_device *netdev,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530184 struct ethtool_drvinfo *drvinfo)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700185{
186 struct be_adapter *adapter = netdev_priv(netdev);
187
Rick Jones68aad782011-11-07 13:29:27 +0000188 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver));
189 strlcpy(drvinfo->version, DRV_VER, sizeof(drvinfo->version));
Somnath Kotureeb65ce2013-05-26 21:08:36 +0000190 if (!memcmp(adapter->fw_ver, adapter->fw_on_flash, FW_VER_LEN))
Jiri Pirko7826d432013-01-06 00:44:26 +0000191 strlcpy(drvinfo->fw_version, adapter->fw_ver,
192 sizeof(drvinfo->fw_version));
193 else
194 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version),
Somnath Kotureeb65ce2013-05-26 21:08:36 +0000195 "%s [%s]", adapter->fw_ver, adapter->fw_on_flash);
Sathya Perla04b71172011-09-27 13:30:27 -0400196
Rick Jones68aad782011-11-07 13:29:27 +0000197 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
198 sizeof(drvinfo->bus_info));
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700199 drvinfo->testinfo_len = 0;
200 drvinfo->regdump_len = 0;
201 drvinfo->eedump_len = 0;
202}
203
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530204static u32 lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name)
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000205{
206 u32 data_read = 0, eof;
207 u8 addn_status;
208 struct be_dma_mem data_len_cmd;
209 int status;
210
211 memset(&data_len_cmd, 0, sizeof(data_len_cmd));
212 /* data_offset and data_size should be 0 to get reg len */
213 status = lancer_cmd_read_object(adapter, &data_len_cmd, 0, 0,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530214 file_name, &data_read, &eof,
215 &addn_status);
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000216
217 return data_read;
218}
219
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530220static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
221 u32 buf_len, void *buf)
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000222{
223 struct be_dma_mem read_cmd;
224 u32 read_len = 0, total_read_len = 0, chunk_size;
225 u32 eof = 0;
226 u8 addn_status;
227 int status = 0;
228
229 read_cmd.size = LANCER_READ_FILE_CHUNK;
230 read_cmd.va = pci_alloc_consistent(adapter->pdev, read_cmd.size,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530231 &read_cmd.dma);
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000232
233 if (!read_cmd.va) {
234 dev_err(&adapter->pdev->dev,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530235 "Memory allocation failure while reading dump\n");
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000236 return -ENOMEM;
237 }
238
239 while ((total_read_len < buf_len) && !eof) {
240 chunk_size = min_t(u32, (buf_len - total_read_len),
241 LANCER_READ_FILE_CHUNK);
242 chunk_size = ALIGN(chunk_size, 4);
243 status = lancer_cmd_read_object(adapter, &read_cmd, chunk_size,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530244 total_read_len, file_name,
245 &read_len, &eof, &addn_status);
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000246 if (!status) {
247 memcpy(buf + total_read_len, read_cmd.va, read_len);
248 total_read_len += read_len;
249 eof &= LANCER_READ_FILE_EOF_MASK;
250 } else {
251 status = -EIO;
252 break;
253 }
254 }
255 pci_free_consistent(adapter->pdev, read_cmd.size, read_cmd.va,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530256 read_cmd.dma);
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000257
258 return status;
259}
260
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530261static int be_get_reg_len(struct net_device *netdev)
Somnath Kotur311fddc2011-03-16 21:22:43 +0000262{
263 struct be_adapter *adapter = netdev_priv(netdev);
264 u32 log_size = 0;
265
Padmanabh Ratnakarf25b1192012-10-20 06:02:52 +0000266 if (!check_privilege(adapter, MAX_PRIVILEGES))
267 return 0;
268
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000269 if (be_physfn(adapter)) {
270 if (lancer_chip(adapter))
271 log_size = lancer_cmd_get_file_len(adapter,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530272 LANCER_FW_DUMP_FILE);
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000273 else
274 be_cmd_get_reg_len(adapter, &log_size);
275 }
Somnath Kotur311fddc2011-03-16 21:22:43 +0000276 return log_size;
277}
278
279static void
280be_get_regs(struct net_device *netdev, struct ethtool_regs *regs, void *buf)
281{
282 struct be_adapter *adapter = netdev_priv(netdev);
283
Ajit Khaparde16a871e2011-04-19 12:10:43 +0000284 if (be_physfn(adapter)) {
285 memset(buf, 0, regs->len);
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000286 if (lancer_chip(adapter))
287 lancer_cmd_read_file(adapter, LANCER_FW_DUMP_FILE,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530288 regs->len, buf);
Padmanabh Ratnakarde49bd52011-11-16 02:02:43 +0000289 else
290 be_cmd_get_regs(adapter, regs->len, buf);
Ajit Khaparde16a871e2011-04-19 12:10:43 +0000291 }
Somnath Kotur311fddc2011-03-16 21:22:43 +0000292}
293
Sathya Perla10ef9ab2012-02-09 18:05:27 +0000294static int be_get_coalesce(struct net_device *netdev,
295 struct ethtool_coalesce *et)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700296{
297 struct be_adapter *adapter = netdev_priv(netdev);
Sathya Perla2632baf2013-10-01 16:00:00 +0530298 struct be_aic_obj *aic = &adapter->aic_obj[0];
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700299
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700300
Sathya Perla2632baf2013-10-01 16:00:00 +0530301 et->rx_coalesce_usecs = aic->prev_eqd;
302 et->rx_coalesce_usecs_high = aic->max_eqd;
303 et->rx_coalesce_usecs_low = aic->min_eqd;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700304
Sathya Perla2632baf2013-10-01 16:00:00 +0530305 et->tx_coalesce_usecs = aic->prev_eqd;
306 et->tx_coalesce_usecs_high = aic->max_eqd;
307 et->tx_coalesce_usecs_low = aic->min_eqd;
Sathya Perla10ef9ab2012-02-09 18:05:27 +0000308
Sathya Perla2632baf2013-10-01 16:00:00 +0530309 et->use_adaptive_rx_coalesce = aic->enable;
310 et->use_adaptive_tx_coalesce = aic->enable;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700311
312 return 0;
313}
314
Sathya Perla10ef9ab2012-02-09 18:05:27 +0000315/* TX attributes are ignored. Only RX attributes are considered
316 * eqd cmd is issued in the worker thread.
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700317 */
Sathya Perla10ef9ab2012-02-09 18:05:27 +0000318static int be_set_coalesce(struct net_device *netdev,
319 struct ethtool_coalesce *et)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700320{
321 struct be_adapter *adapter = netdev_priv(netdev);
Sathya Perla2632baf2013-10-01 16:00:00 +0530322 struct be_aic_obj *aic = &adapter->aic_obj[0];
Sathya Perla10ef9ab2012-02-09 18:05:27 +0000323 struct be_eq_obj *eqo;
324 int i;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700325
Sathya Perla10ef9ab2012-02-09 18:05:27 +0000326 for_all_evt_queues(adapter, eqo, i) {
Sathya Perla2632baf2013-10-01 16:00:00 +0530327 aic->enable = et->use_adaptive_rx_coalesce;
328 aic->max_eqd = min(et->rx_coalesce_usecs_high, BE_MAX_EQD);
329 aic->min_eqd = min(et->rx_coalesce_usecs_low, aic->max_eqd);
330 aic->et_eqd = min(et->rx_coalesce_usecs, aic->max_eqd);
331 aic->et_eqd = max(aic->et_eqd, aic->min_eqd);
332 aic++;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700333 }
334
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700335 return 0;
336}
337
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530338static void be_get_ethtool_stats(struct net_device *netdev,
339 struct ethtool_stats *stats, uint64_t *data)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700340{
341 struct be_adapter *adapter = netdev_priv(netdev);
Sathya Perla3abcded2010-10-03 22:12:27 -0700342 struct be_rx_obj *rxo;
Sathya Perla3c8def92011-06-12 20:01:58 +0000343 struct be_tx_obj *txo;
Sathya Perlaac124ff2011-07-25 19:10:14 +0000344 void *p;
Sathya Perlaab1594e2011-07-25 19:10:15 +0000345 unsigned int i, j, base = 0, start;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700346
347 for (i = 0; i < ETHTOOL_STATS_NUM; i++) {
Sathya Perlaac124ff2011-07-25 19:10:14 +0000348 p = (u8 *)&adapter->drv_stats + et_stats[i].offset;
Sathya Perlaab1594e2011-07-25 19:10:15 +0000349 data[i] = *(u32 *)p;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700350 }
Sathya Perlaab1594e2011-07-25 19:10:15 +0000351 base += ETHTOOL_STATS_NUM;
Sathya Perla3abcded2010-10-03 22:12:27 -0700352
353 for_all_rx_queues(adapter, rxo, j) {
Sathya Perlaab1594e2011-07-25 19:10:15 +0000354 struct be_rx_stats *stats = rx_stats(rxo);
355
356 do {
Eric W. Biederman57a77442014-03-13 21:26:42 -0700357 start = u64_stats_fetch_begin_irq(&stats->sync);
Sathya Perlaab1594e2011-07-25 19:10:15 +0000358 data[base] = stats->rx_bytes;
359 data[base + 1] = stats->rx_pkts;
Eric W. Biederman57a77442014-03-13 21:26:42 -0700360 } while (u64_stats_fetch_retry_irq(&stats->sync, start));
Sathya Perlaab1594e2011-07-25 19:10:15 +0000361
362 for (i = 2; i < ETHTOOL_RXSTATS_NUM; i++) {
363 p = (u8 *)stats + et_rx_stats[i].offset;
364 data[base + i] = *(u32 *)p;
Sathya Perla3abcded2010-10-03 22:12:27 -0700365 }
Sathya Perlaab1594e2011-07-25 19:10:15 +0000366 base += ETHTOOL_RXSTATS_NUM;
Sathya Perla3abcded2010-10-03 22:12:27 -0700367 }
Sathya Perla3c8def92011-06-12 20:01:58 +0000368
Sathya Perla3c8def92011-06-12 20:01:58 +0000369 for_all_tx_queues(adapter, txo, j) {
Sathya Perlaab1594e2011-07-25 19:10:15 +0000370 struct be_tx_stats *stats = tx_stats(txo);
371
372 do {
Eric W. Biederman57a77442014-03-13 21:26:42 -0700373 start = u64_stats_fetch_begin_irq(&stats->sync_compl);
Sathya Perlaab1594e2011-07-25 19:10:15 +0000374 data[base] = stats->tx_compl;
Eric W. Biederman57a77442014-03-13 21:26:42 -0700375 } while (u64_stats_fetch_retry_irq(&stats->sync_compl, start));
Sathya Perlaab1594e2011-07-25 19:10:15 +0000376
377 do {
Eric W. Biederman57a77442014-03-13 21:26:42 -0700378 start = u64_stats_fetch_begin_irq(&stats->sync);
Sathya Perlaab1594e2011-07-25 19:10:15 +0000379 for (i = 1; i < ETHTOOL_TXSTATS_NUM; i++) {
380 p = (u8 *)stats + et_tx_stats[i].offset;
381 data[base + i] =
382 (et_tx_stats[i].size == sizeof(u64)) ?
383 *(u64 *)p : *(u32 *)p;
384 }
Eric W. Biederman57a77442014-03-13 21:26:42 -0700385 } while (u64_stats_fetch_retry_irq(&stats->sync, start));
Sathya Perlaab1594e2011-07-25 19:10:15 +0000386 base += ETHTOOL_TXSTATS_NUM;
Sathya Perla3c8def92011-06-12 20:01:58 +0000387 }
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700388}
389
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530390static void be_get_stat_strings(struct net_device *netdev, uint32_t stringset,
391 uint8_t *data)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700392{
Sathya Perla3abcded2010-10-03 22:12:27 -0700393 struct be_adapter *adapter = netdev_priv(netdev);
394 int i, j;
395
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700396 switch (stringset) {
397 case ETH_SS_STATS:
398 for (i = 0; i < ETHTOOL_STATS_NUM; i++) {
399 memcpy(data, et_stats[i].desc, ETH_GSTRING_LEN);
400 data += ETH_GSTRING_LEN;
401 }
Sathya Perla3abcded2010-10-03 22:12:27 -0700402 for (i = 0; i < adapter->num_rx_qs; i++) {
403 for (j = 0; j < ETHTOOL_RXSTATS_NUM; j++) {
404 sprintf(data, "rxq%d: %s", i,
405 et_rx_stats[j].desc);
406 data += ETH_GSTRING_LEN;
407 }
408 }
Sathya Perla3c8def92011-06-12 20:01:58 +0000409 for (i = 0; i < adapter->num_tx_qs; i++) {
410 for (j = 0; j < ETHTOOL_TXSTATS_NUM; j++) {
411 sprintf(data, "txq%d: %s", i,
412 et_tx_stats[j].desc);
413 data += ETH_GSTRING_LEN;
414 }
415 }
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700416 break;
Suresh Rff33a6e2009-12-03 16:15:52 -0800417 case ETH_SS_TEST:
418 for (i = 0; i < ETHTOOL_TESTS_NUM; i++) {
419 memcpy(data, et_self_tests[i], ETH_GSTRING_LEN);
420 data += ETH_GSTRING_LEN;
421 }
422 break;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700423 }
424}
425
Ben Hutchings15f0a392009-10-01 11:58:24 +0000426static int be_get_sset_count(struct net_device *netdev, int stringset)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700427{
Sathya Perla3abcded2010-10-03 22:12:27 -0700428 struct be_adapter *adapter = netdev_priv(netdev);
429
Ben Hutchings15f0a392009-10-01 11:58:24 +0000430 switch (stringset) {
Suresh Rff33a6e2009-12-03 16:15:52 -0800431 case ETH_SS_TEST:
432 return ETHTOOL_TESTS_NUM;
Ben Hutchings15f0a392009-10-01 11:58:24 +0000433 case ETH_SS_STATS:
Sathya Perla3abcded2010-10-03 22:12:27 -0700434 return ETHTOOL_STATS_NUM +
Sathya Perla3c8def92011-06-12 20:01:58 +0000435 adapter->num_rx_qs * ETHTOOL_RXSTATS_NUM +
436 adapter->num_tx_qs * ETHTOOL_TXSTATS_NUM;
Ben Hutchings15f0a392009-10-01 11:58:24 +0000437 default:
438 return -EINVAL;
439 }
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700440}
441
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000442static u32 be_get_port_type(u32 phy_type, u32 dac_cable_len)
443{
444 u32 port;
445
446 switch (phy_type) {
447 case PHY_TYPE_BASET_1GB:
448 case PHY_TYPE_BASEX_1GB:
449 case PHY_TYPE_SGMII:
450 port = PORT_TP;
451 break;
452 case PHY_TYPE_SFP_PLUS_10GB:
453 port = dac_cable_len ? PORT_DA : PORT_FIBRE;
454 break;
455 case PHY_TYPE_XFP_10GB:
456 case PHY_TYPE_SFP_1GB:
457 port = PORT_FIBRE;
458 break;
459 case PHY_TYPE_BASET_10GB:
460 port = PORT_TP;
461 break;
462 default:
463 port = PORT_OTHER;
464 }
465
466 return port;
467}
468
469static u32 convert_to_et_setting(u32 if_type, u32 if_speeds)
470{
471 u32 val = 0;
472
473 switch (if_type) {
474 case PHY_TYPE_BASET_1GB:
475 case PHY_TYPE_BASEX_1GB:
476 case PHY_TYPE_SGMII:
477 val |= SUPPORTED_TP;
478 if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
479 val |= SUPPORTED_1000baseT_Full;
480 if (if_speeds & BE_SUPPORTED_SPEED_100MBPS)
481 val |= SUPPORTED_100baseT_Full;
482 if (if_speeds & BE_SUPPORTED_SPEED_10MBPS)
483 val |= SUPPORTED_10baseT_Full;
484 break;
485 case PHY_TYPE_KX4_10GB:
486 val |= SUPPORTED_Backplane;
487 if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
488 val |= SUPPORTED_1000baseKX_Full;
489 if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
490 val |= SUPPORTED_10000baseKX4_Full;
491 break;
492 case PHY_TYPE_KR_10GB:
493 val |= SUPPORTED_Backplane |
494 SUPPORTED_10000baseKR_Full;
495 break;
496 case PHY_TYPE_SFP_PLUS_10GB:
497 case PHY_TYPE_XFP_10GB:
498 case PHY_TYPE_SFP_1GB:
499 val |= SUPPORTED_FIBRE;
500 if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
501 val |= SUPPORTED_10000baseT_Full;
502 if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
503 val |= SUPPORTED_1000baseT_Full;
504 break;
505 case PHY_TYPE_BASET_10GB:
506 val |= SUPPORTED_TP;
507 if (if_speeds & BE_SUPPORTED_SPEED_10GBPS)
508 val |= SUPPORTED_10000baseT_Full;
509 if (if_speeds & BE_SUPPORTED_SPEED_1GBPS)
510 val |= SUPPORTED_1000baseT_Full;
511 if (if_speeds & BE_SUPPORTED_SPEED_100MBPS)
512 val |= SUPPORTED_100baseT_Full;
513 break;
514 default:
515 val |= SUPPORTED_TP;
516 }
517
518 return val;
519}
520
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000521bool be_pause_supported(struct be_adapter *adapter)
522{
523 return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB ||
524 adapter->phy.interface_type == PHY_TYPE_XFP_10GB) ?
525 false : true;
526}
527
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700528static int be_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
529{
Sarveshwar Bandi0388f252009-10-28 04:15:20 -0700530 struct be_adapter *adapter = netdev_priv(netdev);
Ajit Khapardeb236916a2011-12-30 12:15:40 +0000531 u8 link_status;
Sathya Perla323ff712012-09-28 04:39:43 +0000532 u16 link_speed = 0;
Ajit Khaparde0dffc832009-11-29 17:57:46 +0000533 int status;
Padmanabh Ratnakardb15dfa2012-10-20 06:03:04 +0000534 u32 auto_speeds;
535 u32 fixed_speeds;
536 u32 dac_cable_len;
537 u16 interface_type;
Sarveshwar Bandi0388f252009-10-28 04:15:20 -0700538
Sathya Perla323ff712012-09-28 04:39:43 +0000539 if (adapter->phy.link_speed < 0) {
540 status = be_cmd_link_status_query(adapter, &link_speed,
541 &link_status, 0);
542 if (!status)
543 be_link_status_update(adapter, link_status);
544 ethtool_cmd_speed_set(ecmd, link_speed);
Ajit Khapardeee3cb622010-07-01 03:51:00 +0000545
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000546 status = be_cmd_get_phy_info(adapter);
Padmanabh Ratnakardb15dfa2012-10-20 06:03:04 +0000547 if (!status) {
548 interface_type = adapter->phy.interface_type;
549 auto_speeds = adapter->phy.auto_speeds_supported;
550 fixed_speeds = adapter->phy.fixed_speeds_supported;
551 dac_cable_len = adapter->phy.dac_cable_len;
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000552
Padmanabh Ratnakardb15dfa2012-10-20 06:03:04 +0000553 ecmd->supported =
554 convert_to_et_setting(interface_type,
555 auto_speeds |
556 fixed_speeds);
557 ecmd->advertising =
558 convert_to_et_setting(interface_type,
559 auto_speeds);
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000560
Padmanabh Ratnakardb15dfa2012-10-20 06:03:04 +0000561 ecmd->port = be_get_port_type(interface_type,
562 dac_cable_len);
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000563
Padmanabh Ratnakardb15dfa2012-10-20 06:03:04 +0000564 if (adapter->phy.auto_speeds_supported) {
565 ecmd->supported |= SUPPORTED_Autoneg;
566 ecmd->autoneg = AUTONEG_ENABLE;
567 ecmd->advertising |= ADVERTISED_Autoneg;
568 }
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000569
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000570 ecmd->supported |= SUPPORTED_Pause;
Padmanabh Ratnakardb15dfa2012-10-20 06:03:04 +0000571 if (be_pause_supported(adapter))
572 ecmd->advertising |= ADVERTISED_Pause;
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000573
Padmanabh Ratnakardb15dfa2012-10-20 06:03:04 +0000574 switch (adapter->phy.interface_type) {
575 case PHY_TYPE_KR_10GB:
576 case PHY_TYPE_KX4_10GB:
577 ecmd->transceiver = XCVR_INTERNAL;
578 break;
579 default:
580 ecmd->transceiver = XCVR_EXTERNAL;
581 break;
582 }
583 } else {
584 ecmd->port = PORT_OTHER;
585 ecmd->autoneg = AUTONEG_DISABLE;
586 ecmd->transceiver = XCVR_DUMMY1;
Sarveshwar Bandi0388f252009-10-28 04:15:20 -0700587 }
Ajit Khaparde0dffc832009-11-29 17:57:46 +0000588
589 /* Save for future use */
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000590 adapter->phy.link_speed = ethtool_cmd_speed(ecmd);
591 adapter->phy.port_type = ecmd->port;
592 adapter->phy.transceiver = ecmd->transceiver;
593 adapter->phy.autoneg = ecmd->autoneg;
594 adapter->phy.advertising = ecmd->advertising;
595 adapter->phy.supported = ecmd->supported;
Ajit Khaparde0dffc832009-11-29 17:57:46 +0000596 } else {
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000597 ethtool_cmd_speed_set(ecmd, adapter->phy.link_speed);
598 ecmd->port = adapter->phy.port_type;
599 ecmd->transceiver = adapter->phy.transceiver;
600 ecmd->autoneg = adapter->phy.autoneg;
601 ecmd->advertising = adapter->phy.advertising;
602 ecmd->supported = adapter->phy.supported;
Sarveshwar Bandi0388f252009-10-28 04:15:20 -0700603 }
Ajit Khaparde0dffc832009-11-29 17:57:46 +0000604
Somnath Kotur682256d2012-05-02 03:40:32 +0000605 ecmd->duplex = netif_carrier_ok(netdev) ? DUPLEX_FULL : DUPLEX_UNKNOWN;
Sarveshwar Bandi0388f252009-10-28 04:15:20 -0700606 ecmd->phy_address = adapter->port_num;
Ajit Khapardeee3cb622010-07-01 03:51:00 +0000607
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700608 return 0;
609}
610
Sathya Perla110b82b2011-12-13 00:58:49 +0000611static void be_get_ringparam(struct net_device *netdev,
612 struct ethtool_ringparam *ring)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700613{
614 struct be_adapter *adapter = netdev_priv(netdev);
615
Sathya Perla110b82b2011-12-13 00:58:49 +0000616 ring->rx_max_pending = ring->rx_pending = adapter->rx_obj[0].q.len;
617 ring->tx_max_pending = ring->tx_pending = adapter->tx_obj[0].q.len;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700618}
619
620static void
621be_get_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
622{
623 struct be_adapter *adapter = netdev_priv(netdev);
624
Sathya Perla8788fdc2009-07-27 22:52:03 +0000625 be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause);
Ajit Khaparde42f11cf2012-04-21 18:53:22 +0000626 ecmd->autoneg = adapter->phy.fc_autoneg;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700627}
628
629static int
630be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
631{
632 struct be_adapter *adapter = netdev_priv(netdev);
633 int status;
634
Padmanabh Ratnakarc871c5f2012-07-12 03:56:11 +0000635 if (ecmd->autoneg != adapter->phy.fc_autoneg)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700636 return -EINVAL;
Ajit Khaparde9e90c962009-11-06 02:06:59 +0000637 adapter->tx_fc = ecmd->tx_pause;
638 adapter->rx_fc = ecmd->rx_pause;
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700639
Ajit Khaparde9e90c962009-11-06 02:06:59 +0000640 status = be_cmd_set_flow_control(adapter,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530641 adapter->tx_fc, adapter->rx_fc);
Ajit Khaparde9e90c962009-11-06 02:06:59 +0000642 if (status)
Sathya Perla6b7c5b92009-03-11 23:32:03 -0700643 dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");
644
645 return status;
646}
647
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530648static int be_set_phys_id(struct net_device *netdev,
649 enum ethtool_phys_id_state state)
Sarveshwar Bandifad9ab22009-10-12 04:23:15 -0700650{
651 struct be_adapter *adapter = netdev_priv(netdev);
Sarveshwar Bandifad9ab22009-10-12 04:23:15 -0700652
stephen hemminger1a642462011-04-04 11:06:40 +0000653 switch (state) {
654 case ETHTOOL_ID_ACTIVE:
655 be_cmd_get_beacon_state(adapter, adapter->hba_port_num,
656 &adapter->beacon_state);
Allan, Bruce Wfce55922011-04-13 13:09:10 +0000657 return 1; /* cycle on/off once per second */
Sarveshwar Bandifad9ab22009-10-12 04:23:15 -0700658
stephen hemminger1a642462011-04-04 11:06:40 +0000659 case ETHTOOL_ID_ON:
660 be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
661 BEACON_STATE_ENABLED);
662 break;
Sarveshwar Bandifad9ab22009-10-12 04:23:15 -0700663
stephen hemminger1a642462011-04-04 11:06:40 +0000664 case ETHTOOL_ID_OFF:
665 be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
666 BEACON_STATE_DISABLED);
667 break;
Sarveshwar Bandifad9ab22009-10-12 04:23:15 -0700668
stephen hemminger1a642462011-04-04 11:06:40 +0000669 case ETHTOOL_ID_INACTIVE:
670 be_cmd_set_beacon_state(adapter, adapter->hba_port_num, 0, 0,
671 adapter->beacon_state);
672 }
Sarveshwar Bandifad9ab22009-10-12 04:23:15 -0700673
stephen hemminger1a642462011-04-04 11:06:40 +0000674 return 0;
Sarveshwar Bandifad9ab22009-10-12 04:23:15 -0700675}
676
Somnath Kotur5c510812013-05-30 02:52:23 +0000677static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
678{
679 struct be_adapter *adapter = netdev_priv(netdev);
680 struct device *dev = &adapter->pdev->dev;
681 int status;
682
683 if (!lancer_chip(adapter)) {
684 dev_err(dev, "FW dump not supported\n");
685 return -EOPNOTSUPP;
686 }
687
688 if (dump_present(adapter)) {
689 dev_err(dev, "Previous dump not cleared, not forcing dump\n");
690 return 0;
691 }
692
693 switch (dump->flag) {
694 case LANCER_INITIATE_FW_DUMP:
695 status = lancer_initiate_dump(adapter);
696 if (!status)
697 dev_info(dev, "F/w dump initiated successfully\n");
698 break;
699 default:
700 dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag);
701 return -EINVAL;
702 }
703 return status;
704}
Ajit Khapardedcf96f12011-02-11 13:39:30 +0000705
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530706static void be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000707{
708 struct be_adapter *adapter = netdev_priv(netdev);
709
Suresh Reddy76a9e082014-01-15 13:23:40 +0530710 if (adapter->wol_cap & BE_WOL_CAP) {
Ajit Khaparde4762f6c2012-03-18 06:23:11 +0000711 wol->supported |= WAKE_MAGIC;
Suresh Reddy76a9e082014-01-15 13:23:40 +0530712 if (adapter->wol_en)
Sarveshwar Bandib4243322013-04-25 00:56:56 +0000713 wol->wolopts |= WAKE_MAGIC;
Suresh Reddy76a9e082014-01-15 13:23:40 +0530714 } else {
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000715 wol->wolopts = 0;
Suresh Reddy76a9e082014-01-15 13:23:40 +0530716 }
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000717 memset(&wol->sopass, 0, sizeof(wol->sopass));
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000718}
719
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530720static int be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000721{
722 struct be_adapter *adapter = netdev_priv(netdev);
723
724 if (wol->wolopts & ~WAKE_MAGIC)
Ajit Khaparde4762f6c2012-03-18 06:23:11 +0000725 return -EOPNOTSUPP;
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000726
Suresh Reddy76a9e082014-01-15 13:23:40 +0530727 if (!(adapter->wol_cap & BE_WOL_CAP)) {
Ajit Khaparde4762f6c2012-03-18 06:23:11 +0000728 dev_warn(&adapter->pdev->dev, "WOL not supported\n");
729 return -EOPNOTSUPP;
730 }
731
732 if (wol->wolopts & WAKE_MAGIC)
Suresh Reddy76a9e082014-01-15 13:23:40 +0530733 adapter->wol_en = true;
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000734 else
Suresh Reddy76a9e082014-01-15 13:23:40 +0530735 adapter->wol_en = false;
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +0000736
737 return 0;
738}
739
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530740static int be_test_ddr_dma(struct be_adapter *adapter)
Suresh Rff33a6e2009-12-03 16:15:52 -0800741{
742 int ret, i;
743 struct be_dma_mem ddrdma_cmd;
Joe Perches215faf92010-12-21 02:16:10 -0800744 static const u64 pattern[2] = {
745 0x5a5a5a5a5a5a5a5aULL, 0xa5a5a5a5a5a5a5a5ULL
746 };
Suresh Rff33a6e2009-12-03 16:15:52 -0800747
748 ddrdma_cmd.size = sizeof(struct be_cmd_req_ddrdma_test);
Ivan Vecera2b7bceb2011-02-02 08:05:12 +0000749 ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, ddrdma_cmd.size,
750 &ddrdma_cmd.dma, GFP_KERNEL);
Joe Perchesd0320f72013-03-14 13:07:21 +0000751 if (!ddrdma_cmd.va)
Suresh Rff33a6e2009-12-03 16:15:52 -0800752 return -ENOMEM;
Suresh Rff33a6e2009-12-03 16:15:52 -0800753
754 for (i = 0; i < 2; i++) {
755 ret = be_cmd_ddr_dma_test(adapter, pattern[i],
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530756 4096, &ddrdma_cmd);
Suresh Rff33a6e2009-12-03 16:15:52 -0800757 if (ret != 0)
758 goto err;
759 }
760
761err:
Ivan Vecera2b7bceb2011-02-02 08:05:12 +0000762 dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va,
763 ddrdma_cmd.dma);
Suresh Rff33a6e2009-12-03 16:15:52 -0800764 return ret;
765}
766
Sarveshwar Bandifced9992009-12-23 04:41:44 +0000767static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530768 u64 *status)
Sarveshwar Bandifced9992009-12-23 04:41:44 +0000769{
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530770 be_cmd_set_loopback(adapter, adapter->hba_port_num, loopback_type, 1);
Ajit Khaparde9e1453c2011-02-20 11:42:22 +0000771 *status = be_cmd_loopback_test(adapter, adapter->hba_port_num,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530772 loopback_type, 1500, 2, 0xabc);
773 be_cmd_set_loopback(adapter, adapter->hba_port_num, BE_NO_LOOPBACK, 1);
Sarveshwar Bandifced9992009-12-23 04:41:44 +0000774 return *status;
775}
776
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530777static void be_self_test(struct net_device *netdev, struct ethtool_test *test,
778 u64 *data)
Suresh Rff33a6e2009-12-03 16:15:52 -0800779{
780 struct be_adapter *adapter = netdev_priv(netdev);
Sathya Perla323ff712012-09-28 04:39:43 +0000781 int status;
782 u8 link_status = 0;
Suresh Rff33a6e2009-12-03 16:15:52 -0800783
Suresh Reddy78d0b112013-04-25 23:03:22 +0000784 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) {
785 dev_err(&adapter->pdev->dev, "Self test not supported\n");
786 test->flags |= ETH_TEST_FL_FAILED;
787 return;
788 }
789
Suresh Rff33a6e2009-12-03 16:15:52 -0800790 memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
791
792 if (test->flags & ETH_TEST_FL_OFFLINE) {
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530793 if (be_loopback_test(adapter, BE_MAC_LOOPBACK, &data[0]) != 0)
Suresh Rff33a6e2009-12-03 16:15:52 -0800794 test->flags |= ETH_TEST_FL_FAILED;
Ivan Vecera5a8a1ab2014-03-05 11:54:05 +0100795
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530796 if (be_loopback_test(adapter, BE_PHY_LOOPBACK, &data[1]) != 0)
Suresh Rff33a6e2009-12-03 16:15:52 -0800797 test->flags |= ETH_TEST_FL_FAILED;
Ivan Vecera5a8a1ab2014-03-05 11:54:05 +0100798
799 if (test->flags & ETH_TEST_FL_EXTERNAL_LB) {
800 if (be_loopback_test(adapter, BE_ONE_PORT_EXT_LOOPBACK,
801 &data[2]) != 0)
802 test->flags |= ETH_TEST_FL_FAILED;
803 test->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE;
Sarveshwar Bandifced9992009-12-23 04:41:44 +0000804 }
Sarveshwar Bandi8f47afe2010-01-19 05:15:00 +0000805 }
Suresh Rff33a6e2009-12-03 16:15:52 -0800806
Padmanabh Ratnakara7047392012-04-25 01:46:28 +0000807 if (!lancer_chip(adapter) && be_test_ddr_dma(adapter) != 0) {
Sarveshwar Bandi8f47afe2010-01-19 05:15:00 +0000808 data[3] = 1;
809 test->flags |= ETH_TEST_FL_FAILED;
Suresh Rff33a6e2009-12-03 16:15:52 -0800810 }
811
Sathya Perla323ff712012-09-28 04:39:43 +0000812 status = be_cmd_link_status_query(adapter, NULL, &link_status, 0);
813 if (status) {
Sarveshwar Bandi4276e472010-01-19 05:15:36 +0000814 test->flags |= ETH_TEST_FL_FAILED;
815 data[4] = -1;
Sathya Perla323ff712012-09-28 04:39:43 +0000816 } else if (!link_status) {
Ajit Khaparde4ee77212011-02-20 11:41:20 +0000817 test->flags |= ETH_TEST_FL_FAILED;
Sarveshwar Bandi4276e472010-01-19 05:15:36 +0000818 data[4] = 1;
819 }
Suresh Rff33a6e2009-12-03 16:15:52 -0800820}
821
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530822static int be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
Ajit Khaparde84517482009-09-04 03:12:16 +0000823{
824 struct be_adapter *adapter = netdev_priv(netdev);
Ajit Khaparde84517482009-09-04 03:12:16 +0000825
Ben Hutchings786f5282012-02-01 09:32:25 +0000826 return be_load_fw(adapter, efl->data);
Ajit Khaparde84517482009-09-04 03:12:16 +0000827}
828
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530829static int be_get_eeprom_len(struct net_device *netdev)
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800830{
Padmanabh Ratnakaraf5875b2011-11-16 02:03:07 +0000831 struct be_adapter *adapter = netdev_priv(netdev);
Padmanabh Ratnakarf25b1192012-10-20 06:02:52 +0000832
833 if (!check_privilege(adapter, MAX_PRIVILEGES))
834 return 0;
835
Padmanabh Ratnakaraf5875b2011-11-16 02:03:07 +0000836 if (lancer_chip(adapter)) {
837 if (be_physfn(adapter))
838 return lancer_cmd_get_file_len(adapter,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530839 LANCER_VPD_PF_FILE);
Padmanabh Ratnakaraf5875b2011-11-16 02:03:07 +0000840 else
841 return lancer_cmd_get_file_len(adapter,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530842 LANCER_VPD_VF_FILE);
Padmanabh Ratnakaraf5875b2011-11-16 02:03:07 +0000843 } else {
844 return BE_READ_SEEPROM_LEN;
845 }
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800846}
847
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530848static int be_read_eeprom(struct net_device *netdev,
849 struct ethtool_eeprom *eeprom, uint8_t *data)
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800850{
851 struct be_adapter *adapter = netdev_priv(netdev);
852 struct be_dma_mem eeprom_cmd;
853 struct be_cmd_resp_seeprom_read *resp;
854 int status;
855
856 if (!eeprom->len)
857 return -EINVAL;
858
Padmanabh Ratnakaraf5875b2011-11-16 02:03:07 +0000859 if (lancer_chip(adapter)) {
860 if (be_physfn(adapter))
861 return lancer_cmd_read_file(adapter, LANCER_VPD_PF_FILE,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530862 eeprom->len, data);
Padmanabh Ratnakaraf5875b2011-11-16 02:03:07 +0000863 else
864 return lancer_cmd_read_file(adapter, LANCER_VPD_VF_FILE,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530865 eeprom->len, data);
Padmanabh Ratnakaraf5875b2011-11-16 02:03:07 +0000866 }
867
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800868 eeprom->magic = BE_VENDOR_ID | (adapter->pdev->device<<16);
869
870 memset(&eeprom_cmd, 0, sizeof(struct be_dma_mem));
871 eeprom_cmd.size = sizeof(struct be_cmd_req_seeprom_read);
Ivan Vecera2b7bceb2011-02-02 08:05:12 +0000872 eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, eeprom_cmd.size,
873 &eeprom_cmd.dma, GFP_KERNEL);
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800874
Joe Perchesd0320f72013-03-14 13:07:21 +0000875 if (!eeprom_cmd.va)
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800876 return -ENOMEM;
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800877
878 status = be_cmd_get_seeprom_data(adapter, &eeprom_cmd);
879
880 if (!status) {
Joe Perches43d620c2011-06-16 19:08:06 +0000881 resp = eeprom_cmd.va;
Ajit Khapardec0ad9842010-02-08 17:51:26 +0000882 memcpy(data, resp->seeprom_data + eeprom->offset, eeprom->len);
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800883 }
Ivan Vecera2b7bceb2011-02-02 08:05:12 +0000884 dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va,
885 eeprom_cmd.dma);
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -0800886
887 return status;
888}
889
Somnath Kotur941a77d2012-05-17 22:59:03 +0000890static u32 be_get_msg_level(struct net_device *netdev)
891{
892 struct be_adapter *adapter = netdev_priv(netdev);
893
Somnath Kotur941a77d2012-05-17 22:59:03 +0000894 return adapter->msg_enable;
895}
896
Somnath Kotur941a77d2012-05-17 22:59:03 +0000897static void be_set_msg_level(struct net_device *netdev, u32 level)
898{
899 struct be_adapter *adapter = netdev_priv(netdev);
900
Somnath Kotur941a77d2012-05-17 22:59:03 +0000901 if (adapter->msg_enable == level)
902 return;
903
904 if ((level & NETIF_MSG_HW) != (adapter->msg_enable & NETIF_MSG_HW))
Vasundhara Volambaaa08d2014-01-15 13:23:34 +0530905 if (BEx_chip(adapter))
906 be_cmd_set_fw_log_level(adapter, level & NETIF_MSG_HW ?
907 FW_LOG_LEVEL_DEFAULT :
908 FW_LOG_LEVEL_FATAL);
Somnath Kotur941a77d2012-05-17 22:59:03 +0000909 adapter->msg_enable = level;
910
911 return;
912}
913
Suresh Reddy594ad542013-04-25 23:03:20 +0000914static u64 be_get_rss_hash_opts(struct be_adapter *adapter, u64 flow_type)
915{
916 u64 data = 0;
917
918 switch (flow_type) {
919 case TCP_V4_FLOW:
Venkata Duvvurue2557872014-04-21 15:38:00 +0530920 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4)
Suresh Reddy594ad542013-04-25 23:03:20 +0000921 data |= RXH_IP_DST | RXH_IP_SRC;
Venkata Duvvurue2557872014-04-21 15:38:00 +0530922 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV4)
Suresh Reddy594ad542013-04-25 23:03:20 +0000923 data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
924 break;
925 case UDP_V4_FLOW:
Venkata Duvvurue2557872014-04-21 15:38:00 +0530926 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4)
Suresh Reddy594ad542013-04-25 23:03:20 +0000927 data |= RXH_IP_DST | RXH_IP_SRC;
Venkata Duvvurue2557872014-04-21 15:38:00 +0530928 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV4)
Suresh Reddy594ad542013-04-25 23:03:20 +0000929 data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
930 break;
931 case TCP_V6_FLOW:
Venkata Duvvurue2557872014-04-21 15:38:00 +0530932 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6)
Suresh Reddy594ad542013-04-25 23:03:20 +0000933 data |= RXH_IP_DST | RXH_IP_SRC;
Venkata Duvvurue2557872014-04-21 15:38:00 +0530934 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV6)
Suresh Reddy594ad542013-04-25 23:03:20 +0000935 data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
936 break;
937 case UDP_V6_FLOW:
Venkata Duvvurue2557872014-04-21 15:38:00 +0530938 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6)
Suresh Reddy594ad542013-04-25 23:03:20 +0000939 data |= RXH_IP_DST | RXH_IP_SRC;
Venkata Duvvurue2557872014-04-21 15:38:00 +0530940 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV6)
Suresh Reddy594ad542013-04-25 23:03:20 +0000941 data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
942 break;
943 }
944
945 return data;
946}
947
948static int be_get_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd,
Sathya Perla05e4c6a2014-05-09 13:29:15 +0530949 u32 *rule_locs)
Suresh Reddy594ad542013-04-25 23:03:20 +0000950{
951 struct be_adapter *adapter = netdev_priv(netdev);
952
953 if (!be_multi_rxq(adapter)) {
954 dev_info(&adapter->pdev->dev,
955 "ethtool::get_rxnfc: RX flow hashing is disabled\n");
956 return -EINVAL;
957 }
958
959 switch (cmd->cmd) {
960 case ETHTOOL_GRXFH:
961 cmd->data = be_get_rss_hash_opts(adapter, cmd->flow_type);
962 break;
963 case ETHTOOL_GRXRINGS:
964 cmd->data = adapter->num_rx_qs - 1;
965 break;
966 default:
967 return -EINVAL;
968 }
969
970 return 0;
971}
972
973static int be_set_rss_hash_opts(struct be_adapter *adapter,
974 struct ethtool_rxnfc *cmd)
975{
976 struct be_rx_obj *rxo;
977 int status = 0, i, j;
978 u8 rsstable[128];
Venkata Duvvurue2557872014-04-21 15:38:00 +0530979 u32 rss_flags = adapter->rss_info.rss_flags;
Suresh Reddy594ad542013-04-25 23:03:20 +0000980
981 if (cmd->data != L3_RSS_FLAGS &&
982 cmd->data != (L3_RSS_FLAGS | L4_RSS_FLAGS))
983 return -EINVAL;
984
985 switch (cmd->flow_type) {
986 case TCP_V4_FLOW:
987 if (cmd->data == L3_RSS_FLAGS)
988 rss_flags &= ~RSS_ENABLE_TCP_IPV4;
989 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
990 rss_flags |= RSS_ENABLE_IPV4 |
991 RSS_ENABLE_TCP_IPV4;
992 break;
993 case TCP_V6_FLOW:
994 if (cmd->data == L3_RSS_FLAGS)
995 rss_flags &= ~RSS_ENABLE_TCP_IPV6;
996 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
997 rss_flags |= RSS_ENABLE_IPV6 |
998 RSS_ENABLE_TCP_IPV6;
999 break;
1000 case UDP_V4_FLOW:
1001 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) &&
1002 BEx_chip(adapter))
1003 return -EINVAL;
1004
1005 if (cmd->data == L3_RSS_FLAGS)
1006 rss_flags &= ~RSS_ENABLE_UDP_IPV4;
1007 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
1008 rss_flags |= RSS_ENABLE_IPV4 |
1009 RSS_ENABLE_UDP_IPV4;
1010 break;
1011 case UDP_V6_FLOW:
1012 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) &&
1013 BEx_chip(adapter))
1014 return -EINVAL;
1015
1016 if (cmd->data == L3_RSS_FLAGS)
1017 rss_flags &= ~RSS_ENABLE_UDP_IPV6;
1018 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS))
1019 rss_flags |= RSS_ENABLE_IPV6 |
1020 RSS_ENABLE_UDP_IPV6;
1021 break;
1022 default:
1023 return -EINVAL;
1024 }
1025
Venkata Duvvurue2557872014-04-21 15:38:00 +05301026 if (rss_flags == adapter->rss_info.rss_flags)
Suresh Reddy594ad542013-04-25 23:03:20 +00001027 return status;
1028
1029 if (be_multi_rxq(adapter)) {
1030 for (j = 0; j < 128; j += adapter->num_rx_qs - 1) {
1031 for_all_rss_queues(adapter, rxo, i) {
1032 if ((j + i) >= 128)
1033 break;
1034 rsstable[j + i] = rxo->rss_id;
1035 }
1036 }
1037 }
Venkata Duvvurue2557872014-04-21 15:38:00 +05301038
1039 status = be_cmd_rss_config(adapter, adapter->rss_info.rsstable,
1040 rss_flags, 128, adapter->rss_info.rss_hkey);
Suresh Reddy594ad542013-04-25 23:03:20 +00001041 if (!status)
Venkata Duvvurue2557872014-04-21 15:38:00 +05301042 adapter->rss_info.rss_flags = rss_flags;
Suresh Reddy594ad542013-04-25 23:03:20 +00001043
1044 return status;
1045}
1046
1047static int be_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
1048{
1049 struct be_adapter *adapter = netdev_priv(netdev);
1050 int status = 0;
1051
1052 if (!be_multi_rxq(adapter)) {
1053 dev_err(&adapter->pdev->dev,
1054 "ethtool::set_rxnfc: RX flow hashing is disabled\n");
1055 return -EINVAL;
1056 }
1057
1058 switch (cmd->cmd) {
1059 case ETHTOOL_SRXFH:
1060 status = be_set_rss_hash_opts(adapter, cmd);
1061 break;
1062 default:
1063 return -EINVAL;
1064 }
1065
1066 return status;
1067}
1068
Sathya Perla68d7bdc2013-08-27 16:57:35 +05301069static void be_get_channels(struct net_device *netdev,
1070 struct ethtool_channels *ch)
1071{
1072 struct be_adapter *adapter = netdev_priv(netdev);
1073
1074 ch->combined_count = adapter->num_evt_qs;
1075 ch->max_combined = be_max_qs(adapter);
1076}
1077
1078static int be_set_channels(struct net_device *netdev,
1079 struct ethtool_channels *ch)
1080{
1081 struct be_adapter *adapter = netdev_priv(netdev);
1082
1083 if (ch->rx_count || ch->tx_count || ch->other_count ||
1084 !ch->combined_count || ch->combined_count > be_max_qs(adapter))
1085 return -EINVAL;
1086
1087 adapter->cfg_num_qs = ch->combined_count;
1088
1089 return be_update_queues(adapter);
1090}
1091
Venkata Duvvurue2557872014-04-21 15:38:00 +05301092static u32 be_get_rxfh_indir_size(struct net_device *netdev)
1093{
1094 return RSS_INDIR_TABLE_LEN;
1095}
1096
1097static u32 be_get_rxfh_key_size(struct net_device *netdev)
1098{
1099 return RSS_HASH_KEY_LEN;
1100}
1101
1102static int be_get_rxfh(struct net_device *netdev, u32 *indir, u8 *hkey)
1103{
1104 struct be_adapter *adapter = netdev_priv(netdev);
1105 int i;
1106 struct rss_info *rss = &adapter->rss_info;
1107
1108 if (indir) {
1109 for (i = 0; i < RSS_INDIR_TABLE_LEN; i++)
1110 indir[i] = rss->rss_queue[i];
1111 }
1112
1113 if (hkey)
1114 memcpy(hkey, rss->rss_hkey, RSS_HASH_KEY_LEN);
1115
1116 return 0;
1117}
1118
1119static int be_set_rxfh(struct net_device *netdev, u32 *indir, u8 *hkey)
1120{
1121 int rc = 0, i, j;
1122 struct be_adapter *adapter = netdev_priv(netdev);
1123 u8 rsstable[RSS_INDIR_TABLE_LEN];
1124
1125 if (indir) {
1126 struct be_rx_obj *rxo;
1127 for (i = 0; i < RSS_INDIR_TABLE_LEN; i++) {
1128 j = indir[i];
1129 rxo = &adapter->rx_obj[j];
1130 rsstable[i] = rxo->rss_id;
1131 adapter->rss_info.rss_queue[i] = j;
1132 }
1133 } else {
1134 memcpy(rsstable, adapter->rss_info.rsstable,
1135 RSS_INDIR_TABLE_LEN);
1136 }
1137
1138 if (!hkey)
1139 hkey = adapter->rss_info.rss_hkey;
1140
1141 rc = be_cmd_rss_config(adapter, rsstable,
1142 adapter->rss_info.rss_flags,
1143 RSS_INDIR_TABLE_LEN, hkey);
1144 if (rc) {
1145 adapter->rss_info.rss_flags = RSS_ENABLE_NONE;
1146 return -EIO;
1147 }
1148 memcpy(adapter->rss_info.rss_hkey, hkey, RSS_HASH_KEY_LEN);
1149 memcpy(adapter->rss_info.rsstable, rsstable,
1150 RSS_INDIR_TABLE_LEN);
1151 return 0;
1152}
1153
Stephen Hemminger0fc0b732009-09-02 01:03:33 -07001154const struct ethtool_ops be_ethtool_ops = {
Sathya Perla6b7c5b92009-03-11 23:32:03 -07001155 .get_settings = be_get_settings,
1156 .get_drvinfo = be_get_drvinfo,
Ajit Khaparde71d8d1b2009-12-03 06:16:59 +00001157 .get_wol = be_get_wol,
1158 .set_wol = be_set_wol,
Sathya Perla6b7c5b92009-03-11 23:32:03 -07001159 .get_link = ethtool_op_get_link,
Sarveshwar Bandi368c0ca2010-01-08 00:07:27 -08001160 .get_eeprom_len = be_get_eeprom_len,
1161 .get_eeprom = be_read_eeprom,
Sathya Perla6b7c5b92009-03-11 23:32:03 -07001162 .get_coalesce = be_get_coalesce,
1163 .set_coalesce = be_set_coalesce,
1164 .get_ringparam = be_get_ringparam,
1165 .get_pauseparam = be_get_pauseparam,
1166 .set_pauseparam = be_set_pauseparam,
Sathya Perla6b7c5b92009-03-11 23:32:03 -07001167 .get_strings = be_get_stat_strings,
stephen hemminger1a642462011-04-04 11:06:40 +00001168 .set_phys_id = be_set_phys_id,
Somnath Kotur5c510812013-05-30 02:52:23 +00001169 .set_dump = be_set_dump,
Somnath Kotur941a77d2012-05-17 22:59:03 +00001170 .get_msglevel = be_get_msg_level,
1171 .set_msglevel = be_set_msg_level,
Ben Hutchings15f0a392009-10-01 11:58:24 +00001172 .get_sset_count = be_get_sset_count,
Sathya Perla6b7c5b92009-03-11 23:32:03 -07001173 .get_ethtool_stats = be_get_ethtool_stats,
Somnath Kotur311fddc2011-03-16 21:22:43 +00001174 .get_regs_len = be_get_reg_len,
1175 .get_regs = be_get_regs,
Ajit Khaparde84517482009-09-04 03:12:16 +00001176 .flash_device = be_do_flash,
Suresh Rff33a6e2009-12-03 16:15:52 -08001177 .self_test = be_self_test,
Suresh Reddy594ad542013-04-25 23:03:20 +00001178 .get_rxnfc = be_get_rxnfc,
1179 .set_rxnfc = be_set_rxnfc,
Venkata Duvvurue2557872014-04-21 15:38:00 +05301180 .get_rxfh_indir_size = be_get_rxfh_indir_size,
1181 .get_rxfh_key_size = be_get_rxfh_key_size,
1182 .get_rxfh = be_get_rxfh,
1183 .set_rxfh = be_set_rxfh,
Sathya Perla68d7bdc2013-08-27 16:57:35 +05301184 .get_channels = be_get_channels,
1185 .set_channels = be_set_channels
Sathya Perla6b7c5b92009-03-11 23:32:03 -07001186};