2 * Copyright (C) 2015 Cavium, Inc.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
9 /* ETHTOOL Support for VNIC_VF Device*/
11 #include <linux/pci.h>
15 #include "nicvf_queues.h"
17 #include "thunder_bgx.h"
19 #define DRV_NAME "thunder-nicvf"
20 #define DRV_VERSION "1.0"
23 char name[ETH_GSTRING_LEN];
27 #define NICVF_HW_STAT(stat) { \
29 .index = offsetof(struct nicvf_hw_stats, stat) / sizeof(u64), \
32 #define NICVF_DRV_STAT(stat) { \
34 .index = offsetof(struct nicvf_drv_stats, stat) / sizeof(u64), \
37 static const struct nicvf_stat nicvf_hw_stats[] = {
38 NICVF_HW_STAT(rx_bytes),
39 NICVF_HW_STAT(rx_frames),
40 NICVF_HW_STAT(rx_ucast_frames),
41 NICVF_HW_STAT(rx_bcast_frames),
42 NICVF_HW_STAT(rx_mcast_frames),
43 NICVF_HW_STAT(rx_drops),
44 NICVF_HW_STAT(rx_drop_red),
45 NICVF_HW_STAT(rx_drop_red_bytes),
46 NICVF_HW_STAT(rx_drop_overrun),
47 NICVF_HW_STAT(rx_drop_overrun_bytes),
48 NICVF_HW_STAT(rx_drop_bcast),
49 NICVF_HW_STAT(rx_drop_mcast),
50 NICVF_HW_STAT(rx_drop_l3_bcast),
51 NICVF_HW_STAT(rx_drop_l3_mcast),
52 NICVF_HW_STAT(rx_fcs_errors),
53 NICVF_HW_STAT(rx_l2_errors),
54 NICVF_HW_STAT(tx_bytes),
55 NICVF_HW_STAT(tx_frames),
56 NICVF_HW_STAT(tx_ucast_frames),
57 NICVF_HW_STAT(tx_bcast_frames),
58 NICVF_HW_STAT(tx_mcast_frames),
59 NICVF_HW_STAT(tx_drops),
62 static const struct nicvf_stat nicvf_drv_stats[] = {
63 NICVF_DRV_STAT(rx_bgx_truncated_pkts),
64 NICVF_DRV_STAT(rx_jabber_errs),
65 NICVF_DRV_STAT(rx_fcs_errs),
66 NICVF_DRV_STAT(rx_bgx_errs),
67 NICVF_DRV_STAT(rx_prel2_errs),
68 NICVF_DRV_STAT(rx_l2_hdr_malformed),
69 NICVF_DRV_STAT(rx_oversize),
70 NICVF_DRV_STAT(rx_undersize),
71 NICVF_DRV_STAT(rx_l2_len_mismatch),
72 NICVF_DRV_STAT(rx_l2_pclp),
73 NICVF_DRV_STAT(rx_ip_ver_errs),
74 NICVF_DRV_STAT(rx_ip_csum_errs),
75 NICVF_DRV_STAT(rx_ip_hdr_malformed),
76 NICVF_DRV_STAT(rx_ip_payload_malformed),
77 NICVF_DRV_STAT(rx_ip_ttl_errs),
78 NICVF_DRV_STAT(rx_l3_pclp),
79 NICVF_DRV_STAT(rx_l4_malformed),
80 NICVF_DRV_STAT(rx_l4_csum_errs),
81 NICVF_DRV_STAT(rx_udp_len_errs),
82 NICVF_DRV_STAT(rx_l4_port_errs),
83 NICVF_DRV_STAT(rx_tcp_flag_errs),
84 NICVF_DRV_STAT(rx_tcp_offset_errs),
85 NICVF_DRV_STAT(rx_l4_pclp),
86 NICVF_DRV_STAT(rx_truncated_pkts),
88 NICVF_DRV_STAT(tx_desc_fault),
89 NICVF_DRV_STAT(tx_hdr_cons_err),
90 NICVF_DRV_STAT(tx_subdesc_err),
91 NICVF_DRV_STAT(tx_max_size_exceeded),
92 NICVF_DRV_STAT(tx_imm_size_oflow),
93 NICVF_DRV_STAT(tx_data_seq_err),
94 NICVF_DRV_STAT(tx_mem_seq_err),
95 NICVF_DRV_STAT(tx_lock_viol),
96 NICVF_DRV_STAT(tx_data_fault),
97 NICVF_DRV_STAT(tx_tstmp_conflict),
98 NICVF_DRV_STAT(tx_tstmp_timeout),
99 NICVF_DRV_STAT(tx_mem_fault),
100 NICVF_DRV_STAT(tx_csum_overlap),
101 NICVF_DRV_STAT(tx_csum_overflow),
103 NICVF_DRV_STAT(rcv_buffer_alloc_failures),
104 NICVF_DRV_STAT(tx_tso),
105 NICVF_DRV_STAT(tx_timeout),
106 NICVF_DRV_STAT(txq_stop),
107 NICVF_DRV_STAT(txq_wake),
110 static const struct nicvf_stat nicvf_queue_stats[] = {
115 static const unsigned int nicvf_n_hw_stats = ARRAY_SIZE(nicvf_hw_stats);
116 static const unsigned int nicvf_n_drv_stats = ARRAY_SIZE(nicvf_drv_stats);
117 static const unsigned int nicvf_n_queue_stats = ARRAY_SIZE(nicvf_queue_stats);
119 static int nicvf_get_settings(struct net_device *netdev,
120 struct ethtool_cmd *cmd)
122 struct nicvf *nic = netdev_priv(netdev);
125 cmd->transceiver = XCVR_EXTERNAL;
128 cmd->duplex = DUPLEX_UNKNOWN;
129 ethtool_cmd_speed_set(cmd, SPEED_UNKNOWN);
133 if (nic->speed <= 1000) {
134 cmd->port = PORT_MII;
135 cmd->autoneg = AUTONEG_ENABLE;
137 cmd->port = PORT_FIBRE;
138 cmd->autoneg = AUTONEG_DISABLE;
140 cmd->duplex = nic->duplex;
141 ethtool_cmd_speed_set(cmd, nic->speed);
146 static u32 nicvf_get_link(struct net_device *netdev)
148 struct nicvf *nic = netdev_priv(netdev);
153 static void nicvf_get_drvinfo(struct net_device *netdev,
154 struct ethtool_drvinfo *info)
156 struct nicvf *nic = netdev_priv(netdev);
158 strlcpy(info->driver, DRV_NAME, sizeof(info->driver));
159 strlcpy(info->version, DRV_VERSION, sizeof(info->version));
160 strlcpy(info->bus_info, pci_name(nic->pdev), sizeof(info->bus_info));
163 static u32 nicvf_get_msglevel(struct net_device *netdev)
165 struct nicvf *nic = netdev_priv(netdev);
167 return nic->msg_enable;
170 static void nicvf_set_msglevel(struct net_device *netdev, u32 lvl)
172 struct nicvf *nic = netdev_priv(netdev);
174 nic->msg_enable = lvl;
177 static void nicvf_get_qset_strings(struct nicvf *nic, u8 **data, int qset)
180 int start_qidx = qset * MAX_RCV_QUEUES_PER_QS;
182 for (qidx = 0; qidx < nic->qs->rq_cnt; qidx++) {
183 for (stats = 0; stats < nicvf_n_queue_stats; stats++) {
184 sprintf(*data, "rxq%d: %s", qidx + start_qidx,
185 nicvf_queue_stats[stats].name);
186 *data += ETH_GSTRING_LEN;
190 for (qidx = 0; qidx < nic->qs->sq_cnt; qidx++) {
191 for (stats = 0; stats < nicvf_n_queue_stats; stats++) {
192 sprintf(*data, "txq%d: %s", qidx + start_qidx,
193 nicvf_queue_stats[stats].name);
194 *data += ETH_GSTRING_LEN;
199 static void nicvf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
201 struct nicvf *nic = netdev_priv(netdev);
205 if (sset != ETH_SS_STATS)
208 for (stats = 0; stats < nicvf_n_hw_stats; stats++) {
209 memcpy(data, nicvf_hw_stats[stats].name, ETH_GSTRING_LEN);
210 data += ETH_GSTRING_LEN;
213 for (stats = 0; stats < nicvf_n_drv_stats; stats++) {
214 memcpy(data, nicvf_drv_stats[stats].name, ETH_GSTRING_LEN);
215 data += ETH_GSTRING_LEN;
218 nicvf_get_qset_strings(nic, &data, 0);
220 for (sqs = 0; sqs < nic->sqs_count; sqs++) {
221 if (!nic->snicvf[sqs])
223 nicvf_get_qset_strings(nic->snicvf[sqs], &data, sqs + 1);
226 for (stats = 0; stats < BGX_RX_STATS_COUNT; stats++) {
227 sprintf(data, "bgx_rxstat%d: ", stats);
228 data += ETH_GSTRING_LEN;
231 for (stats = 0; stats < BGX_TX_STATS_COUNT; stats++) {
232 sprintf(data, "bgx_txstat%d: ", stats);
233 data += ETH_GSTRING_LEN;
237 static int nicvf_get_sset_count(struct net_device *netdev, int sset)
239 struct nicvf *nic = netdev_priv(netdev);
243 if (sset != ETH_SS_STATS)
246 qstats_count = nicvf_n_queue_stats *
247 (nic->qs->rq_cnt + nic->qs->sq_cnt);
248 for (sqs = 0; sqs < nic->sqs_count; sqs++) {
251 snic = nic->snicvf[sqs];
254 qstats_count += nicvf_n_queue_stats *
255 (snic->qs->rq_cnt + snic->qs->sq_cnt);
258 return nicvf_n_hw_stats + nicvf_n_drv_stats +
260 BGX_RX_STATS_COUNT + BGX_TX_STATS_COUNT;
263 static void nicvf_get_qset_stats(struct nicvf *nic,
264 struct ethtool_stats *stats, u64 **data)
271 for (qidx = 0; qidx < nic->qs->rq_cnt; qidx++) {
272 nicvf_update_rq_stats(nic, qidx);
273 for (stat = 0; stat < nicvf_n_queue_stats; stat++)
274 *((*data)++) = ((u64 *)&nic->qs->rq[qidx].stats)
275 [nicvf_queue_stats[stat].index];
278 for (qidx = 0; qidx < nic->qs->sq_cnt; qidx++) {
279 nicvf_update_sq_stats(nic, qidx);
280 for (stat = 0; stat < nicvf_n_queue_stats; stat++)
281 *((*data)++) = ((u64 *)&nic->qs->sq[qidx].stats)
282 [nicvf_queue_stats[stat].index];
286 static void nicvf_get_ethtool_stats(struct net_device *netdev,
287 struct ethtool_stats *stats, u64 *data)
289 struct nicvf *nic = netdev_priv(netdev);
293 nicvf_update_stats(nic);
295 /* Update LMAC stats */
296 nicvf_update_lmac_stats(nic);
298 for (stat = 0; stat < nicvf_n_hw_stats; stat++)
299 *(data++) = ((u64 *)&nic->hw_stats)
300 [nicvf_hw_stats[stat].index];
301 for (stat = 0; stat < nicvf_n_drv_stats; stat++) {
303 for_each_possible_cpu(cpu)
304 tmp_stats += ((u64 *)per_cpu_ptr(nic->drv_stats, cpu))
305 [nicvf_drv_stats[stat].index];
306 *(data++) = tmp_stats;
309 nicvf_get_qset_stats(nic, stats, &data);
311 for (sqs = 0; sqs < nic->sqs_count; sqs++) {
312 if (!nic->snicvf[sqs])
314 nicvf_get_qset_stats(nic->snicvf[sqs], stats, &data);
317 for (stat = 0; stat < BGX_RX_STATS_COUNT; stat++)
318 *(data++) = nic->bgx_stats.rx_stats[stat];
319 for (stat = 0; stat < BGX_TX_STATS_COUNT; stat++)
320 *(data++) = nic->bgx_stats.tx_stats[stat];
323 static int nicvf_get_regs_len(struct net_device *dev)
325 return sizeof(u64) * NIC_VF_REG_COUNT;
328 static void nicvf_get_regs(struct net_device *dev,
329 struct ethtool_regs *regs, void *reg)
331 struct nicvf *nic = netdev_priv(dev);
334 int mbox, key, stat, q;
338 memset(p, 0, NIC_VF_REG_COUNT);
340 p[i++] = nicvf_reg_read(nic, NIC_VNIC_CFG);
341 /* Mailbox registers */
342 for (mbox = 0; mbox < NIC_PF_VF_MAILBOX_SIZE; mbox++)
343 p[i++] = nicvf_reg_read(nic,
344 NIC_VF_PF_MAILBOX_0_1 | (mbox << 3));
346 p[i++] = nicvf_reg_read(nic, NIC_VF_INT);
347 p[i++] = nicvf_reg_read(nic, NIC_VF_INT_W1S);
348 p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1C);
349 p[i++] = nicvf_reg_read(nic, NIC_VF_ENA_W1S);
350 p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG);
352 for (key = 0; key < RSS_HASH_KEY_SIZE; key++)
353 p[i++] = nicvf_reg_read(nic, NIC_VNIC_RSS_KEY_0_4 | (key << 3));
355 /* Tx/Rx statistics */
356 for (stat = 0; stat < TX_STATS_ENUM_LAST; stat++)
357 p[i++] = nicvf_reg_read(nic,
358 NIC_VNIC_TX_STAT_0_4 | (stat << 3));
360 for (i = 0; i < RX_STATS_ENUM_LAST; i++)
361 p[i++] = nicvf_reg_read(nic,
362 NIC_VNIC_RX_STAT_0_13 | (stat << 3));
364 p[i++] = nicvf_reg_read(nic, NIC_QSET_RQ_GEN_CFG);
366 /* All completion queue's registers */
367 for (q = 0; q < MAX_CMP_QUEUES_PER_QS; q++) {
368 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG, q);
369 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_CFG2, q);
370 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_THRESH, q);
371 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_BASE, q);
372 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_HEAD, q);
373 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_TAIL, q);
374 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DOOR, q);
375 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS, q);
376 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_STATUS2, q);
377 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_CQ_0_7_DEBUG, q);
380 /* All receive queue's registers */
381 for (q = 0; q < MAX_RCV_QUEUES_PER_QS; q++) {
382 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RQ_0_7_CFG, q);
383 p[i++] = nicvf_queue_reg_read(nic,
384 NIC_QSET_RQ_0_7_STAT_0_1, q);
385 reg_offset = NIC_QSET_RQ_0_7_STAT_0_1 | (1 << 3);
386 p[i++] = nicvf_queue_reg_read(nic, reg_offset, q);
389 for (q = 0; q < MAX_SND_QUEUES_PER_QS; q++) {
390 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_CFG, q);
391 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_THRESH, q);
392 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_BASE, q);
393 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_HEAD, q);
394 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_TAIL, q);
395 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DOOR, q);
396 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STATUS, q);
397 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_DEBUG, q);
398 /* Padding, was NIC_QSET_SQ_0_7_CNM_CHG, which
399 * produces bus errors when read
402 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_SQ_0_7_STAT_0_1, q);
403 reg_offset = NIC_QSET_SQ_0_7_STAT_0_1 | (1 << 3);
404 p[i++] = nicvf_queue_reg_read(nic, reg_offset, q);
407 for (q = 0; q < MAX_RCV_BUF_DESC_RINGS_PER_QS; q++) {
408 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_CFG, q);
409 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_THRESH, q);
410 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_BASE, q);
411 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_HEAD, q);
412 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_TAIL, q);
413 p[i++] = nicvf_queue_reg_read(nic, NIC_QSET_RBDR_0_1_DOOR, q);
414 p[i++] = nicvf_queue_reg_read(nic,
415 NIC_QSET_RBDR_0_1_STATUS0, q);
416 p[i++] = nicvf_queue_reg_read(nic,
417 NIC_QSET_RBDR_0_1_STATUS1, q);
418 reg_offset = NIC_QSET_RBDR_0_1_PREFETCH_STATUS;
419 p[i++] = nicvf_queue_reg_read(nic, reg_offset, q);
423 static int nicvf_get_coalesce(struct net_device *netdev,
424 struct ethtool_coalesce *cmd)
426 struct nicvf *nic = netdev_priv(netdev);
428 cmd->rx_coalesce_usecs = nic->cq_coalesce_usecs;
432 static void nicvf_get_ringparam(struct net_device *netdev,
433 struct ethtool_ringparam *ring)
435 struct nicvf *nic = netdev_priv(netdev);
436 struct queue_set *qs = nic->qs;
438 ring->rx_max_pending = MAX_RCV_BUF_COUNT;
439 ring->rx_pending = qs->rbdr_len;
440 ring->tx_max_pending = MAX_SND_QUEUE_LEN;
441 ring->tx_pending = qs->sq_len;
444 static int nicvf_get_rss_hash_opts(struct nicvf *nic,
445 struct ethtool_rxnfc *info)
449 switch (info->flow_type) {
456 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3;
459 info->data |= RXH_IP_SRC | RXH_IP_DST;
468 static int nicvf_get_rxnfc(struct net_device *dev,
469 struct ethtool_rxnfc *info, u32 *rules)
471 struct nicvf *nic = netdev_priv(dev);
472 int ret = -EOPNOTSUPP;
475 case ETHTOOL_GRXRINGS:
476 info->data = nic->rx_queues;
480 return nicvf_get_rss_hash_opts(nic, info);
487 static int nicvf_set_rss_hash_opts(struct nicvf *nic,
488 struct ethtool_rxnfc *info)
490 struct nicvf_rss_info *rss = &nic->rss_info;
491 u64 rss_cfg = nicvf_reg_read(nic, NIC_VNIC_RSS_CFG);
494 netdev_err(nic->netdev,
495 "RSS is disabled, hash cannot be set\n");
497 netdev_info(nic->netdev, "Set RSS flow type = %d, data = %lld\n",
498 info->flow_type, info->data);
500 if (!(info->data & RXH_IP_SRC) || !(info->data & RXH_IP_DST))
503 switch (info->flow_type) {
506 switch (info->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
508 rss_cfg &= ~(1ULL << RSS_HASH_TCP);
510 case (RXH_L4_B_0_1 | RXH_L4_B_2_3):
511 rss_cfg |= (1ULL << RSS_HASH_TCP);
519 switch (info->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
521 rss_cfg &= ~(1ULL << RSS_HASH_UDP);
523 case (RXH_L4_B_0_1 | RXH_L4_B_2_3):
524 rss_cfg |= (1ULL << RSS_HASH_UDP);
532 switch (info->data & (RXH_L4_B_0_1 | RXH_L4_B_2_3)) {
534 rss_cfg &= ~(1ULL << RSS_HASH_L4ETC);
536 case (RXH_L4_B_0_1 | RXH_L4_B_2_3):
537 rss_cfg |= (1ULL << RSS_HASH_L4ETC);
545 rss_cfg = RSS_HASH_IP;
551 nicvf_reg_write(nic, NIC_VNIC_RSS_CFG, rss_cfg);
555 static int nicvf_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info)
557 struct nicvf *nic = netdev_priv(dev);
561 return nicvf_set_rss_hash_opts(nic, info);
568 static u32 nicvf_get_rxfh_key_size(struct net_device *netdev)
570 return RSS_HASH_KEY_SIZE * sizeof(u64);
573 static u32 nicvf_get_rxfh_indir_size(struct net_device *dev)
575 struct nicvf *nic = netdev_priv(dev);
577 return nic->rss_info.rss_size;
580 static int nicvf_get_rxfh(struct net_device *dev, u32 *indir, u8 *hkey,
583 struct nicvf *nic = netdev_priv(dev);
584 struct nicvf_rss_info *rss = &nic->rss_info;
588 for (idx = 0; idx < rss->rss_size; idx++)
589 indir[idx] = rss->ind_tbl[idx];
593 memcpy(hkey, rss->key, RSS_HASH_KEY_SIZE * sizeof(u64));
596 *hfunc = ETH_RSS_HASH_TOP;
601 static int nicvf_set_rxfh(struct net_device *dev, const u32 *indir,
602 const u8 *hkey, u8 hfunc)
604 struct nicvf *nic = netdev_priv(dev);
605 struct nicvf_rss_info *rss = &nic->rss_info;
608 if (hfunc != ETH_RSS_HASH_NO_CHANGE && hfunc != ETH_RSS_HASH_TOP)
612 netdev_err(nic->netdev,
613 "RSS is disabled, cannot change settings\n");
618 for (idx = 0; idx < rss->rss_size; idx++)
619 rss->ind_tbl[idx] = indir[idx];
623 memcpy(rss->key, hkey, RSS_HASH_KEY_SIZE * sizeof(u64));
624 nicvf_set_rss_key(nic);
627 nicvf_config_rss(nic);
631 /* Get no of queues device supports and current queue count */
632 static void nicvf_get_channels(struct net_device *dev,
633 struct ethtool_channels *channel)
635 struct nicvf *nic = netdev_priv(dev);
637 memset(channel, 0, sizeof(*channel));
639 channel->max_rx = nic->max_queues;
640 channel->max_tx = nic->max_queues;
642 channel->rx_count = nic->rx_queues;
643 channel->tx_count = nic->tx_queues;
646 /* Set no of Tx, Rx queues to be used */
647 static int nicvf_set_channels(struct net_device *dev,
648 struct ethtool_channels *channel)
650 struct nicvf *nic = netdev_priv(dev);
652 bool if_up = netif_running(dev);
655 if (!channel->rx_count || !channel->tx_count)
657 if (channel->rx_count > nic->max_queues)
659 if (channel->tx_count > nic->max_queues)
665 cqcount = max(channel->rx_count, channel->tx_count);
667 if (cqcount > MAX_CMP_QUEUES_PER_QS) {
668 nic->sqs_count = roundup(cqcount, MAX_CMP_QUEUES_PER_QS);
669 nic->sqs_count = (nic->sqs_count / MAX_CMP_QUEUES_PER_QS) - 1;
674 nic->qs->rq_cnt = min_t(u32, channel->rx_count, MAX_RCV_QUEUES_PER_QS);
675 nic->qs->sq_cnt = min_t(u32, channel->tx_count, MAX_SND_QUEUES_PER_QS);
676 nic->qs->cq_cnt = max(nic->qs->rq_cnt, nic->qs->sq_cnt);
678 nic->rx_queues = channel->rx_count;
679 nic->tx_queues = channel->tx_count;
680 err = nicvf_set_real_num_queues(dev, nic->tx_queues, nic->rx_queues);
687 netdev_info(dev, "Setting num Tx rings to %d, Rx rings to %d success\n",
688 nic->tx_queues, nic->rx_queues);
693 static const struct ethtool_ops nicvf_ethtool_ops = {
694 .get_settings = nicvf_get_settings,
695 .get_link = nicvf_get_link,
696 .get_drvinfo = nicvf_get_drvinfo,
697 .get_msglevel = nicvf_get_msglevel,
698 .set_msglevel = nicvf_set_msglevel,
699 .get_strings = nicvf_get_strings,
700 .get_sset_count = nicvf_get_sset_count,
701 .get_ethtool_stats = nicvf_get_ethtool_stats,
702 .get_regs_len = nicvf_get_regs_len,
703 .get_regs = nicvf_get_regs,
704 .get_coalesce = nicvf_get_coalesce,
705 .get_ringparam = nicvf_get_ringparam,
706 .get_rxnfc = nicvf_get_rxnfc,
707 .set_rxnfc = nicvf_set_rxnfc,
708 .get_rxfh_key_size = nicvf_get_rxfh_key_size,
709 .get_rxfh_indir_size = nicvf_get_rxfh_indir_size,
710 .get_rxfh = nicvf_get_rxfh,
711 .set_rxfh = nicvf_set_rxfh,
712 .get_channels = nicvf_get_channels,
713 .set_channels = nicvf_set_channels,
714 .get_ts_info = ethtool_op_get_ts_info,
717 void nicvf_set_ethtool_ops(struct net_device *netdev)
719 netdev->ethtool_ops = &nicvf_ethtool_ops;