Lines Matching +full:num +full:- +full:rxq

1 // SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
3 * Copyright (c) 2015-2017 QLogic Corporation
4 * Copyright (c) 2019-2020 Marvell International Ltd.
176 "Coupled-Function",
276 if (txq->is_xdp) in qede_get_strings_stats_txq()
281 sprintf(*buf, "%d_%d: %s", txq->index, txq->cos, in qede_get_strings_stats_txq()
288 struct qede_rx_queue *rxq, u8 **buf) in qede_get_strings_stats_rxq() argument
293 sprintf(*buf, "%d: %s", rxq->rxq_id, in qede_get_strings_stats_rxq()
313 fp = &edev->fp_array[i]; in qede_get_strings_stats()
315 if (fp->type & QEDE_FASTPATH_RX) in qede_get_strings_stats()
316 qede_get_strings_stats_rxq(edev, fp->rxq, &buf); in qede_get_strings_stats()
318 if (fp->type & QEDE_FASTPATH_XDP) in qede_get_strings_stats()
319 qede_get_strings_stats_txq(edev, fp->xdp_tx, &buf); in qede_get_strings_stats()
321 if (fp->type & QEDE_FASTPATH_TX) { in qede_get_strings_stats()
326 &fp->txq[cos], &buf); in qede_get_strings_stats()
330 /* Account for non-queue statistics */ in qede_get_strings_stats()
371 static void qede_get_ethtool_stats_rxq(struct qede_rx_queue *rxq, u64 **buf) in qede_get_ethtool_stats_rxq() argument
376 **buf = *((u64 *)(((void *)rxq) + qede_rqstats_arr[i].offset)); in qede_get_ethtool_stats_rxq()
394 fp = &edev->fp_array[i]; in qede_get_ethtool_stats()
396 if (fp->type & QEDE_FASTPATH_RX) in qede_get_ethtool_stats()
397 qede_get_ethtool_stats_rxq(fp->rxq, &buf); in qede_get_ethtool_stats()
399 if (fp->type & QEDE_FASTPATH_XDP) in qede_get_ethtool_stats()
400 qede_get_ethtool_stats_txq(fp->xdp_tx, &buf); in qede_get_ethtool_stats()
402 if (fp->type & QEDE_FASTPATH_TX) { in qede_get_ethtool_stats()
406 qede_get_ethtool_stats_txq(&fp->txq[cos], &buf); in qede_get_ethtool_stats()
410 spin_lock(&edev->stats_lock); in qede_get_ethtool_stats()
415 *buf = *((u64 *)(((void *)&edev->stats) + in qede_get_ethtool_stats()
421 spin_unlock(&edev->stats_lock); in qede_get_ethtool_stats()
435 num_stats--; in qede_get_sset_count()
439 edev->dev_info.num_tc; in qede_get_sset_count()
445 if (edev->xdp_prog) in qede_get_sset_count()
459 return -EINVAL; in qede_get_sset_count()
469 if (edev->dev_info.common.num_hwfns > 1) in qede_get_priv_flags()
472 if (edev->dev_info.common.smart_an) in qede_get_priv_flags()
475 if (edev->err_flags & BIT(QEDE_ERR_IS_RECOVERABLE)) in qede_get_priv_flags()
478 if (edev->dev_info.common.esl) in qede_get_priv_flags()
481 edev->ops->common->get_esl_status(edev->cdev, &esl_active); in qede_get_priv_flags()
497 return -EINVAL; in qede_set_priv_flags()
500 set_bit(QEDE_ERR_IS_RECOVERABLE, &edev->err_flags); in qede_set_priv_flags()
502 clear_bit(QEDE_ERR_IS_RECOVERABLE, &edev->err_flags); in qede_set_priv_flags()
510 typeof(cmd->link_modes) *link_modes = &cmd->link_modes; in qede_get_link_ksettings()
511 struct ethtool_link_settings *base = &cmd->base; in qede_get_link_ksettings()
518 edev->ops->common->get_link(edev->cdev, &current_link); in qede_get_link_ksettings()
520 linkmode_copy(link_modes->supported, current_link.supported_caps); in qede_get_link_ksettings()
521 linkmode_copy(link_modes->advertising, current_link.advertised_caps); in qede_get_link_ksettings()
522 linkmode_copy(link_modes->lp_advertising, current_link.lp_caps); in qede_get_link_ksettings()
524 if ((edev->state == QEDE_STATE_OPEN) && (current_link.link_up)) { in qede_get_link_ksettings()
525 base->speed = current_link.speed; in qede_get_link_ksettings()
526 base->duplex = current_link.duplex; in qede_get_link_ksettings()
528 base->speed = SPEED_UNKNOWN; in qede_get_link_ksettings()
529 base->duplex = DUPLEX_UNKNOWN; in qede_get_link_ksettings()
534 base->port = current_link.port; in qede_get_link_ksettings()
535 base->autoneg = (current_link.autoneg) ? AUTONEG_ENABLE : in qede_get_link_ksettings()
544 const struct ethtool_link_settings *base = &cmd->base; in qede_set_link_ksettings()
551 if (!edev->ops || !edev->ops->common->can_link_change(edev->cdev)) { in qede_set_link_ksettings()
553 return -EOPNOTSUPP; in qede_set_link_ksettings()
557 edev->ops->common->get_link(edev->cdev, &current_link); in qede_set_link_ksettings()
562 if (base->autoneg == AUTONEG_ENABLE) { in qede_set_link_ksettings()
565 return -EOPNOTSUPP; in qede_set_link_ksettings()
571 linkmode_copy(params.adv_speeds, cmd->link_modes.advertising); in qede_set_link_ksettings()
575 params.forced_speed = base->speed; in qede_set_link_ksettings()
580 if (base->speed != map->speed || in qede_set_link_ksettings()
582 map->caps)) in qede_set_link_ksettings()
586 current_link.supported_caps, map->caps); in qede_set_link_ksettings()
590 DP_INFO(edev, "Unsupported speed %u\n", base->speed); in qede_set_link_ksettings()
591 return -EINVAL; in qede_set_link_ksettings()
596 edev->ops->common->set_link(edev->cdev, &params); in qede_set_link_ksettings()
608 strscpy(info->driver, "qede", sizeof(info->driver)); in qede_get_drvinfo()
611 edev->dev_info.common.fw_major, in qede_get_drvinfo()
612 edev->dev_info.common.fw_minor, in qede_get_drvinfo()
613 edev->dev_info.common.fw_rev, in qede_get_drvinfo()
614 edev->dev_info.common.fw_eng); in qede_get_drvinfo()
617 (edev->dev_info.common.mfw_rev >> 24) & 0xFF, in qede_get_drvinfo()
618 (edev->dev_info.common.mfw_rev >> 16) & 0xFF, in qede_get_drvinfo()
619 (edev->dev_info.common.mfw_rev >> 8) & 0xFF, in qede_get_drvinfo()
620 edev->dev_info.common.mfw_rev & 0xFF); in qede_get_drvinfo()
623 sizeof(info->version)) in qede_get_drvinfo()
624 snprintf(info->version, sizeof(info->version), in qede_get_drvinfo()
627 snprintf(info->version, sizeof(info->version), in qede_get_drvinfo()
630 if (edev->dev_info.common.mbi_version) { in qede_get_drvinfo()
632 (edev->dev_info.common.mbi_version & in qede_get_drvinfo()
634 (edev->dev_info.common.mbi_version & in qede_get_drvinfo()
636 (edev->dev_info.common.mbi_version & in qede_get_drvinfo()
638 snprintf(info->fw_version, sizeof(info->fw_version), in qede_get_drvinfo()
641 snprintf(info->fw_version, sizeof(info->fw_version), in qede_get_drvinfo()
645 strscpy(info->bus_info, pci_name(edev->pdev), sizeof(info->bus_info)); in qede_get_drvinfo()
652 if (edev->dev_info.common.wol_support) { in qede_get_wol()
653 wol->supported = WAKE_MAGIC; in qede_get_wol()
654 wol->wolopts = edev->wol_enabled ? WAKE_MAGIC : 0; in qede_get_wol()
664 if (wol->wolopts & ~WAKE_MAGIC) { in qede_set_wol()
666 "Can't support WoL options other than magic-packet\n"); in qede_set_wol()
667 return -EINVAL; in qede_set_wol()
670 wol_requested = !!(wol->wolopts & WAKE_MAGIC); in qede_set_wol()
671 if (wol_requested == edev->wol_enabled) in qede_set_wol()
675 if (!edev->dev_info.common.wol_support) { in qede_set_wol()
677 return -EINVAL; in qede_set_wol()
680 rc = edev->ops->common->update_wol(edev->cdev, wol_requested); in qede_set_wol()
682 edev->wol_enabled = wol_requested; in qede_set_wol()
691 return ((u32)edev->dp_level << QED_LOG_LEVEL_SHIFT) | edev->dp_module; in qede_get_msglevel()
702 edev->dp_level = dp_level; in qede_set_msglevel()
703 edev->dp_module = dp_module; in qede_set_msglevel()
704 edev->ops->common->update_msglvl(edev->cdev, in qede_set_msglevel()
714 if (!edev->ops || !edev->ops->common->can_link_change(edev->cdev)) { in qede_nway_reset()
716 return -EOPNOTSUPP; in qede_nway_reset()
723 edev->ops->common->get_link(edev->cdev, &current_link); in qede_nway_reset()
730 edev->ops->common->set_link(edev->cdev, &link_params); in qede_nway_reset()
732 edev->ops->common->set_link(edev->cdev, &link_params); in qede_nway_reset()
743 edev->ops->common->get_link(edev->cdev, &current_link); in qede_get_link()
753 return edev->ops->common->nvm_flash(edev->cdev, flash->data); in qede_flash_device()
772 if (edev->state == QEDE_STATE_OPEN) { in qede_get_coalesce()
774 fp = &edev->fp_array[i]; in qede_get_coalesce()
776 if (fp->type & QEDE_FASTPATH_RX) { in qede_get_coalesce()
777 rx_handle = fp->rxq->handle; in qede_get_coalesce()
782 rc = edev->ops->get_coalesce(edev->cdev, &rx_coal, rx_handle); in qede_get_coalesce()
791 fp = &edev->fp_array[i]; in qede_get_coalesce()
797 if (fp->type & QEDE_FASTPATH_TX) { in qede_get_coalesce()
799 tx_handle = txq->handle; in qede_get_coalesce()
804 rc = edev->ops->get_coalesce(edev->cdev, &tx_coal, tx_handle); in qede_get_coalesce()
812 coal->rx_coalesce_usecs = rx_coal; in qede_get_coalesce()
813 coal->tx_coalesce_usecs = tx_coal; in qede_get_coalesce()
814 coal->stats_block_coalesce_usecs = edev->stats_coal_usecs; in qede_get_coalesce()
828 if (edev->stats_coal_usecs != coal->stats_block_coalesce_usecs) { in qede_set_coalesce()
829 edev->stats_coal_usecs = coal->stats_block_coalesce_usecs; in qede_set_coalesce()
830 if (edev->stats_coal_usecs) { in qede_set_coalesce()
831 edev->stats_coal_ticks = usecs_to_jiffies(edev->stats_coal_usecs); in qede_set_coalesce()
832 schedule_delayed_work(&edev->periodic_task, 0); in qede_set_coalesce()
835 edev->stats_coal_ticks); in qede_set_coalesce()
837 cancel_delayed_work_sync(&edev->periodic_task); in qede_set_coalesce()
843 return -EINVAL; in qede_set_coalesce()
846 if (coal->rx_coalesce_usecs > QED_COALESCE_MAX || in qede_set_coalesce()
847 coal->tx_coalesce_usecs > QED_COALESCE_MAX) { in qede_set_coalesce()
850 coal->rx_coalesce_usecs > QED_COALESCE_MAX ? "rx" : in qede_set_coalesce()
852 return -EINVAL; in qede_set_coalesce()
855 rxc = (u16)coal->rx_coalesce_usecs; in qede_set_coalesce()
856 txc = (u16)coal->tx_coalesce_usecs; in qede_set_coalesce()
858 fp = &edev->fp_array[i]; in qede_set_coalesce()
860 if (edev->fp_array[i].type & QEDE_FASTPATH_RX) { in qede_set_coalesce()
861 rc = edev->ops->common->set_coalesce(edev->cdev, in qede_set_coalesce()
863 fp->rxq->handle); in qede_set_coalesce()
869 edev->coal_entry[i].rxc = rxc; in qede_set_coalesce()
870 edev->coal_entry[i].isvalid = true; in qede_set_coalesce()
873 if (edev->fp_array[i].type & QEDE_FASTPATH_TX) { in qede_set_coalesce()
882 rc = edev->ops->common->set_coalesce(edev->cdev, in qede_set_coalesce()
884 txq->handle); in qede_set_coalesce()
890 edev->coal_entry[i].txc = txc; in qede_set_coalesce()
891 edev->coal_entry[i].isvalid = true; in qede_set_coalesce()
905 ering->rx_max_pending = NUM_RX_BDS_MAX; in qede_get_ringparam()
906 ering->rx_pending = edev->q_num_rx_buffers; in qede_get_ringparam()
907 ering->tx_max_pending = NUM_TX_BDS_MAX; in qede_get_ringparam()
908 ering->tx_pending = edev->q_num_tx_buffers; in qede_get_ringparam()
920 ering->rx_pending, ering->tx_pending); in qede_set_ringparam()
923 if (ering->rx_pending > NUM_RX_BDS_MAX || in qede_set_ringparam()
924 ering->rx_pending < NUM_RX_BDS_MIN || in qede_set_ringparam()
925 ering->tx_pending > NUM_TX_BDS_MAX || in qede_set_ringparam()
926 ering->tx_pending < NUM_TX_BDS_MIN) { in qede_set_ringparam()
931 return -EINVAL; in qede_set_ringparam()
934 /* Change ring size and re-load */ in qede_set_ringparam()
935 edev->q_num_rx_buffers = ering->rx_pending; in qede_set_ringparam()
936 edev->q_num_tx_buffers = ering->tx_pending; in qede_set_ringparam()
950 edev->ops->common->get_link(edev->cdev, &current_link); in qede_get_pauseparam()
953 epause->autoneg = true; in qede_get_pauseparam()
955 epause->rx_pause = true; in qede_get_pauseparam()
957 epause->tx_pause = true; in qede_get_pauseparam()
961 epause->cmd, epause->autoneg, epause->rx_pause, in qede_get_pauseparam()
962 epause->tx_pause); in qede_get_pauseparam()
972 if (!edev->ops || !edev->ops->common->can_link_change(edev->cdev)) { in qede_set_pauseparam()
975 return -EOPNOTSUPP; in qede_set_pauseparam()
979 edev->ops->common->get_link(edev->cdev, &current_link); in qede_set_pauseparam()
984 if (epause->autoneg) { in qede_set_pauseparam()
987 return -EINVAL; in qede_set_pauseparam()
993 if (epause->rx_pause) in qede_set_pauseparam()
995 if (epause->tx_pause) in qede_set_pauseparam()
999 edev->ops->common->set_link(edev->cdev, &params); in qede_set_pauseparam()
1009 regs->version = 0; in qede_get_regs()
1010 memset(buffer, 0, regs->len); in qede_get_regs()
1012 if (edev->ops && edev->ops->common) in qede_get_regs()
1013 edev->ops->common->dbg_all_data(edev->cdev, buffer); in qede_get_regs()
1020 if (edev->ops && edev->ops->common) in qede_get_regs_len()
1021 return edev->ops->common->dbg_all_data_size(edev->cdev); in qede_get_regs_len()
1023 return -EINVAL; in qede_get_regs_len()
1029 WRITE_ONCE(edev->ndev->mtu, args->u.mtu); in qede_update_mtu()
1042 ndev->features &= ~NETIF_F_GRO_HW; in qede_change_mtu()
1044 /* Set the mtu field and re-start the interface if needed */ in qede_change_mtu()
1051 edev->ops->common->update_mtu(edev->cdev, new_mtu); in qede_change_mtu()
1061 channels->max_combined = QEDE_MAX_RSS_CNT(edev); in qede_get_channels()
1062 channels->max_rx = QEDE_MAX_RSS_CNT(edev); in qede_get_channels()
1063 channels->max_tx = QEDE_MAX_RSS_CNT(edev); in qede_get_channels()
1064 channels->combined_count = QEDE_QUEUE_CNT(edev) - edev->fp_num_tx - in qede_get_channels()
1065 edev->fp_num_rx; in qede_get_channels()
1066 channels->tx_count = edev->fp_num_tx; in qede_get_channels()
1067 channels->rx_count = edev->fp_num_rx; in qede_get_channels()
1077 "set-channels command parameters: rx = %d, tx = %d, other = %d, combined = %d\n", in qede_set_channels()
1078 channels->rx_count, channels->tx_count, in qede_set_channels()
1079 channels->other_count, channels->combined_count); in qede_set_channels()
1081 count = channels->rx_count + channels->tx_count + in qede_set_channels()
1082 channels->combined_count; in qede_set_channels()
1085 if (channels->other_count) { in qede_set_channels()
1088 return -EINVAL; in qede_set_channels()
1091 if (!(channels->combined_count || (channels->rx_count && in qede_set_channels()
1092 channels->tx_count))) { in qede_set_channels()
1095 return -EINVAL; in qede_set_channels()
1102 return -EINVAL; in qede_set_channels()
1107 (channels->tx_count == edev->fp_num_tx) && in qede_set_channels()
1108 (channels->rx_count == edev->fp_num_rx)) { in qede_set_channels()
1115 if ((count % edev->dev_info.common.num_hwfns) || in qede_set_channels()
1116 (channels->tx_count % edev->dev_info.common.num_hwfns) || in qede_set_channels()
1117 (channels->rx_count % edev->dev_info.common.num_hwfns)) { in qede_set_channels()
1120 edev->dev_info.common.num_hwfns); in qede_set_channels()
1121 return -EINVAL; in qede_set_channels()
1125 edev->req_queues = count; in qede_set_channels()
1126 edev->req_num_tx = channels->tx_count; in qede_set_channels()
1127 edev->req_num_rx = channels->rx_count; in qede_set_channels()
1129 if ((edev->req_queues - edev->req_num_tx) != QEDE_RSS_COUNT(edev)) { in qede_set_channels()
1130 edev->rss_params_inited &= ~QEDE_RSS_INDIR_INITED; in qede_set_channels()
1131 memset(edev->rss_ind_table, 0, sizeof(edev->rss_ind_table)); in qede_set_channels()
1170 edev->ops->common->set_led(edev->cdev, led_state); in qede_set_phys_id()
1177 info->data = RXH_IP_SRC | RXH_IP_DST; in qede_get_rss_flags()
1179 switch (info->flow_type) { in qede_get_rss_flags()
1182 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in qede_get_rss_flags()
1185 if (edev->rss_caps & QED_RSS_IPV4_UDP) in qede_get_rss_flags()
1186 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in qede_get_rss_flags()
1189 if (edev->rss_caps & QED_RSS_IPV6_UDP) in qede_get_rss_flags()
1190 info->data |= RXH_L4_B_0_1 | RXH_L4_B_2_3; in qede_get_rss_flags()
1196 info->data = 0; in qede_get_rss_flags()
1209 switch (info->cmd) { in qede_get_rxnfc()
1211 info->data = QEDE_RSS_COUNT(edev); in qede_get_rxnfc()
1217 info->rule_cnt = qede_get_arfs_filter_count(edev); in qede_get_rxnfc()
1218 info->data = QEDE_RFS_MAX_FLTR; in qede_get_rxnfc()
1228 rc = -EOPNOTSUPP; in qede_get_rxnfc()
1242 info->flow_type, info->data); in qede_set_rss_flags()
1244 switch (info->flow_type) { in qede_set_rss_flags()
1247 /* For TCP only 4-tuple hash is supported */ in qede_set_rss_flags()
1248 if (info->data ^ (RXH_IP_SRC | RXH_IP_DST | in qede_set_rss_flags()
1251 return -EINVAL; in qede_set_rss_flags()
1255 /* For UDP either 2-tuple hash or 4-tuple hash is supported */ in qede_set_rss_flags()
1256 if (info->data == (RXH_IP_SRC | RXH_IP_DST | in qede_set_rss_flags()
1260 "UDP 4-tuple enabled\n"); in qede_set_rss_flags()
1261 } else if (info->data == (RXH_IP_SRC | RXH_IP_DST)) { in qede_set_rss_flags()
1264 "UDP 4-tuple disabled\n"); in qede_set_rss_flags()
1266 return -EINVAL; in qede_set_rss_flags()
1270 /* For UDP either 2-tuple hash or 4-tuple hash is supported */ in qede_set_rss_flags()
1271 if (info->data == (RXH_IP_SRC | RXH_IP_DST | in qede_set_rss_flags()
1275 "UDP 4-tuple enabled\n"); in qede_set_rss_flags()
1276 } else if (info->data == (RXH_IP_SRC | RXH_IP_DST)) { in qede_set_rss_flags()
1279 "UDP 4-tuple disabled\n"); in qede_set_rss_flags()
1281 return -EINVAL; in qede_set_rss_flags()
1286 /* For IP only 2-tuple hash is supported */ in qede_set_rss_flags()
1287 if (info->data ^ (RXH_IP_SRC | RXH_IP_DST)) { in qede_set_rss_flags()
1289 return -EINVAL; in qede_set_rss_flags()
1303 if (info->data) { in qede_set_rss_flags()
1305 return -EINVAL; in qede_set_rss_flags()
1309 return -EINVAL; in qede_set_rss_flags()
1313 if (edev->rss_caps == ((edev->rss_caps & ~clr_caps) | set_caps)) in qede_set_rss_flags()
1317 edev->rss_caps = ((edev->rss_caps & ~clr_caps) | set_caps); in qede_set_rss_flags()
1318 edev->rss_params_inited |= QEDE_RSS_CAPS_INITED; in qede_set_rss_flags()
1320 /* Re-configure if possible */ in qede_set_rss_flags()
1322 if (edev->state == QEDE_STATE_OPEN) { in qede_set_rss_flags()
1326 return -ENOMEM; in qede_set_rss_flags()
1328 qede_fill_rss_params(edev, &vport_update_params->rss_params, in qede_set_rss_flags()
1329 &vport_update_params->update_rss_flg); in qede_set_rss_flags()
1330 rc = edev->ops->vport_update(edev->cdev, vport_update_params); in qede_set_rss_flags()
1343 switch (info->cmd) { in qede_set_rxnfc()
1351 rc = qede_delete_flow_filter(edev, info->fs.location); in qede_set_rxnfc()
1355 rc = -EOPNOTSUPP; in qede_set_rxnfc()
1370 return sizeof(edev->rss_key); in qede_get_rxfh_key_size()
1379 rxfh->hfunc = ETH_RSS_HASH_TOP; in qede_get_rxfh()
1381 if (!rxfh->indir) in qede_get_rxfh()
1385 rxfh->indir[i] = edev->rss_ind_table[i]; in qede_get_rxfh()
1387 if (rxfh->key) in qede_get_rxfh()
1388 memcpy(rxfh->key, edev->rss_key, qede_get_rxfh_key_size(dev)); in qede_get_rxfh()
1401 if (edev->dev_info.common.num_hwfns > 1) { in qede_set_rxfh()
1404 return -EOPNOTSUPP; in qede_set_rxfh()
1407 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in qede_set_rxfh()
1408 rxfh->hfunc != ETH_RSS_HASH_TOP) in qede_set_rxfh()
1409 return -EOPNOTSUPP; in qede_set_rxfh()
1411 if (!rxfh->indir && !rxfh->key) in qede_set_rxfh()
1414 if (rxfh->indir) { in qede_set_rxfh()
1416 edev->rss_ind_table[i] = rxfh->indir[i]; in qede_set_rxfh()
1417 edev->rss_params_inited |= QEDE_RSS_INDIR_INITED; in qede_set_rxfh()
1420 if (rxfh->key) { in qede_set_rxfh()
1421 memcpy(&edev->rss_key, rxfh->key, qede_get_rxfh_key_size(dev)); in qede_set_rxfh()
1422 edev->rss_params_inited |= QEDE_RSS_KEY_INITED; in qede_set_rxfh()
1426 if (edev->state == QEDE_STATE_OPEN) { in qede_set_rxfh()
1430 return -ENOMEM; in qede_set_rxfh()
1432 qede_fill_rss_params(edev, &vport_update_params->rss_params, in qede_set_rxfh()
1433 &vport_update_params->update_rss_flg); in qede_set_rxfh()
1434 rc = edev->ops->vport_update(edev->cdev, vport_update_params); in qede_set_rxfh()
1447 if (!netif_running(edev->ndev)) in qede_netif_start()
1452 qed_sb_ack(edev->fp_array[i].sb_info, IGU_INT_ENABLE, 1); in qede_netif_start()
1453 napi_enable(&edev->fp_array[i].napi); in qede_netif_start()
1463 napi_disable(&edev->fp_array[i].napi); in qede_netif_stop()
1465 qed_sb_ack(edev->fp_array[i].sb_info, IGU_INT_DISABLE, 0); in qede_netif_stop()
1479 struct qede_fastpath *fp = &edev->fp_array[i]; in qede_selftest_transmit_traffic()
1481 if (fp->type & QEDE_FASTPATH_TX) { in qede_selftest_transmit_traffic()
1489 return -1; in qede_selftest_transmit_traffic()
1493 idx = txq->sw_tx_prod; in qede_selftest_transmit_traffic()
1494 txq->sw_tx_ring.skbs[idx].skb = skb; in qede_selftest_transmit_traffic()
1495 first_bd = qed_chain_produce(&txq->tx_pbl); in qede_selftest_transmit_traffic()
1498 first_bd->data.bd_flags.bitfields = val; in qede_selftest_transmit_traffic()
1499 val = skb->len & ETH_TX_DATA_1ST_BD_PKT_LEN_MASK; in qede_selftest_transmit_traffic()
1501 first_bd->data.bitfields |= cpu_to_le16(val); in qede_selftest_transmit_traffic()
1504 mapping = dma_map_single(&edev->pdev->dev, skb->data, in qede_selftest_transmit_traffic()
1506 if (unlikely(dma_mapping_error(&edev->pdev->dev, mapping))) { in qede_selftest_transmit_traffic()
1508 return -ENOMEM; in qede_selftest_transmit_traffic()
1512 /* update the first BD with the actual num BDs */ in qede_selftest_transmit_traffic()
1513 first_bd->data.nbds = 1; in qede_selftest_transmit_traffic()
1514 txq->sw_tx_prod = (txq->sw_tx_prod + 1) % txq->num_tx_buffers; in qede_selftest_transmit_traffic()
1516 val = qed_chain_get_prod_idx(&txq->tx_pbl); in qede_selftest_transmit_traffic()
1517 txq->tx_db.data.bd_prod = cpu_to_le16(val); in qede_selftest_transmit_traffic()
1524 writel(txq->tx_db.raw, txq->doorbell_addr); in qede_selftest_transmit_traffic()
1534 return -1; in qede_selftest_transmit_traffic()
1537 first_bd = (struct eth_tx_1st_bd *)qed_chain_consume(&txq->tx_pbl); in qede_selftest_transmit_traffic()
1538 dma_unmap_single(&edev->pdev->dev, BD_UNMAP_ADDR(first_bd), in qede_selftest_transmit_traffic()
1540 txq->sw_tx_cons = (txq->sw_tx_cons + 1) % txq->num_tx_buffers; in qede_selftest_transmit_traffic()
1541 txq->sw_tx_ring.skbs[idx].skb = NULL; in qede_selftest_transmit_traffic()
1550 struct qede_rx_queue *rxq = NULL; in qede_selftest_receive_traffic() local
1557 if (edev->fp_array[i].type & QEDE_FASTPATH_RX) { in qede_selftest_receive_traffic()
1558 rxq = edev->fp_array[i].rxq; in qede_selftest_receive_traffic()
1563 if (!rxq) { in qede_selftest_receive_traffic()
1565 return -1; in qede_selftest_receive_traffic()
1568 /* The packet is expected to receive on rx-queue 0 even though RSS is in qede_selftest_receive_traffic()
1573 if (!qede_has_rx_work(rxq)) { in qede_selftest_receive_traffic()
1579 cqe = (union eth_rx_cqe *)qed_chain_consume(&rxq->rx_comp_ring); in qede_selftest_receive_traffic()
1582 sw_rx_index = rxq->sw_rx_cons & NUM_RX_BDS_MAX; in qede_selftest_receive_traffic()
1583 sw_rx_data = &rxq->sw_rx_ring[sw_rx_index]; in qede_selftest_receive_traffic()
1584 fp_cqe = &cqe->fast_path_regular; in qede_selftest_receive_traffic()
1585 len = le16_to_cpu(fp_cqe->len_on_first_bd); in qede_selftest_receive_traffic()
1586 data_ptr = (u8 *)(page_address(sw_rx_data->data) + in qede_selftest_receive_traffic()
1587 fp_cqe->placement_offset + in qede_selftest_receive_traffic()
1588 sw_rx_data->page_offset + in qede_selftest_receive_traffic()
1589 rxq->rx_headroom); in qede_selftest_receive_traffic()
1590 if (ether_addr_equal(data_ptr, edev->ndev->dev_addr) && in qede_selftest_receive_traffic()
1592 edev->ndev->dev_addr)) { in qede_selftest_receive_traffic()
1595 rc = -1; in qede_selftest_receive_traffic()
1599 qede_recycle_rx_bd_ring(rxq, 1); in qede_selftest_receive_traffic()
1600 qed_chain_recycle_consumed(&rxq->rx_comp_ring); in qede_selftest_receive_traffic()
1605 qede_recycle_rx_bd_ring(rxq, 1); in qede_selftest_receive_traffic()
1606 qed_chain_recycle_consumed(&rxq->rx_comp_ring); in qede_selftest_receive_traffic()
1611 return -1; in qede_selftest_receive_traffic()
1614 qede_update_rx_prod(edev, rxq); in qede_selftest_receive_traffic()
1627 if (!netif_running(edev->ndev)) { in qede_selftest_run_loopback()
1629 return -EINVAL; in qede_selftest_run_loopback()
1639 edev->ops->common->set_link(edev->cdev, &link_params); in qede_selftest_run_loopback()
1647 pkt_size = (((edev->ndev->mtu < ETH_DATA_LEN) ? in qede_selftest_run_loopback()
1648 edev->ndev->mtu : ETH_DATA_LEN) + ETH_HLEN); in qede_selftest_run_loopback()
1650 skb = netdev_alloc_skb(edev->ndev, pkt_size); in qede_selftest_run_loopback()
1653 rc = -ENOMEM; in qede_selftest_run_loopback()
1657 ether_addr_copy(packet, edev->ndev->dev_addr); in qede_selftest_run_loopback()
1658 ether_addr_copy(packet + ETH_ALEN, edev->ndev->dev_addr); in qede_selftest_run_loopback()
1659 memset(packet + (2 * ETH_ALEN), 0x77, (ETH_HLEN - (2 * ETH_ALEN))); in qede_selftest_run_loopback()
1681 edev->ops->common->set_link(edev->cdev, &link_params); in qede_selftest_run_loopback()
1697 "Self-test command parameters: offline = %d, external_lb = %d\n", in qede_self_test()
1698 (etest->flags & ETH_TEST_FL_OFFLINE), in qede_self_test()
1699 (etest->flags & ETH_TEST_FL_EXTERNAL_LB) >> 2); in qede_self_test()
1703 if (etest->flags & ETH_TEST_FL_OFFLINE) { in qede_self_test()
1707 etest->flags |= ETH_TEST_FL_FAILED; in qede_self_test()
1711 if (edev->ops->common->selftest->selftest_interrupt(edev->cdev)) { in qede_self_test()
1713 etest->flags |= ETH_TEST_FL_FAILED; in qede_self_test()
1716 if (edev->ops->common->selftest->selftest_memory(edev->cdev)) { in qede_self_test()
1718 etest->flags |= ETH_TEST_FL_FAILED; in qede_self_test()
1721 if (edev->ops->common->selftest->selftest_register(edev->cdev)) { in qede_self_test()
1723 etest->flags |= ETH_TEST_FL_FAILED; in qede_self_test()
1726 if (edev->ops->common->selftest->selftest_clock(edev->cdev)) { in qede_self_test()
1728 etest->flags |= ETH_TEST_FL_FAILED; in qede_self_test()
1731 if (edev->ops->common->selftest->selftest_nvram(edev->cdev)) { in qede_self_test()
1733 etest->flags |= ETH_TEST_FL_FAILED; in qede_self_test()
1744 switch (tuna->id) { in qede_set_tunable()
1751 return -EINVAL; in qede_set_tunable()
1754 edev->rx_copybreak = *(u32 *)data; in qede_set_tunable()
1757 return -EOPNOTSUPP; in qede_set_tunable()
1768 switch (tuna->id) { in qede_get_tunable()
1770 *(u32 *)data = edev->rx_copybreak; in qede_get_tunable()
1773 return -EOPNOTSUPP; in qede_get_tunable()
1785 edev->ops->common->get_link(edev->cdev, &current_link); in qede_get_eee()
1789 return -EOPNOTSUPP; in qede_get_eee()
1793 edata->advertised, in qede_get_eee()
1796 edata->advertised, in qede_get_eee()
1800 edata->supported, in qede_get_eee()
1803 edata->supported, in qede_get_eee()
1807 edata->lp_advertised, in qede_get_eee()
1810 edata->lp_advertised, in qede_get_eee()
1813 edata->tx_lpi_timer = current_link.eee.tx_lpi_timer; in qede_get_eee()
1814 edata->eee_enabled = current_link.eee.enable; in qede_get_eee()
1815 edata->tx_lpi_enabled = current_link.eee.tx_lpi_enable; in qede_get_eee()
1816 edata->eee_active = current_link.eee_active; in qede_get_eee()
1830 if (!edev->ops->common->can_link_change(edev->cdev)) { in qede_set_eee()
1832 return -EOPNOTSUPP; in qede_set_eee()
1836 edev->ops->common->get_link(edev->cdev, &current_link); in qede_set_eee()
1840 return -EOPNOTSUPP; in qede_set_eee()
1851 unsupp = linkmode_andnot(tmp, edata->advertised, supported); in qede_set_eee()
1855 __ETHTOOL_LINK_MODE_MASK_NBITS, edata->advertised); in qede_set_eee()
1856 return -EINVAL; in qede_set_eee()
1860 edata->advertised)) in qede_set_eee()
1863 edata->advertised)) in qede_set_eee()
1866 params.eee.enable = edata->eee_enabled; in qede_set_eee()
1867 params.eee.tx_lpi_enable = edata->tx_lpi_enabled; in qede_set_eee()
1868 params.eee.tx_lpi_timer = edata->tx_lpi_timer; in qede_set_eee()
1871 edev->ops->common->set_link(edev->cdev, &params); in qede_set_eee()
1919 edev->ops->common->get_link(edev->cdev, &curr_link); in qede_get_fecparam()
1921 fecparam->active_fec = qede_link_to_ethtool_fec(curr_link.active_fec); in qede_get_fecparam()
1922 fecparam->fec = qede_link_to_ethtool_fec(curr_link.sup_fec); in qede_get_fecparam()
1933 if (!edev->ops || !edev->ops->common->can_link_change(edev->cdev)) { in qede_set_fecparam()
1935 return -EOPNOTSUPP; in qede_set_fecparam()
1940 params.fec = qede_ethtool_to_link_fec(fecparam->fec); in qede_set_fecparam()
1943 edev->ops->common->set_link(edev->cdev, &params); in qede_set_fecparam()
1956 rc = edev->ops->common->read_module_eeprom(edev->cdev, buf, in qede_get_module_info()
1964 case 0x3: /* SFP, SFP+, SFP-28 */ in qede_get_module_info()
1965 modinfo->type = ETH_MODULE_SFF_8472; in qede_get_module_info()
1966 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; in qede_get_module_info()
1970 modinfo->type = ETH_MODULE_SFF_8436; in qede_get_module_info()
1971 modinfo->eeprom_len = ETH_MODULE_SFF_8436_LEN; in qede_get_module_info()
1973 case 0x11: /* QSFP-28 */ in qede_get_module_info()
1974 modinfo->type = ETH_MODULE_SFF_8636; in qede_get_module_info()
1975 modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN; in qede_get_module_info()
1979 return -EINVAL; in qede_get_module_info()
1989 u32 start_addr = ee->offset, size = 0; in qede_get_module_eeprom()
1994 if (ee->offset < ETH_MODULE_SFF_8079_LEN) { in qede_get_module_eeprom()
1996 if (ee->offset + ee->len > ETH_MODULE_SFF_8079_LEN) in qede_get_module_eeprom()
1997 size = ETH_MODULE_SFF_8079_LEN - ee->offset; in qede_get_module_eeprom()
1999 size = ee->len; in qede_get_module_eeprom()
2001 rc = edev->ops->common->read_module_eeprom(edev->cdev, buf, in qede_get_module_eeprom()
2016 size = ee->len - size; in qede_get_module_eeprom()
2019 size = ETH_MODULE_SFF_8472_LEN - start_addr; in qede_get_module_eeprom()
2020 start_addr -= ETH_MODULE_SFF_8079_LEN; in qede_get_module_eeprom()
2021 rc = edev->ops->common->read_module_eeprom(edev->cdev, buf, in qede_get_module_eeprom()
2039 if (edev->dump_info.cmd == QEDE_DUMP_CMD_NONE) { in qede_set_dump()
2040 if (val->flag > QEDE_DUMP_CMD_MAX) { in qede_set_dump()
2041 DP_ERR(edev, "Invalid command %d\n", val->flag); in qede_set_dump()
2042 return -EINVAL; in qede_set_dump()
2044 edev->dump_info.cmd = val->flag; in qede_set_dump()
2045 edev->dump_info.num_args = 0; in qede_set_dump()
2049 if (edev->dump_info.num_args == QEDE_DUMP_MAX_ARGS) { in qede_set_dump()
2050 DP_ERR(edev, "Arg count = %d\n", edev->dump_info.num_args); in qede_set_dump()
2051 return -EINVAL; in qede_set_dump()
2054 switch (edev->dump_info.cmd) { in qede_set_dump()
2056 edev->dump_info.args[edev->dump_info.num_args] = val->flag; in qede_set_dump()
2057 edev->dump_info.num_args++; in qede_set_dump()
2060 rc = edev->ops->common->set_grc_config(edev->cdev, in qede_set_dump()
2061 val->flag, 1); in qede_set_dump()
2075 if (!edev->ops || !edev->ops->common) { in qede_get_dump_flag()
2077 return -EINVAL; in qede_get_dump_flag()
2080 dump->version = QEDE_DUMP_VERSION; in qede_get_dump_flag()
2081 switch (edev->dump_info.cmd) { in qede_get_dump_flag()
2083 dump->flag = QEDE_DUMP_CMD_NVM_CFG; in qede_get_dump_flag()
2084 dump->len = edev->ops->common->read_nvm_cfg_len(edev->cdev, in qede_get_dump_flag()
2085 edev->dump_info.args[0]); in qede_get_dump_flag()
2088 dump->flag = QEDE_DUMP_CMD_GRCDUMP; in qede_get_dump_flag()
2089 dump->len = edev->ops->common->dbg_all_data_size(edev->cdev); in qede_get_dump_flag()
2092 DP_ERR(edev, "Invalid cmd = %d\n", edev->dump_info.cmd); in qede_get_dump_flag()
2093 return -EINVAL; in qede_get_dump_flag()
2097 "dump->version = 0x%x dump->flag = %d dump->len = %d\n", in qede_get_dump_flag()
2098 dump->version, dump->flag, dump->len); in qede_get_dump_flag()
2108 if (!edev->ops || !edev->ops->common) { in qede_get_dump_data()
2110 rc = -EINVAL; in qede_get_dump_data()
2114 switch (edev->dump_info.cmd) { in qede_get_dump_data()
2116 if (edev->dump_info.num_args != QEDE_DUMP_NVM_ARG_COUNT) { in qede_get_dump_data()
2118 edev->dump_info.num_args, in qede_get_dump_data()
2120 rc = -EINVAL; in qede_get_dump_data()
2123 rc = edev->ops->common->read_nvm_cfg(edev->cdev, (u8 **)&buf, in qede_get_dump_data()
2124 edev->dump_info.args[0], in qede_get_dump_data()
2125 edev->dump_info.args[1]); in qede_get_dump_data()
2128 memset(buf, 0, dump->len); in qede_get_dump_data()
2129 rc = edev->ops->common->dbg_all_data(edev->cdev, buf); in qede_get_dump_data()
2132 DP_ERR(edev, "Invalid cmd = %d\n", edev->dump_info.cmd); in qede_get_dump_data()
2133 rc = -EINVAL; in qede_get_dump_data()
2138 edev->dump_info.cmd = QEDE_DUMP_CMD_NONE; in qede_get_dump_data()
2139 edev->dump_info.num_args = 0; in qede_get_dump_data()
2140 memset(edev->dump_info.args, 0, sizeof(edev->dump_info.args)); in qede_get_dump_data()
2153 if (coal->rx_coalesce_usecs > QED_COALESCE_MAX || in qede_set_per_coalesce()
2154 coal->tx_coalesce_usecs > QED_COALESCE_MAX) { in qede_set_per_coalesce()
2157 coal->rx_coalesce_usecs > QED_COALESCE_MAX ? "rx" in qede_set_per_coalesce()
2160 return -EINVAL; in qede_set_per_coalesce()
2163 rxc = (u16)coal->rx_coalesce_usecs; in qede_set_per_coalesce()
2164 txc = (u16)coal->tx_coalesce_usecs; in qede_set_per_coalesce()
2167 if (queue >= edev->num_queues) { in qede_set_per_coalesce()
2169 rc = -EINVAL; in qede_set_per_coalesce()
2173 if (edev->state != QEDE_STATE_OPEN) { in qede_set_per_coalesce()
2174 rc = -EINVAL; in qede_set_per_coalesce()
2178 fp = &edev->fp_array[queue]; in qede_set_per_coalesce()
2180 if (edev->fp_array[queue].type & QEDE_FASTPATH_RX) { in qede_set_per_coalesce()
2181 rc = edev->ops->common->set_coalesce(edev->cdev, in qede_set_per_coalesce()
2183 fp->rxq->handle); in qede_set_per_coalesce()
2189 edev->coal_entry[queue].rxc = rxc; in qede_set_per_coalesce()
2190 edev->coal_entry[queue].isvalid = true; in qede_set_per_coalesce()
2193 if (edev->fp_array[queue].type & QEDE_FASTPATH_TX) { in qede_set_per_coalesce()
2194 rc = edev->ops->common->set_coalesce(edev->cdev, in qede_set_per_coalesce()
2196 fp->txq->handle); in qede_set_per_coalesce()
2202 edev->coal_entry[queue].txc = txc; in qede_set_per_coalesce()
2203 edev->coal_entry[queue].isvalid = true; in qede_set_per_coalesce()
2227 if (queue >= edev->num_queues) { in qede_get_per_coalesce()
2229 rc = -EINVAL; in qede_get_per_coalesce()
2233 if (edev->state != QEDE_STATE_OPEN) { in qede_get_per_coalesce()
2234 rc = -EINVAL; in qede_get_per_coalesce()
2238 fp = &edev->fp_array[queue]; in qede_get_per_coalesce()
2240 if (fp->type & QEDE_FASTPATH_RX) in qede_get_per_coalesce()
2241 rx_handle = fp->rxq->handle; in qede_get_per_coalesce()
2243 rc = edev->ops->get_coalesce(edev->cdev, &rx_coal, in qede_get_per_coalesce()
2250 fp = &edev->fp_array[queue]; in qede_get_per_coalesce()
2251 if (fp->type & QEDE_FASTPATH_TX) in qede_get_per_coalesce()
2252 tx_handle = fp->txq->handle; in qede_get_per_coalesce()
2254 rc = edev->ops->get_coalesce(edev->cdev, &tx_coal, in qede_get_per_coalesce()
2262 coal->rx_coalesce_usecs = rx_coal; in qede_get_per_coalesce()
2263 coal->tx_coalesce_usecs = tx_coal; in qede_get_per_coalesce()
2355 dev->ethtool_ops = &qede_vf_ethtool_ops; in qede_set_ethtool_ops()
2357 dev->ethtool_ops = &qede_ethtool_ops; in qede_set_ethtool_ops()