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, \
86 for (i = 0; i < enic->rq_count; i++) { in enic_intr_coal_set_rx()
88 vnic_intr_coalescing_timer_set(&enic->intr[intr], timer); in enic_intr_coal_set_rx()
96 struct ethtool_link_settings *base = &ecmd->base; in enic_get_ksettings()
104 base->port = PORT_FIBRE; in enic_get_ksettings()
107 base->speed = vnic_dev_port_speed(enic->vdev); in enic_get_ksettings()
108 base->duplex = DUPLEX_FULL; in enic_get_ksettings()
110 base->speed = SPEED_UNKNOWN; in enic_get_ksettings()
111 base->duplex = DUPLEX_UNKNOWN; in enic_get_ksettings()
114 base->autoneg = AUTONEG_DISABLE; in enic_get_ksettings()
131 if (err == -ENOMEM) in enic_get_drvinfo()
134 strscpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); in enic_get_drvinfo()
135 strscpy(drvinfo->fw_version, fw_info->fw_version, in enic_get_drvinfo()
136 sizeof(drvinfo->fw_version)); in enic_get_drvinfo()
137 strscpy(drvinfo->bus_info, pci_name(enic->pdev), in enic_get_drvinfo()
138 sizeof(drvinfo->bus_info)); in enic_get_drvinfo()
149 memcpy(data, enic_tx_stats[i].name, ETH_GSTRING_LEN); in enic_get_strings()
153 memcpy(data, enic_rx_stats[i].name, ETH_GSTRING_LEN); in enic_get_strings()
157 memcpy(data, enic_gen_stats[i].name, ETH_GSTRING_LEN); in enic_get_strings()
170 struct vnic_enet_config *c = &enic->config; in enic_get_ringparam()
172 ring->rx_max_pending = ENIC_MAX_RQ_DESCS; in enic_get_ringparam()
173 ring->rx_pending = c->rq_desc_count; in enic_get_ringparam()
174 ring->tx_max_pending = ENIC_MAX_WQ_DESCS; in enic_get_ringparam()
175 ring->tx_pending = c->wq_desc_count; in enic_get_ringparam()
184 struct vnic_enet_config *c = &enic->config; in enic_set_ringparam()
190 if (ring->rx_mini_max_pending || ring->rx_mini_pending) { in enic_set_ringparam()
193 return -EINVAL; in enic_set_ringparam()
195 if (ring->rx_jumbo_max_pending || ring->rx_jumbo_pending) { in enic_set_ringparam()
198 return -EINVAL; in enic_set_ringparam()
200 rx_pending = c->rq_desc_count; in enic_set_ringparam()
201 tx_pending = c->wq_desc_count; in enic_set_ringparam()
202 if (ring->rx_pending > ENIC_MAX_RQ_DESCS || in enic_set_ringparam()
203 ring->rx_pending < ENIC_MIN_RQ_DESCS) { in enic_set_ringparam()
205 ring->rx_pending, ENIC_MIN_RQ_DESCS, in enic_set_ringparam()
207 return -EINVAL; in enic_set_ringparam()
209 if (ring->tx_pending > ENIC_MAX_WQ_DESCS || in enic_set_ringparam()
210 ring->tx_pending < ENIC_MIN_WQ_DESCS) { in enic_set_ringparam()
212 ring->tx_pending, ENIC_MIN_WQ_DESCS, in enic_set_ringparam()
214 return -EINVAL; in enic_set_ringparam()
218 c->rq_desc_count = in enic_set_ringparam()
219 ring->rx_pending & 0xffffffe0; /* must be aligned to groups of 32 */ in enic_set_ringparam()
220 c->wq_desc_count = in enic_set_ringparam()
221 ring->tx_pending & 0xffffffe0; /* must be aligned to groups of 32 */ in enic_set_ringparam()
238 c->rq_desc_count = rx_pending; in enic_set_ringparam()
239 c->wq_desc_count = tx_pending; in enic_set_ringparam()
249 return -EOPNOTSUPP; in enic_get_sset_count()
266 if (err == -ENOMEM) in enic_get_ethtool_stats()
270 *(data++) = ((u64 *)&vstats->tx)[enic_tx_stats[i].index]; in enic_get_ethtool_stats()
272 *(data++) = ((u64 *)&vstats->rx)[enic_rx_stats[i].index]; in enic_get_ethtool_stats()
274 *(data++) = ((u64 *)&enic->gen_stats)[enic_gen_stats[i].index]; in enic_get_ethtool_stats()
280 return enic->msg_enable; in enic_get_msglevel()
286 enic->msg_enable = value; in enic_set_msglevel()
295 struct enic_rx_coal *rxcoal = &enic->rx_coalesce_setting; in enic_get_coalesce()
297 if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX) in enic_get_coalesce()
298 ecmd->tx_coalesce_usecs = enic->tx_coalesce_usecs; in enic_get_coalesce()
299 ecmd->rx_coalesce_usecs = enic->rx_coalesce_usecs; in enic_get_coalesce()
300 if (rxcoal->use_adaptive_rx_coalesce) in enic_get_coalesce()
301 ecmd->use_adaptive_rx_coalesce = 1; in enic_get_coalesce()
302 ecmd->rx_coalesce_usecs_low = rxcoal->small_pkt_range_start; in enic_get_coalesce()
303 ecmd->rx_coalesce_usecs_high = rxcoal->range_end; in enic_get_coalesce()
311 u32 coalesce_usecs_max = vnic_dev_get_intr_coal_timer_max(enic->vdev); in enic_coalesce_valid()
313 ec->rx_coalesce_usecs_high); in enic_coalesce_valid()
315 ec->rx_coalesce_usecs_low); in enic_coalesce_valid()
317 if ((vnic_dev_get_intr_mode(enic->vdev) != VNIC_DEV_INTR_MODE_MSIX) && in enic_coalesce_valid()
318 ec->tx_coalesce_usecs) in enic_coalesce_valid()
319 return -EINVAL; in enic_coalesce_valid()
321 if ((ec->tx_coalesce_usecs > coalesce_usecs_max) || in enic_coalesce_valid()
322 (ec->rx_coalesce_usecs > coalesce_usecs_max) || in enic_coalesce_valid()
323 (ec->rx_coalesce_usecs_low > coalesce_usecs_max) || in enic_coalesce_valid()
324 (ec->rx_coalesce_usecs_high > coalesce_usecs_max)) in enic_coalesce_valid()
325 …netdev_info(enic->netdev, "ethtool_set_coalesce: adaptor supports max coalesce value of %d. Settin… in enic_coalesce_valid()
328 if (ec->rx_coalesce_usecs_high && in enic_coalesce_valid()
331 return -EINVAL; in enic_coalesce_valid()
349 struct enic_rx_coal *rxcoal = &enic->rx_coalesce_setting; in enic_set_coalesce()
354 coalesce_usecs_max = vnic_dev_get_intr_coal_timer_max(enic->vdev); in enic_set_coalesce()
355 tx_coalesce_usecs = min_t(u32, ecmd->tx_coalesce_usecs, in enic_set_coalesce()
357 rx_coalesce_usecs = min_t(u32, ecmd->rx_coalesce_usecs, in enic_set_coalesce()
360 rx_coalesce_usecs_low = min_t(u32, ecmd->rx_coalesce_usecs_low, in enic_set_coalesce()
362 rx_coalesce_usecs_high = min_t(u32, ecmd->rx_coalesce_usecs_high, in enic_set_coalesce()
365 if (vnic_dev_get_intr_mode(enic->vdev) == VNIC_DEV_INTR_MODE_MSIX) { in enic_set_coalesce()
366 for (i = 0; i < enic->wq_count; i++) { in enic_set_coalesce()
368 vnic_intr_coalescing_timer_set(&enic->intr[intr], in enic_set_coalesce()
371 enic->tx_coalesce_usecs = tx_coalesce_usecs; in enic_set_coalesce()
373 rxcoal->use_adaptive_rx_coalesce = !!ecmd->use_adaptive_rx_coalesce; in enic_set_coalesce()
374 if (!rxcoal->use_adaptive_rx_coalesce) in enic_set_coalesce()
376 if (ecmd->rx_coalesce_usecs_high) { in enic_set_coalesce()
377 rxcoal->range_end = rx_coalesce_usecs_high; in enic_set_coalesce()
378 rxcoal->small_pkt_range_start = rx_coalesce_usecs_low; in enic_set_coalesce()
379 rxcoal->large_pkt_range_start = rx_coalesce_usecs_low + in enic_set_coalesce()
383 enic->rx_coalesce_usecs = rx_coalesce_usecs; in enic_set_coalesce()
388 static int enic_grxclsrlall(struct enic *enic, struct ethtool_rxnfc *cmd, in enic_grxclsrlall() argument
391 int j, ret = 0, cnt = 0; in enic_grxclsrlall() local
393 cmd->data = enic->rfs_h.max - enic->rfs_h.free; in enic_grxclsrlall()
399 hhead = &enic->rfs_h.ht_head[j]; in enic_grxclsrlall()
401 if (cnt == cmd->rule_cnt) in enic_grxclsrlall()
402 return -EMSGSIZE; in enic_grxclsrlall()
403 rule_locs[cnt] = n->fltr_id; in enic_grxclsrlall()
404 cnt++; in enic_grxclsrlall()
407 cmd->rule_cnt = cnt; in enic_grxclsrlall()
412 static int enic_grxclsrule(struct enic *enic, struct ethtool_rxnfc *cmd) in enic_grxclsrule() argument
415 (struct ethtool_rx_flow_spec *)&cmd->fs; in enic_grxclsrule()
418 n = htbl_fltr_search(enic, (u16)fsp->location); in enic_grxclsrule()
420 return -EINVAL; in enic_grxclsrule()
421 switch (n->keys.basic.ip_proto) { in enic_grxclsrule()
423 fsp->flow_type = TCP_V4_FLOW; in enic_grxclsrule()
426 fsp->flow_type = UDP_V4_FLOW; in enic_grxclsrule()
429 return -EINVAL; in enic_grxclsrule()
432 fsp->h_u.tcp_ip4_spec.ip4src = flow_get_u32_src(&n->keys); in enic_grxclsrule()
433 fsp->m_u.tcp_ip4_spec.ip4src = (__u32)~0; in enic_grxclsrule()
435 fsp->h_u.tcp_ip4_spec.ip4dst = flow_get_u32_dst(&n->keys); in enic_grxclsrule()
436 fsp->m_u.tcp_ip4_spec.ip4dst = (__u32)~0; in enic_grxclsrule()
438 fsp->h_u.tcp_ip4_spec.psrc = n->keys.ports.src; in enic_grxclsrule()
439 fsp->m_u.tcp_ip4_spec.psrc = (__u16)~0; in enic_grxclsrule()
441 fsp->h_u.tcp_ip4_spec.pdst = n->keys.ports.dst; in enic_grxclsrule()
442 fsp->m_u.tcp_ip4_spec.pdst = (__u16)~0; in enic_grxclsrule()
444 fsp->ring_cookie = n->rq_id; in enic_grxclsrule()
449 static int enic_get_rx_flow_hash(struct enic *enic, struct ethtool_rxnfc *cmd) in enic_get_rx_flow_hash() argument
452 cmd->data = 0; in enic_get_rx_flow_hash()
454 spin_lock_bh(&enic->devcmd_lock); in enic_get_rx_flow_hash()
455 (void)vnic_dev_capable_rss_hash_type(enic->vdev, &rss_hash_type); in enic_get_rx_flow_hash()
456 spin_unlock_bh(&enic->devcmd_lock); in enic_get_rx_flow_hash()
457 switch (cmd->flow_type) { in enic_get_rx_flow_hash()
460 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3 | in enic_get_rx_flow_hash()
464 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in enic_get_rx_flow_hash()
466 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in enic_get_rx_flow_hash()
469 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in enic_get_rx_flow_hash()
471 cmd->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in enic_get_rx_flow_hash()
483 cmd->data |= RXH_IP_SRC | RXH_IP_DST; in enic_get_rx_flow_hash()
486 return -EINVAL; in enic_get_rx_flow_hash()
492 static int enic_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd, in enic_get_rxnfc() argument
498 switch (cmd->cmd) { in enic_get_rxnfc()
500 cmd->data = enic->rq_count; in enic_get_rxnfc()
503 spin_lock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
504 cmd->rule_cnt = enic->rfs_h.max - enic->rfs_h.free; in enic_get_rxnfc()
505 cmd->data = enic->rfs_h.max; in enic_get_rxnfc()
506 spin_unlock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
509 spin_lock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
510 ret = enic_grxclsrlall(enic, cmd, rule_locs); in enic_get_rxnfc()
511 spin_unlock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
514 spin_lock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
515 ret = enic_grxclsrule(enic, cmd); in enic_get_rxnfc()
516 spin_unlock_bh(&enic->rfs_h.lock); in enic_get_rxnfc()
519 ret = enic_get_rx_flow_hash(enic, cmd); in enic_get_rxnfc()
522 ret = -EOPNOTSUPP; in enic_get_rxnfc()
535 switch (tuna->id) { in enic_get_tunable()
537 *(u32 *)data = enic->rx_copybreak; in enic_get_tunable()
540 ret = -EINVAL; in enic_get_tunable()
554 switch (tuna->id) { in enic_set_tunable()
556 enic->rx_copybreak = *(u32 *)data; in enic_set_tunable()
559 ret = -EINVAL; in enic_set_tunable()
576 if (rxfh->key) in enic_get_rxfh()
577 memcpy(rxfh->key, enic->rss_key, ENIC_RSS_LEN); in enic_get_rxfh()
579 rxfh->hfunc = ETH_RSS_HASH_TOP; in enic_get_rxfh()
590 if (rxfh->indir || in enic_set_rxfh()
591 (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in enic_set_rxfh()
592 rxfh->hfunc != ETH_RSS_HASH_TOP)) in enic_set_rxfh()
593 return -EINVAL; in enic_set_rxfh()
595 if (rxfh->key) in enic_set_rxfh()
596 memcpy(enic->rss_key, rxfh->key, ENIC_RSS_LEN); in enic_set_rxfh()
604 info->so_timestamping = SOF_TIMESTAMPING_TX_SOFTWARE | in enic_get_ts_info()
639 netdev->ethtool_ops = &enic_ethtool_ops; in enic_set_ethtool_ops()