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 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()
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()
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()
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()
805 struct device *dev = &adapter->pdev->dev; in be_set_wol()
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()
826 enable = wol->wolopts & WAKE_MAGIC; in be_set_wol()
828 ether_addr_copy(mac, adapter->netdev->dev_addr); 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()
1080 u64 flow_type = cmd->flow_type; in be_get_rxfh_fields()
1084 dev_info(&adapter->pdev->dev, in be_get_rxfh_fields()
1086 return -EINVAL; in be_get_rxfh_fields()
1091 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4) in be_get_rxfh_fields()
1093 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV4) in be_get_rxfh_fields()
1097 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV4) in be_get_rxfh_fields()
1099 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV4) in be_get_rxfh_fields()
1103 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6) in be_get_rxfh_fields()
1105 if (adapter->rss_info.rss_flags & RSS_ENABLE_TCP_IPV6) in be_get_rxfh_fields()
1109 if (adapter->rss_info.rss_flags & RSS_ENABLE_IPV6) in be_get_rxfh_fields()
1111 if (adapter->rss_info.rss_flags & RSS_ENABLE_UDP_IPV6) in be_get_rxfh_fields()
1116 cmd->data = data; in be_get_rxfh_fields()
1126 dev_info(&adapter->pdev->dev, in be_get_rxnfc()
1128 return -EINVAL; in be_get_rxnfc()
1131 switch (cmd->cmd) { in be_get_rxnfc()
1133 cmd->data = adapter->num_rx_qs; in be_get_rxnfc()
1136 return -EINVAL; in be_get_rxnfc()
1147 u32 rss_flags = adapter->rss_info.rss_flags; in be_set_rxfh_fields()
1151 dev_err(&adapter->pdev->dev, in be_set_rxfh_fields()
1153 return -EINVAL; in be_set_rxfh_fields()
1156 if (cmd->data != L3_RSS_FLAGS && in be_set_rxfh_fields()
1157 cmd->data != (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rxfh_fields()
1158 return -EINVAL; in be_set_rxfh_fields()
1160 switch (cmd->flow_type) { in be_set_rxfh_fields()
1162 if (cmd->data == L3_RSS_FLAGS) in be_set_rxfh_fields()
1164 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rxfh_fields()
1169 if (cmd->data == L3_RSS_FLAGS) in be_set_rxfh_fields()
1171 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rxfh_fields()
1176 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) && in be_set_rxfh_fields()
1178 return -EINVAL; in be_set_rxfh_fields()
1180 if (cmd->data == L3_RSS_FLAGS) in be_set_rxfh_fields()
1182 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rxfh_fields()
1187 if ((cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) && in be_set_rxfh_fields()
1189 return -EINVAL; in be_set_rxfh_fields()
1191 if (cmd->data == L3_RSS_FLAGS) in be_set_rxfh_fields()
1193 else if (cmd->data == (L3_RSS_FLAGS | L4_RSS_FLAGS)) in be_set_rxfh_fields()
1198 return -EINVAL; in be_set_rxfh_fields()
1201 if (rss_flags == adapter->rss_info.rss_flags) in be_set_rxfh_fields()
1204 status = be_cmd_rss_config(adapter, adapter->rss_info.rsstable, in be_set_rxfh_fields()
1206 adapter->rss_info.rss_hkey); in be_set_rxfh_fields()
1208 adapter->rss_info.rss_flags = rss_flags; in be_set_rxfh_fields()
1217 u16 num_rx_irqs = max_t(u16, adapter->num_rss_qs, 1); in be_get_channels()
1220 ch->combined_count = min(adapter->num_tx_qs, num_rx_irqs); in be_get_channels()
1221 ch->rx_count = num_rx_irqs - ch->combined_count; in be_get_channels()
1222 ch->tx_count = adapter->num_tx_qs - ch->combined_count; in be_get_channels()
1224 ch->max_combined = be_max_qp_irqs(adapter); in be_get_channels()
1226 ch->max_rx = be_max_rx_irqs(adapter) - 1; in be_get_channels()
1227 ch->max_tx = be_max_tx_irqs(adapter) - 1; in be_get_channels()
1237 * combined and either RX-only or TX-only channels. in be_set_channels()
1239 if (ch->other_count || !ch->combined_count || in be_set_channels()
1240 (ch->rx_count && ch->tx_count)) in be_set_channels()
1241 return -EINVAL; in be_set_channels()
1243 if (ch->combined_count > be_max_qp_irqs(adapter) || in be_set_channels()
1244 (ch->rx_count && in be_set_channels()
1245 (ch->rx_count + ch->combined_count) > be_max_rx_irqs(adapter)) || in be_set_channels()
1246 (ch->tx_count && in be_set_channels()
1247 (ch->tx_count + ch->combined_count) > be_max_tx_irqs(adapter))) in be_set_channels()
1248 return -EINVAL; in be_set_channels()
1250 adapter->cfg_num_rx_irqs = ch->combined_count + ch->rx_count; in be_set_channels()
1251 adapter->cfg_num_tx_irqs = ch->combined_count + ch->tx_count; in be_set_channels()
1272 struct rss_info *rss = &adapter->rss_info; in be_get_rxfh()
1274 if (rxfh->indir) { in be_get_rxfh()
1276 rxfh->indir[i] = rss->rss_queue[i]; in be_get_rxfh()
1279 if (rxfh->key) in be_get_rxfh()
1280 memcpy(rxfh->key, rss->rss_hkey, RSS_HASH_KEY_LEN); in be_get_rxfh()
1282 rxfh->hfunc = ETH_RSS_HASH_TOP; in be_get_rxfh()
1293 u8 *hkey = rxfh->key; in be_set_rxfh()
1297 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE && in be_set_rxfh()
1298 rxfh->hfunc != ETH_RSS_HASH_TOP) in be_set_rxfh()
1299 return -EOPNOTSUPP; in be_set_rxfh()
1301 if (rxfh->indir) { in be_set_rxfh()
1305 j = rxfh->indir[i]; in be_set_rxfh()
1306 rxo = &adapter->rx_obj[j]; in be_set_rxfh()
1307 rsstable[i] = rxo->rss_id; in be_set_rxfh()
1308 adapter->rss_info.rss_queue[i] = j; in be_set_rxfh()
1311 memcpy(rsstable, adapter->rss_info.rsstable, in be_set_rxfh()
1316 hkey = adapter->rss_info.rss_hkey; in be_set_rxfh()
1319 adapter->rss_info.rss_flags, in be_set_rxfh()
1322 adapter->rss_info.rss_flags = RSS_ENABLE_NONE; in be_set_rxfh()
1323 return -EIO; in be_set_rxfh()
1325 memcpy(adapter->rss_info.rss_hkey, hkey, RSS_HASH_KEY_LEN); in be_set_rxfh()
1326 memcpy(adapter->rss_info.rsstable, rsstable, in be_set_rxfh()
1339 return -EOPNOTSUPP; in be_get_module_info()
1345 modinfo->type = ETH_MODULE_SFF_8079; in be_get_module_info()
1346 modinfo->eeprom_len = PAGE_DATA_LEN; in be_get_module_info()
1348 modinfo->type = ETH_MODULE_SFF_8472; in be_get_module_info()
1349 modinfo->eeprom_len = 2 * PAGE_DATA_LEN; in be_get_module_info()
1363 return -EOPNOTSUPP; in be_get_module_eeprom()
1365 begin = eeprom->offset; in be_get_module_eeprom()
1366 end = eeprom->offset + eeprom->len; in be_get_module_eeprom()
1370 min_t(u32, end, PAGE_DATA_LEN) - begin, in be_get_module_eeprom()
1375 data += PAGE_DATA_LEN - begin; in be_get_module_eeprom()
1381 begin - PAGE_DATA_LEN, in be_get_module_eeprom()
1382 end - begin, data); in be_get_module_eeprom()
1394 return adapter->priv_flags; in be_get_priv_flags()
1400 bool tpe_old = !!(adapter->priv_flags & BE_DISABLE_TPE_RECOVERY); 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()
1409 adapter->priv_flags &= ~BE_DISABLE_TPE_RECOVERY; in be_set_priv_flags()
1410 dev_info(&adapter->pdev->dev, in be_set_priv_flags()