Lines Matching +full:mac +full:- +full:wol

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2005 - 2016 Broadcom
7 * linux-[email protected]
79 * minimum-sized (64b) frames in the receive path.
169 /* This counter is incremented when MAC or VLAN spoof checking is
179 /* This counter is incremented when the HW detects Q-in-Q style VLAN
205 "MAC Loopback test",
223 strscpy(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 strscpy(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 strscpy(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(&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(&stats->sync, start)); in be_get_ethtool_stats()
408 start = u64_stats_fetch_begin(&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(&stats->sync_compl, start)); in be_get_ethtool_stats()
413 start = u64_stats_fetch_begin(&stats->sync); in be_get_ethtool_stats()
420 } while (u64_stats_fetch_retry(&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()
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()
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()
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()
692 ring->rx_max_pending = adapter->rx_obj[0].q.len; in be_get_ringparam()
693 ring->rx_pending = adapter->rx_obj[0].q.len; in be_get_ringparam()
694 ring->tx_max_pending = adapter->tx_obj[0].q.len; in be_get_ringparam()
695 ring->tx_pending = adapter->tx_obj[0].q.len; in be_get_ringparam()
703 be_cmd_get_flow_control(adapter, &ecmd->tx_pause, &ecmd->rx_pause); in be_get_pauseparam()
704 ecmd->autoneg = adapter->phy.fc_autoneg; in be_get_pauseparam()
713 if (ecmd->autoneg != adapter->phy.fc_autoneg) in be_set_pauseparam()
714 return -EINVAL; in be_set_pauseparam()
716 status = be_cmd_set_flow_control(adapter, ecmd->tx_pause, in be_set_pauseparam()
717 ecmd->rx_pause); in be_set_pauseparam()
719 dev_warn(&adapter->pdev->dev, "Pause param set failed\n"); in be_set_pauseparam()
723 adapter->tx_fc = ecmd->tx_pause; in be_set_pauseparam()
724 adapter->rx_fc = ecmd->rx_pause; in be_set_pauseparam()
736 status = be_cmd_get_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
737 &adapter->beacon_state); in be_set_phys_id()
743 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
748 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
753 status = be_cmd_set_beacon_state(adapter, adapter->hba_port_num, in be_set_phys_id()
754 0, 0, adapter->beacon_state); in be_set_phys_id()
763 struct device *dev = &adapter->pdev->dev; in be_set_dump()
768 return -EOPNOTSUPP; in be_set_dump()
770 switch (dump->flag) { in be_set_dump()
782 dev_err(dev, "Invalid dump level: 0x%x\n", dump->flag); in be_set_dump()
783 return -EINVAL; in be_set_dump()
788 static void be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) in be_get_wol() argument
792 if (adapter->wol_cap & BE_WOL_CAP) { in be_get_wol()
793 wol->supported |= WAKE_MAGIC; in be_get_wol()
794 if (adapter->wol_en) in be_get_wol()
795 wol->wolopts |= WAKE_MAGIC; in be_get_wol()
797 wol->wolopts = 0; in be_get_wol()
799 memset(&wol->sopass, 0, sizeof(wol->sopass)); in be_get_wol()
802 static int be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) in be_set_wol() argument
805 struct device *dev = &adapter->pdev->dev; in be_set_wol()
807 u8 mac[ETH_ALEN]; in be_set_wol() local
811 if (wol->wolopts & ~WAKE_MAGIC) in be_set_wol()
812 return -EOPNOTSUPP; in be_set_wol()
814 if (!(adapter->wol_cap & BE_WOL_CAP)) { in be_set_wol()
815 dev_warn(&adapter->pdev->dev, "WOL not supported\n"); in be_set_wol()
816 return -EOPNOTSUPP; in be_set_wol()
822 return -ENOMEM; in be_set_wol()
824 eth_zero_addr(mac); in be_set_wol()
826 enable = wol->wolopts & WAKE_MAGIC; in be_set_wol()
828 ether_addr_copy(mac, adapter->netdev->dev_addr); in be_set_wol()
830 status = be_cmd_enable_magic_wol(adapter, mac, &cmd); in be_set_wol()
832 dev_err(dev, "Could not set Wake-on-lan mac address\n"); in be_set_wol()
837 pci_enable_wake(adapter->pdev, PCI_D3hot, enable); in be_set_wol()
838 pci_enable_wake(adapter->pdev, PCI_D3cold, enable); in be_set_wol()
840 adapter->wol_en = enable ? true : false; in be_set_wol()
856 ddrdma_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_test_ddr_dma()
860 return -ENOMEM; in be_test_ddr_dma()
870 dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va, in be_test_ddr_dma()
880 ret = be_cmd_set_loopback(adapter, adapter->hba_port_num, in be_loopback_test()
885 *status = be_cmd_loopback_test(adapter, adapter->hba_port_num, in be_loopback_test()
888 ret = be_cmd_set_loopback(adapter, adapter->hba_port_num, in be_loopback_test()
903 if (adapter->function_caps & BE_FUNCTION_CAPS_SUPER_NIC) { in be_self_test()
904 dev_err(&adapter->pdev->dev, "Self test not supported\n"); in be_self_test()
905 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
914 if (test->flags & ETH_TEST_FL_OFFLINE) { in be_self_test()
916 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
919 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
921 if (test->flags & ETH_TEST_FL_EXTERNAL_LB) { in be_self_test()
924 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
925 test->flags |= ETH_TEST_FL_EXTERNAL_LB_DONE; in be_self_test()
931 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
936 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
941 for (cnt = 10; cnt; cnt--) { in be_self_test()
945 test->flags |= ETH_TEST_FL_FAILED; in be_self_test()
946 data[4] = -1; in be_self_test()
961 return be_load_fw(adapter, efl->data); in be_do_flash()
970 return -EOPNOTSUPP; in be_get_dump_flag()
972 dump->len = be_get_dump_len(adapter); in be_get_dump_flag()
973 dump->version = 1; in be_get_dump_flag()
974 dump->flag = 0x1; /* FW dump is enabled */ in be_get_dump_flag()
986 return -EOPNOTSUPP; in be_get_dump_data()
988 status = be_read_dump_data(adapter, dump->len, buf); in be_get_dump_data()
1019 if (!eeprom->len) in be_read_eeprom()
1020 return -EINVAL; in be_read_eeprom()
1025 eeprom->len, data); in be_read_eeprom()
1028 eeprom->len, data); in be_read_eeprom()
1031 eeprom->magic = BE_VENDOR_ID | (adapter->pdev->device<<16); in be_read_eeprom()
1035 eeprom_cmd.va = dma_alloc_coherent(&adapter->pdev->dev, in be_read_eeprom()
1040 return -ENOMEM; in be_read_eeprom()
1046 memcpy(data, resp->seeprom_data + eeprom->offset, eeprom->len); in be_read_eeprom()
1048 dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va, in be_read_eeprom()
1058 return adapter->msg_enable; in be_get_msg_level()
1065 if (adapter->msg_enable == level) in be_set_msg_level()
1068 if ((level & NETIF_MSG_HW) != (adapter->msg_enable & NETIF_MSG_HW)) in be_set_msg_level()
1073 adapter->msg_enable = level; in be_set_msg_level()
1082 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4) in be_get_rss_hash_opts()
1084 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV4) in be_get_rss_hash_opts()
1088 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4) in be_get_rss_hash_opts()
1090 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV4) in be_get_rss_hash_opts()
1094 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6) in be_get_rss_hash_opts()
1096 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV6) in be_get_rss_hash_opts()
1100 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6) in be_get_rss_hash_opts()
1102 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV6) in be_get_rss_hash_opts()
1116 dev_info(&adapter->pdev->dev, in be_get_rxnfc()
1118 return -EINVAL; in be_get_rxnfc()
1121 switch (cmd->cmd) { in be_get_rxnfc()
1123 cmd->data = be_get_rss_hash_opts(adapter, cmd->flow_type); in be_get_rxnfc()
1126 cmd->data = adapter->num_rx_qs; in be_get_rxnfc()
1129 return -EINVAL; in be_get_rxnfc()
1139 u32 rss_flags = adapter->rss_info.rss_flags; in be_set_rss_hash_opts()
1141 if (cmd->data != L3_RSS_FLAGS && in be_set_rss_hash_opts()
1142 cmd->data != (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1143 return -EINVAL; in be_set_rss_hash_opts()
1145 switch (cmd->flow_type) { in be_set_rss_hash_opts()
1147 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1149 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1154 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1156 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1161 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) && in be_set_rss_hash_opts()
1163 return -EINVAL; in be_set_rss_hash_opts()
1165 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1167 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1172 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) && in be_set_rss_hash_opts()
1174 return -EINVAL; in be_set_rss_hash_opts()
1176 if (cmd->data == L3_RSS_FLAGS) in be_set_rss_hash_opts()
1178 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rss_hash_opts()
1183 return -EINVAL; in be_set_rss_hash_opts()
1186 if (rss_flags == adapter->rss_info.rss_flags) in be_set_rss_hash_opts()
1189 status = be_cmd_rss_config(adapter, adapter->rss_info.rsstable, in be_set_rss_hash_opts()
1191 adapter->rss_info.rss_hkey); in be_set_rss_hash_opts()
1193 adapter->rss_info.rss_flags = rss_flags; in be_set_rss_hash_opts()
1204 dev_err(&adapter->pdev->dev, in be_set_rxnfc()
1206 return -EINVAL; in be_set_rxnfc()
1209 switch (cmd->cmd) { in be_set_rxnfc()
1214 return -EINVAL; in be_set_rxnfc()
1224 u16 num_rx_irqs = max_t(u16, adapter->num_rss_qs, 1); in be_get_channels()
1227 ch->combined_count = min(adapter->num_tx_qs, num_rx_irqs); in be_get_channels()
1228 ch->rx_count = num_rx_irqs - ch->combined_count; in be_get_channels()
1229 ch->tx_count = adapter->num_tx_qs - ch->combined_count; in be_get_channels()
1231 ch->max_combined = be_max_qp_irqs(adapter); in be_get_channels()
1233 ch->max_rx = be_max_rx_irqs(adapter) - 1; in be_get_channels()
1234 ch->max_tx = be_max_tx_irqs(adapter) - 1; in be_get_channels()
1244 * combined and either RX-only or TX-only channels. in be_set_channels()
1246 if (ch->other_count || !ch->combined_count || in be_set_channels()
1247 (ch->rx_count && ch->tx_count)) in be_set_channels()
1248 return -EINVAL; in be_set_channels()
1250 if (ch->combined_count > be_max_qp_irqs(adapter) || in be_set_channels()
1251 (ch->rx_count && in be_set_channels()
1252 (ch->rx_count + ch->combined_count) > be_max_rx_irqs(adapter)) || in be_set_channels()
1253 (ch->tx_count && in be_set_channels()
1254 (ch->tx_count + ch->combined_count) > be_max_tx_irqs(adapter))) in be_set_channels()
1255 return -EINVAL; in be_set_channels()
1257 adapter->cfg_num_rx_irqs = ch->combined_count + ch->rx_count; in be_set_channels()
1258 adapter->cfg_num_tx_irqs = ch->combined_count + ch->tx_count; in be_set_channels()
1279 struct rss_info *rss = &adapter->rss_info; in be_get_rxfh()
1281 if (rxfh->indir) { in be_get_rxfh()
1283 rxfh->indir[i] = rss->rss_queue[i]; in be_get_rxfh()
1286 if (rxfh->key) in be_get_rxfh()
1287 memcpy(rxfh->key, rss->rss_hkey, RSS_HASH_KEY_LEN); in be_get_rxfh()
1289 rxfh->hfunc = ETH_RSS_HASH_TOP; in be_get_rxfh()
1300 u8 *hkey = rxfh->key; in be_set_rxfh()
1304 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in be_set_rxfh()
1305 rxfh->hfunc != ETH_RSS_HASH_TOP) in be_set_rxfh()
1306 return -EOPNOTSUPP; in be_set_rxfh()
1308 if (rxfh->indir) { in be_set_rxfh()
1312 j = rxfh->indir[i]; in be_set_rxfh()
1313 rxo = &adapter->rx_obj[j]; in be_set_rxfh()
1314 rsstable[i] = rxo->rss_id; in be_set_rxfh()
1315 adapter->rss_info.rss_queue[i] = j; in be_set_rxfh()
1318 memcpy(rsstable, adapter->rss_info.rsstable, in be_set_rxfh()
1323 hkey = adapter->rss_info.rss_hkey; in be_set_rxfh()
1326 adapter->rss_info.rss_flags, in be_set_rxfh()
1329 adapter->rss_info.rss_flags = RSS_ENABLE_NONE; in be_set_rxfh()
1330 return -EIO; in be_set_rxfh()
1332 memcpy(adapter->rss_info.rss_hkey, hkey, RSS_HASH_KEY_LEN); in be_set_rxfh()
1333 memcpy(adapter->rss_info.rsstable, rsstable, in be_set_rxfh()
1346 return -EOPNOTSUPP; in be_get_module_info()
1352 modinfo->type = ETH_MODULE_SFF_8079; in be_get_module_info()
1353 modinfo->eeprom_len = PAGE_DATA_LEN; in be_get_module_info()
1355 modinfo->type = ETH_MODULE_SFF_8472; in be_get_module_info()
1356 modinfo->eeprom_len = 2 * PAGE_DATA_LEN; in be_get_module_info()
1370 return -EOPNOTSUPP; in be_get_module_eeprom()
1372 begin = eeprom->offset; in be_get_module_eeprom()
1373 end = eeprom->offset + eeprom->len; in be_get_module_eeprom()
1377 min_t(u32, end, PAGE_DATA_LEN) - begin, in be_get_module_eeprom()
1382 data += PAGE_DATA_LEN - begin; in be_get_module_eeprom()
1388 begin - PAGE_DATA_LEN, in be_get_module_eeprom()
1389 end - begin, data); in be_get_module_eeprom()
1401 return adapter->priv_flags; in be_get_priv_flags()
1407 bool tpe_old = !!(adapter->priv_flags & BE_DISABLE_TPE_RECOVERY); in be_set_priv_flags()
1412 adapter->priv_flags |= BE_DISABLE_TPE_RECOVERY; in be_set_priv_flags()
1413 dev_info(&adapter->pdev->dev, in be_set_priv_flags()
1416 adapter->priv_flags &= ~BE_DISABLE_TPE_RECOVERY; in be_set_priv_flags()
1417 dev_info(&adapter->pdev->dev, in be_set_priv_flags()