Lines Matching +full:cmd +full:- +full:cnt +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0-only
16 char name[ETH_GSTRING_LEN]; member
21 .name = #stat, \
26 .name = #stat, \
31 .name = #stat, \
36 .name = "rq[%d]_"#stat, \
41 .name = "wq[%d]_"#stat, \
123 for (i = 0; i < enic->rq_count; i++) { in enic_intr_coal_set_rx()
125 vnic_intr_coalescing_timer_set(&enic->intr[intr], timer); in enic_intr_coal_set_rx()
133 struct ethtool_link_settings *base = &ecmd->base; in enic_get_ksettings()
141 base->port = PORT_FIBRE; in enic_get_ksettings()
144 base->speed = vnic_dev_port_speed(enic->vdev); in enic_get_ksettings()
145 base->duplex = DUPLEX_FULL; in enic_get_ksettings()
147 base->speed = SPEED_UNKNOWN; in enic_get_ksettings()
148 base->duplex = DUPLEX_UNKNOWN; in enic_get_ksettings()
151 base->autoneg = AUTONEG_DISABLE; in enic_get_ksettings()
168 if (err == -ENOMEM) in enic_get_drvinfo()
171 strscpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); in enic_get_drvinfo()
172 strscpy(drvinfo->fw_version, fw_info->fw_version, in enic_get_drvinfo()
173 sizeof(drvinfo->fw_version)); in enic_get_drvinfo()
174 strscpy(drvinfo->bus_info, pci_name(enic->pdev), in enic_get_drvinfo()
175 sizeof(drvinfo->bus_info)); in enic_get_drvinfo()
188 memcpy(data, enic_tx_stats[i].name, ETH_GSTRING_LEN); in enic_get_strings()
192 memcpy(data, enic_rx_stats[i].name, ETH_GSTRING_LEN); in enic_get_strings()
196 memcpy(data, enic_gen_stats[i].name, ETH_GSTRING_LEN); in enic_get_strings()
199 for (i = 0; i < enic->rq_count; i++) { in enic_get_strings()
202 enic_per_rq_stats[j].name, i); in enic_get_strings()
206 for (i = 0; i < enic->wq_count; i++) { in enic_get_strings()
209 enic_per_wq_stats[j].name, i); in enic_get_strings()
223 struct vnic_enet_config *c = &enic->config; in enic_get_ringparam()
225 ring->rx_max_pending = ENIC_MAX_RQ_DESCS; in enic_get_ringparam()
226 ring->rx_pending = c->rq_desc_count; in enic_get_ringparam()
227 ring->tx_max_pending = ENIC_MAX_WQ_DESCS; in enic_get_ringparam()
228 ring->tx_pending = c->wq_desc_count; in enic_get_ringparam()
237 struct vnic_enet_config *c = &enic->config; in enic_set_ringparam()
243 if (ring->rx_mini_max_pending || ring->rx_mini_pending) { in enic_set_ringparam()
246 return -EINVAL; in enic_set_ringparam()
248 if (ring->rx_jumbo_max_pending || ring->rx_jumbo_pending) { in enic_set_ringparam()
251 return -EINVAL; in enic_set_ringparam()
253 rx_pending = c->rq_desc_count; in enic_set_ringparam()
254 tx_pending = c->wq_desc_count; in enic_set_ringparam()
255 if (ring->rx_pending > ENIC_MAX_RQ_DESCS || in enic_set_ringparam()
256 ring->rx_pending < ENIC_MIN_RQ_DESCS) { in enic_set_ringparam()
258 ring->rx_pending, ENIC_MIN_RQ_DESCS, in enic_set_ringparam()
260 return -EINVAL; in enic_set_ringparam()
262 if (ring->tx_pending > ENIC_MAX_WQ_DESCS || in enic_set_ringparam()
263 ring->tx_pending < ENIC_MIN_WQ_DESCS) { in enic_set_ringparam()
265 ring->tx_pending, ENIC_MIN_WQ_DESCS, in enic_set_ringparam()
267 return -EINVAL; in enic_set_ringparam()
271 c->rq_desc_count = in enic_set_ringparam()
272 ring->rx_pending & 0xffffffe0; /* must be aligned to groups of 32 */ in enic_set_ringparam()
273 c->wq_desc_count = in enic_set_ringparam()
274 ring->tx_pending & 0xffffffe0; /* must be aligned to groups of 32 */ in enic_set_ringparam()
291 c->rq_desc_count = rx_pending; in enic_set_ringparam()
292 c->wq_desc_count = tx_pending; in enic_set_ringparam()
305 n_per_rq_stats = NUM_ENIC_PER_RQ_STATS * enic->rq_count; in enic_get_sset_count()
306 n_per_wq_stats = NUM_ENIC_PER_WQ_STATS * enic->wq_count; in enic_get_sset_count()
312 return -EOPNOTSUPP; in enic_get_sset_count()
330 if (err == -ENOMEM) in enic_get_ethtool_stats()
334 *(data++) = ((u64 *)&vstats->tx)[enic_tx_stats[i].index]; in enic_get_ethtool_stats()
336 *(data++) = ((u64 *)&vstats->rx)[enic_rx_stats[i].index]; in enic_get_ethtool_stats()
338 *(data++) = ((u64 *)&enic->gen_stats)[enic_gen_stats[i].index]; in enic_get_ethtool_stats()
339 for (i = 0; i < enic->rq_count; i++) { in enic_get_ethtool_stats()
340 struct enic_rq_stats *rqstats = &enic->rq_stats[i]; in enic_get_ethtool_stats()
348 for (i = 0; i < enic->wq_count; i++) { in enic_get_ethtool_stats()
349 struct enic_wq_stats *wqstats = &enic->wq_stats[i]; in enic_get_ethtool_stats()
362 return enic->msg_enable; in enic_get_msglevel()
368 enic->msg_enable = value; in enic_set_msglevel()
377 struct enic_rx_coal *rxcoal = &enic->rx_coalesce_setting; in enic_get_coalesce()
379 if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX) in enic_get_coalesce()
380 ecmd->tx_coalesce_usecs = enic->tx_coalesce_usecs; in enic_get_coalesce()
381 ecmd->rx_coalesce_usecs = enic->rx_coalesce_usecs; in enic_get_coalesce()
382 if (rxcoal->use_adaptive_rx_coalesce) in enic_get_coalesce()
383 ecmd->use_adaptive_rx_coalesce = 1; in enic_get_coalesce()
384 ecmd->rx_coalesce_usecs_low = rxcoal->small_pkt_range_start; in enic_get_coalesce()
385 ecmd->rx_coalesce_usecs_high = rxcoal->range_end; in enic_get_coalesce()
393 u32 coalesce_usecs_max = vnic_dev_get_intr_coal_timer_max(enic->vdev); in enic_coalesce_valid()
395 ec->rx_coalesce_usecs_high); in enic_coalesce_valid()
397 ec->rx_coalesce_usecs_low); in enic_coalesce_valid()
399 if ((vnic_dev_get_intr_mode(enic->vdev) != VNIC_DEV_INTR_MODE_MSIX) && in enic_coalesce_valid()
400 ec->tx_coalesce_usecs) in enic_coalesce_valid()
401 return -EINVAL; in enic_coalesce_valid()
403 if ((ec->tx_coalesce_usecs > coalesce_usecs_max) || in enic_coalesce_valid()
404 (ec->rx_coalesce_usecs > coalesce_usecs_max) || in enic_coalesce_valid()
405 (ec->rx_coalesce_usecs_low > coalesce_usecs_max) || in enic_coalesce_valid()
406 (ec->rx_coalesce_usecs_high > coalesce_usecs_max)) in enic_coalesce_valid()
407 …netdev_info(enic->netdev, "ethtool_set_coalesce: adaptor supports max coalesce value of %d. Settin… in enic_coalesce_valid()
410 if (ec->rx_coalesce_usecs_high && in enic_coalesce_valid()
413 return -EINVAL; in enic_coalesce_valid()
431 struct enic_rx_coal *rxcoal = &enic->rx_coalesce_setting; in enic_set_coalesce()
436 coalesce_usecs_max = vnic_dev_get_intr_coal_timer_max(enic->vdev); in enic_set_coalesce()
437 tx_coalesce_usecs = min_t(u32, ecmd->tx_coalesce_usecs, in enic_set_coalesce()
439 rx_coalesce_usecs = min_t(u32, ecmd->rx_coalesce_usecs, in enic_set_coalesce()
442 rx_coalesce_usecs_low = min_t(u32, ecmd->rx_coalesce_usecs_low, in enic_set_coalesce()
444 rx_coalesce_usecs_high = min_t(u32, ecmd->rx_coalesce_usecs_high, in enic_set_coalesce()
447 if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX) { in enic_set_coalesce()
448 for (i = 0; i < enic->wq_count; i++) { in enic_set_coalesce()
450 vnic_intr_coalescing_timer_set(&enic->intr[intr], in enic_set_coalesce()
453 enic->tx_coalesce_usecs = tx_coalesce_usecs; in enic_set_coalesce()
455 rxcoal->use_adaptive_rx_coalesce = !!ecmd->use_adaptive_rx_coalesce; in enic_set_coalesce()
456 if (!rxcoal->use_adaptive_rx_coalesce) in enic_set_coalesce()
458 if (ecmd->rx_coalesce_usecs_high) { in enic_set_coalesce()
459 rxcoal->range_end = rx_coalesce_usecs_high; in enic_set_coalesce()
460 rxcoal->small_pkt_range_start = rx_coalesce_usecs_low; in enic_set_coalesce()
461 rxcoal->large_pkt_range_start = rx_coalesce_usecs_low + in enic_set_coalesce()
465 enic->rx_coalesce_usecs = rx_coalesce_usecs; in enic_set_coalesce()
470 static int enic_grxclsrlall(struct enic *enic, struct ethtool_rxnfc *cmd, in enic_grxclsrlall() argument
473 int j, ret = 0, cnt = 0; in enic_grxclsrlall() local
475 cmd->data = enic->rfs_h.max - enic->rfs_h.free; in enic_grxclsrlall()
481 hhead = &enic->rfs_h.ht_head[j]; in enic_grxclsrlall()
483 if (cnt == cmd->rule_cnt) in enic_grxclsrlall()
484 return -EMSGSIZE; in enic_grxclsrlall()
485 rule_locs[cnt] = n->fltr_id; in enic_grxclsrlall()
486 cnt++; in enic_grxclsrlall()
489 cmd->rule_cnt = cnt; in enic_grxclsrlall()
494 static int enic_grxclsrule(struct enic *enic, struct ethtool_rxnfc *cmd) in enic_grxclsrule() argument
497 (struct ethtool_rx_flow_spec *)&cmd->fs; in enic_grxclsrule()
500 n = htbl_fltr_search(enic, (u16)fsp->location); in enic_grxclsrule()
502 return -EINVAL; in enic_grxclsrule()
503 switch (n->keys.basic.ip_proto) { in enic_grxclsrule()
505 fsp->flow_type = TCP_V4_FLOW; in enic_grxclsrule()
508 fsp->flow_type = UDP_V4_FLOW; in enic_grxclsrule()
511 return -EINVAL; in enic_grxclsrule()
514 fsp->h_u.tcp_ip4_spec.ip4src = flow_get_u32_src(&n->keys); in enic_grxclsrule()
515 fsp->m_u.tcp_ip4_spec.ip4src = (__u32)~0; in enic_grxclsrule()
517 fsp->h_u.tcp_ip4_spec.ip4dst = flow_get_u32_dst(&n->keys); in enic_grxclsrule()
518 fsp->m_u.tcp_ip4_spec.ip4dst = (__u32)~0; in enic_grxclsrule()
520 fsp->h_u.tcp_ip4_spec.psrc = n->keys.ports.src; in enic_grxclsrule()
521 fsp->m_u.tcp_ip4_spec.psrc = (__u16)~0; in enic_grxclsrule()
523 fsp->h_u.tcp_ip4_spec.pdst = n->keys.ports.dst; in enic_grxclsrule()
524 fsp->m_u.tcp_ip4_spec.pdst = (__u16)~0; in enic_grxclsrule()
526 fsp->ring_cookie = n->rq_id; in enic_grxclsrule()
531 static int enic_get_rx_flow_hash(struct enic *enic, struct ethtool_rxnfc *cmd) in enic_get_rx_flow_hash() argument
534 cmd->data = 0; in enic_get_rx_flow_hash()
536 spin_lock_bh(&enic->devcmd_lock); in enic_get_rx_flow_hash()
537 (void)vnic_dev_capable_rss_hash_type(enic->vdev, &rss_hash_type); in enic_get_rx_flow_hash()
538 spin_unlock_bh(&enic->devcmd_lock); in enic_get_rx_flow_hash()
539 switch (cmd->flow_type) { in enic_get_rx_flow_hash()
542 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3 | in enic_get_rx_flow_hash()
546 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in enic_get_rx_flow_hash()
548 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in enic_get_rx_flow_hash()
551 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in enic_get_rx_flow_hash()
553 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in enic_get_rx_flow_hash()
565 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in enic_get_rx_flow_hash()
568 return -EINVAL; in enic_get_rx_flow_hash()
574 static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, in enic_get_rxnfc() argument
580 switch (cmd->cmd) { in enic_get_rxnfc()
582 cmd->data = enic->rq_count; in enic_get_rxnfc()
585 spin_lock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
586 cmd->rule_cnt = enic->rfs_h.max - enic->rfs_h.free; in enic_get_rxnfc()
587 cmd->data = enic->rfs_h.max; in enic_get_rxnfc()
588 spin_unlock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
591 spin_lock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
592 ret = enic_grxclsrlall(enic, cmd, rule_locs); in enic_get_rxnfc()
593 spin_unlock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
596 spin_lock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
597 ret = enic_grxclsrule(enic, cmd); in enic_get_rxnfc()
598 spin_unlock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
601 ret = enic_get_rx_flow_hash(enic, cmd); in enic_get_rxnfc()
604 ret = -EOPNOTSUPP; in enic_get_rxnfc()
617 switch (tuna->id) { in enic_get_tunable()
619 *(u32 *)data = enic->rx_copybreak; in enic_get_tunable()
622 ret = -EINVAL; in enic_get_tunable()
636 switch (tuna->id) { in enic_set_tunable()
638 enic->rx_copybreak = *(u32 *)data; in enic_set_tunable()
641 ret = -EINVAL; in enic_set_tunable()
658 if (rxfh->key) in enic_get_rxfh()
659 memcpy(rxfh->key, enic->rss_key, ENIC_RSS_LEN); in enic_get_rxfh()
661 rxfh->hfunc = ETH_RSS_HASH_TOP; in enic_get_rxfh()
672 if (rxfh->indir || in enic_set_rxfh()
673 (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in enic_set_rxfh()
674 rxfh->hfunc != ETH_RSS_HASH_TOP)) in enic_set_rxfh()
675 return -EINVAL; in enic_set_rxfh()
677 if (rxfh->key) in enic_set_rxfh()
678 memcpy(enic->rss_key, rxfh->key, ENIC_RSS_LEN); in enic_set_rxfh()
686 info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE; in enic_get_ts_info()
696 switch (vnic_dev_get_intr_mode(enic->vdev)) { in enic_get_channels()
698 channels->max_rx = ENIC_RQ_MAX; in enic_get_channels()
699 channels->max_tx = ENIC_WQ_MAX; in enic_get_channels()
700 channels->rx_count = enic->rq_count; in enic_get_channels()
701 channels->tx_count = enic->wq_count; in enic_get_channels()
705 channels->max_combined = 1; in enic_get_channels()
706 channels->combined_count = 1; in enic_get_channels()
742 netdev->ethtool_ops = &enic_ethtool_ops; in enic_set_ethtool_ops()