Lines Matching +full:self +full:- +full:advertising
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2005 - 2016 Broadcom
7 * linux-drivers@emulex.com
79 * minimum-sized (64b) frames in the receive path.
179 /* This counter is incremented when the HW detects Q-in-Q style VLAN
223 strlcpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); in be_get_drvinfo()
224 if (!memcmp(adapter->fw_ver, adapter->fw_on_flash, FW_VER_LEN)) in be_get_drvinfo()
225 strlcpy(drvinfo->fw_version, adapter->fw_ver, in be_get_drvinfo()
226 sizeof(drvinfo->fw_version)); in be_get_drvinfo()
228 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), in be_get_drvinfo()
229 "%s [%s]", adapter->fw_ver, adapter->fw_on_flash); in be_get_drvinfo()
231 strlcpy(drvinfo->bus_info, pci_name(adapter->pdev), in be_get_drvinfo()
232 sizeof(drvinfo->bus_info)); in be_get_drvinfo()
257 dump_size = adapter->fat_dump_len; in be_get_dump_len()
272 read_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, read_cmd.size, in lancer_cmd_read_file()
276 dev_err(&adapter->pdev->dev, in lancer_cmd_read_file()
278 return -ENOMEM; in lancer_cmd_read_file()
282 chunk_size = min_t(u32, (buf_len - total_read_len), in lancer_cmd_read_file()
293 status = -EIO; in lancer_cmd_read_file()
297 dma_free_coherent(&adapter->pdev->dev, read_cmd.size, read_cmd.va, in lancer_cmd_read_file()
323 struct be_aic_obj *aic = &adapter->aic_obj[0]; in be_get_coalesce()
325 et->rx_coalesce_usecs = aic->prev_eqd; in be_get_coalesce()
326 et->rx_coalesce_usecs_high = aic->max_eqd; in be_get_coalesce()
327 et->rx_coalesce_usecs_low = aic->min_eqd; in be_get_coalesce()
329 et->tx_coalesce_usecs = aic->prev_eqd; in be_get_coalesce()
330 et->tx_coalesce_usecs_high = aic->max_eqd; in be_get_coalesce()
331 et->tx_coalesce_usecs_low = aic->min_eqd; in be_get_coalesce()
333 et->use_adaptive_rx_coalesce = adapter->aic_enabled; in be_get_coalesce()
334 et->use_adaptive_tx_coalesce = adapter->aic_enabled; in be_get_coalesce()
348 struct be_aic_obj *aic = &adapter->aic_obj[0]; in be_set_coalesce()
352 adapter->aic_enabled = et->use_adaptive_rx_coalesce; in be_set_coalesce()
355 aic->max_eqd = min(et->rx_coalesce_usecs_high, BE_MAX_EQD); in be_set_coalesce()
356 aic->min_eqd = min(et->rx_coalesce_usecs_low, aic->max_eqd); in be_set_coalesce()
357 aic->et_eqd = min(et->rx_coalesce_usecs, aic->max_eqd); in be_set_coalesce()
358 aic->et_eqd = max(aic->et_eqd, aic->min_eqd); in be_set_coalesce()
367 if (!et->use_adaptive_rx_coalesce && skyhawk_chip(adapter)) in be_set_coalesce()
383 p = (u8 *)&adapter->drv_stats + et_stats[i].offset; in be_get_ethtool_stats()
392 start = u64_stats_fetch_begin_irq(&stats->sync); in be_get_ethtool_stats()
393 data[base] = stats->rx_bytes; in be_get_ethtool_stats()
394 data[base + 1] = stats->rx_pkts; in be_get_ethtool_stats()
395 } while (u64_stats_fetch_retry_irq(&stats->sync, start)); in be_get_ethtool_stats()
408 start = u64_stats_fetch_begin_irq(&stats->sync_compl); in be_get_ethtool_stats()
409 data[base] = stats->tx_compl; in be_get_ethtool_stats()
410 } while (u64_stats_fetch_retry_irq(&stats->sync_compl, start)); in be_get_ethtool_stats()
413 start = u64_stats_fetch_begin_irq(&stats->sync); in be_get_ethtool_stats()
420 } while (u64_stats_fetch_retry_irq(&stats->sync, start)); in be_get_ethtool_stats()
426 "disable-tpe-recovery"
441 for (i = 0; i < adapter->num_rx_qs; i++) { in be_get_stat_strings()
448 for (i = 0; i < adapter->num_tx_qs; i++) { in be_get_stat_strings()
478 adapter->num_rx_qs * ETHTOOL_RXSTATS_NUM + in be_get_sset_count()
479 adapter->num_tx_qs * ETHTOOL_TXSTATS_NUM; in be_get_sset_count()
483 return -EINVAL; in be_get_sset_count()
491 switch (adapter->phy.interface_type) { in be_get_port_type()
498 if (adapter->phy.cable_type & SFP_PLUS_COPPER_CABLE) in be_get_port_type()
504 if (adapter->phy.cable_type & QSFP_PLUS_CR4_CABLE) in be_get_port_type()
527 switch (adapter->phy.interface_type) { in convert_to_et_setting()
566 switch (adapter->phy.cable_type) { in convert_to_et_setting()
606 return (adapter->phy.interface_type == PHY_TYPE_SFP_PLUS_10GB || in be_pause_supported()
607 adapter->phy.interface_type == PHY_TYPE_XFP_10GB) ? in be_pause_supported()
620 u32 supported = 0, advertising = 0; in be_get_link_ksettings() local
622 if (adapter->phy.link_speed < 0) { in be_get_link_ksettings()
627 cmd->base.speed = link_speed; in be_get_link_ksettings()
631 auto_speeds = adapter->phy.auto_speeds_supported; in be_get_link_ksettings()
632 fixed_speeds = adapter->phy.fixed_speeds_supported; in be_get_link_ksettings()
640 advertising = in be_get_link_ksettings()
643 cmd->base.port = be_get_port_type(adapter); in be_get_link_ksettings()
645 if (adapter->phy.auto_speeds_supported) { in be_get_link_ksettings()
647 cmd->base.autoneg = AUTONEG_ENABLE; in be_get_link_ksettings()
648 advertising |= ADVERTISED_Autoneg; in be_get_link_ksettings()
653 advertising |= ADVERTISED_Pause; in be_get_link_ksettings()
655 cmd->base.port = PORT_OTHER; in be_get_link_ksettings()
656 cmd->base.autoneg = AUTONEG_DISABLE; in be_get_link_ksettings()
660 adapter->phy.link_speed = cmd->base.speed; in be_get_link_ksettings()
661 adapter->phy.port_type = cmd->base.port; in be_get_link_ksettings()
662 adapter->phy.autoneg = cmd->base.autoneg; in be_get_link_ksettings()
663 adapter->phy.advertising = advertising; in be_get_link_ksettings()
664 adapter->phy.supported = supported; in be_get_link_ksettings()
666 cmd->base.speed = adapter->phy.link_speed; in be_get_link_ksettings()
667 cmd->base.port = adapter->phy.port_type; in be_get_link_ksettings()
668 cmd->base.autoneg = adapter->phy.autoneg; in be_get_link_ksettings()
669 advertising = adapter->phy.advertising; in be_get_link_ksettings()
670 supported = adapter->phy.supported; in be_get_link_ksettings()
673 cmd->base.duplex = netif_carrier_ok(netdev) ? in be_get_link_ksettings()
675 cmd->base.phy_address = adapter->port_num; in be_get_link_ksettings()
677 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported, in be_get_link_ksettings()
679 ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.advertising, in be_get_link_ksettings()
680 advertising); in be_get_link_ksettings()
690 ring->rx_max_pending = adapter->rx_obj[0].q.len; in be_get_ringparam()
691 ring->rx_pending = adapter->rx_obj[0].q.len; in be_get_ringparam()
692 ring->tx_max_pending = adapter->tx_obj[0].q.len; in be_get_ringparam()
693 ring->tx_pending = adapter->tx_obj[0].q.len; in be_get_ringparam()
701 be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause); in be_get_pauseparam()
702 ecmd->autoneg = adapter->phy.fc_autoneg; in be_get_pauseparam()
711 if (ecmd->autoneg != adapter->phy.fc_autoneg) in be_set_pauseparam()
712 return -EINVAL; in be_set_pauseparam()
714 status = be_cmd_set_flow_control(adapter, ecmd->tx_pause, in be_set_pauseparam()
715 ecmd->rx_pause); in be_set_pauseparam()
717 dev_warn(&adapter->pdev->dev, "Pause param set failed\n"); in be_set_pauseparam()
721 adapter->tx_fc = ecmd->tx_pause; in be_set_pauseparam()
722 adapter->rx_fc = ecmd->rx_pause; in be_set_pauseparam()
734 status = be_cmd_get_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
735 &adapter->beacon_state); in be_set_phys_id()
741 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
746 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
751 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
752 0, 0, adapter->beacon_state); in be_set_phys_id()
761 struct device *dev = &adapter->pdev->dev; in be_set_dump()
766 return -EOPNOTSUPP; in be_set_dump()
768 switch (dump->flag) { in be_set_dump()
780 dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag); in be_set_dump()
781 return -EINVAL; in be_set_dump()
790 if (adapter->wol_cap & BE_WOL_CAP) { in be_get_wol()
791 wol->supported |= WAKE_MAGIC; in be_get_wol()
792 if (adapter->wol_en) in be_get_wol()
793 wol->wolopts |= WAKE_MAGIC; in be_get_wol()
795 wol->wolopts = 0; in be_get_wol()
797 memset(&wol->sopass, 0, sizeof(wol->sopass)); in be_get_wol()
803 struct device *dev = &adapter->pdev->dev; in be_set_wol()
809 if (wol->wolopts & ~WAKE_MAGIC) in be_set_wol()
810 return -EOPNOTSUPP; in be_set_wol()
812 if (!(adapter->wol_cap & BE_WOL_CAP)) { in be_set_wol()
813 dev_warn(&adapter->pdev->dev, "WOL not supported\n"); in be_set_wol()
814 return -EOPNOTSUPP; in be_set_wol()
820 return -ENOMEM; in be_set_wol()
824 enable = wol->wolopts & WAKE_MAGIC; in be_set_wol()
826 ether_addr_copy(mac, adapter->netdev->dev_addr); in be_set_wol()
830 dev_err(dev, "Could not set Wake-on-lan mac address\n"); in be_set_wol()
835 pci_enable_wake(adapter->pdev, PCI_D3hot, enable); in be_set_wol()
836 pci_enable_wake(adapter->pdev, PCI_D3cold, enable); in be_set_wol()
838 adapter->wol_en = enable ? true : false; in be_set_wol()
854 ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_test_ddr_dma()
858 return -ENOMEM; in be_test_ddr_dma()
868 dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va, in be_test_ddr_dma()
878 ret = be_cmd_set_loopback(adapter, adapter->hba_port_num, in be_loopback_test()
883 *status = be_cmd_loopback_test(adapter, adapter->hba_port_num, in be_loopback_test()
886 ret = be_cmd_set_loopback(adapter, adapter->hba_port_num, in be_loopback_test()
901 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) { in be_self_test()
902 dev_err(&adapter->pdev->dev, "Self test not supported\n"); in be_self_test()
903 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
912 if (test->flags & ETH_TEST_FL_OFFLINE) { in be_self_test()
914 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
917 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
919 if (test->flags & ETH_TEST_FL_EXTERNAL_LB) { in be_self_test()
922 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
923 test->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE; in be_self_test()
929 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
934 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
939 for (cnt = 10; cnt; cnt--) { in be_self_test()
943 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
944 data[4] = -1; in be_self_test()
959 return be_load_fw(adapter, efl->data); in be_do_flash()
968 return -EOPNOTSUPP; in be_get_dump_flag()
970 dump->len = be_get_dump_len(adapter); in be_get_dump_flag()
971 dump->version = 1; in be_get_dump_flag()
972 dump->flag = 0x1; /* FW dump is enabled */ in be_get_dump_flag()
984 return -EOPNOTSUPP; in be_get_dump_data()
986 status = be_read_dump_data(adapter, dump->len, buf); in be_get_dump_data()
1017 if (!eeprom->len) in be_read_eeprom()
1018 return -EINVAL; in be_read_eeprom()
1023 eeprom->len, data); in be_read_eeprom()
1026 eeprom->len, data); in be_read_eeprom()
1029 eeprom->magic = BE_VENDOR_ID | (adapter->pdev->device<<16); in be_read_eeprom()
1033 eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_read_eeprom()
1038 return -ENOMEM; in be_read_eeprom()
1044 memcpy(data, resp->seeprom_data + eeprom->offset, eeprom->len); in be_read_eeprom()
1046 dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va, in be_read_eeprom()
1056 return adapter->msg_enable; in be_get_msg_level()
1063 if (adapter->msg_enable == level) in be_set_msg_level()
1066 if ((level & NETIF_MSG_HW) != (adapter->msg_enable & NETIF_MSG_HW)) in be_set_msg_level()
1071 adapter->msg_enable = level; in be_set_msg_level()
1080 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4) in be_get_rss_hash_opts()
1082 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV4) in be_get_rss_hash_opts()
1086 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4) in be_get_rss_hash_opts()
1088 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV4) in be_get_rss_hash_opts()
1092 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6) in be_get_rss_hash_opts()
1094 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV6) in be_get_rss_hash_opts()
1098 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6) in be_get_rss_hash_opts()
1100 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV6) in be_get_rss_hash_opts()
1114 dev_info(&adapter->pdev->dev, in be_get_rxnfc()
1116 return -EINVAL; in be_get_rxnfc()
1119 switch (cmd->cmd) { in be_get_rxnfc()
1121 cmd->data = be_get_rss_hash_opts(adapter, cmd->flow_type); in be_get_rxnfc()
1124 cmd->data = adapter->num_rx_qs; in be_get_rxnfc()
1127 return -EINVAL; in be_get_rxnfc()
1137 u32 rss_flags = adapter->rss_info.rss_flags; in be_set_rss_hash_opts()
1139 if (cmd->data != L3_RSS_FLAGS && in be_set_rss_hash_opts()
1140 cmd->data != (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1141 return -EINVAL; in be_set_rss_hash_opts()
1143 switch (cmd->flow_type) { in be_set_rss_hash_opts()
1145 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1147 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1152 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1154 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1159 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) && in be_set_rss_hash_opts()
1161 return -EINVAL; in be_set_rss_hash_opts()
1163 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1165 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1170 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) && in be_set_rss_hash_opts()
1172 return -EINVAL; in be_set_rss_hash_opts()
1174 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1176 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1181 return -EINVAL; in be_set_rss_hash_opts()
1184 if (rss_flags == adapter->rss_info.rss_flags) in be_set_rss_hash_opts()
1187 status = be_cmd_rss_config(adapter, adapter->rss_info.rsstable, in be_set_rss_hash_opts()
1189 adapter->rss_info.rss_hkey); in be_set_rss_hash_opts()
1191 adapter->rss_info.rss_flags = rss_flags; in be_set_rss_hash_opts()
1202 dev_err(&adapter->pdev->dev, in be_set_rxnfc()
1204 return -EINVAL; in be_set_rxnfc()
1207 switch (cmd->cmd) { in be_set_rxnfc()
1212 return -EINVAL; in be_set_rxnfc()
1222 u16 num_rx_irqs = max_t(u16, adapter->num_rss_qs, 1); in be_get_channels()
1225 ch->combined_count = min(adapter->num_tx_qs, num_rx_irqs); in be_get_channels()
1226 ch->rx_count = num_rx_irqs - ch->combined_count; in be_get_channels()
1227 ch->tx_count = adapter->num_tx_qs - ch->combined_count; in be_get_channels()
1229 ch->max_combined = be_max_qp_irqs(adapter); in be_get_channels()
1231 ch->max_rx = be_max_rx_irqs(adapter) - 1; in be_get_channels()
1232 ch->max_tx = be_max_tx_irqs(adapter) - 1; in be_get_channels()
1242 * combined and either RX-only or TX-only channels. in be_set_channels()
1244 if (ch->other_count || !ch->combined_count || in be_set_channels()
1245 (ch->rx_count && ch->tx_count)) in be_set_channels()
1246 return -EINVAL; in be_set_channels()
1248 if (ch->combined_count > be_max_qp_irqs(adapter) || in be_set_channels()
1249 (ch->rx_count && in be_set_channels()
1250 (ch->rx_count + ch->combined_count) > be_max_rx_irqs(adapter)) || in be_set_channels()
1251 (ch->tx_count && in be_set_channels()
1252 (ch->tx_count + ch->combined_count) > be_max_tx_irqs(adapter))) in be_set_channels()
1253 return -EINVAL; in be_set_channels()
1255 adapter->cfg_num_rx_irqs = ch->combined_count + ch->rx_count; in be_set_channels()
1256 adapter->cfg_num_tx_irqs = ch->combined_count + ch->tx_count; in be_set_channels()
1277 struct rss_info *rss = &adapter->rss_info; in be_get_rxfh()
1281 indir[i] = rss->rss_queue[i]; in be_get_rxfh()
1285 memcpy(hkey, rss->rss_hkey, RSS_HASH_KEY_LEN); in be_get_rxfh()
1302 return -EOPNOTSUPP; in be_set_rxfh()
1309 rxo = &adapter->rx_obj[j]; in be_set_rxfh()
1310 rsstable[i] = rxo->rss_id; in be_set_rxfh()
1311 adapter->rss_info.rss_queue[i] = j; in be_set_rxfh()
1314 memcpy(rsstable, adapter->rss_info.rsstable, in be_set_rxfh()
1319 hkey = adapter->rss_info.rss_hkey; in be_set_rxfh()
1322 adapter->rss_info.rss_flags, in be_set_rxfh()
1325 adapter->rss_info.rss_flags = RSS_ENABLE_NONE; in be_set_rxfh()
1326 return -EIO; in be_set_rxfh()
1328 memcpy(adapter->rss_info.rss_hkey, hkey, RSS_HASH_KEY_LEN); in be_set_rxfh()
1329 memcpy(adapter->rss_info.rsstable, rsstable, in be_set_rxfh()
1342 return -EOPNOTSUPP; in be_get_module_info()
1348 modinfo->type = ETH_MODULE_SFF_8079; in be_get_module_info()
1349 modinfo->eeprom_len = PAGE_DATA_LEN; in be_get_module_info()
1351 modinfo->type = ETH_MODULE_SFF_8472; in be_get_module_info()
1352 modinfo->eeprom_len = 2 * PAGE_DATA_LEN; in be_get_module_info()
1365 return -EOPNOTSUPP; in be_get_module_eeprom()
1372 if (eeprom->offset + eeprom->len > PAGE_DATA_LEN) { in be_get_module_eeprom()
1380 if (eeprom->offset) in be_get_module_eeprom()
1381 memcpy(data, data + eeprom->offset, eeprom->len); in be_get_module_eeprom()
1390 return adapter->priv_flags; in be_get_priv_flags()
1396 bool tpe_old = !!(adapter->priv_flags & BE_DISABLE_TPE_RECOVERY); in be_set_priv_flags()
1401 adapter->priv_flags |= BE_DISABLE_TPE_RECOVERY; in be_set_priv_flags()
1402 dev_info(&adapter->pdev->dev, in be_set_priv_flags()
1405 adapter->priv_flags &= ~BE_DISABLE_TPE_RECOVERY; in be_set_priv_flags()
1406 dev_info(&adapter->pdev->dev, in be_set_priv_flags()