Lines Matching +full:mac +full:- +full:wol
14 * - Redistributions of source code must retain the above
18 * - Redistributions in binary form must reproduce the above
57 for (i = 0; i < priv->tx_ring_num[t]; i++) { in mlx4_en_moderation_update()
58 priv->tx_cq[t][i]->moder_cnt = priv->tx_frames; in mlx4_en_moderation_update()
59 priv->tx_cq[t][i]->moder_time = priv->tx_usecs; in mlx4_en_moderation_update()
60 if (priv->port_up) { in mlx4_en_moderation_update()
62 priv->tx_cq[t][i]); in mlx4_en_moderation_update()
69 if (priv->adaptive_rx_coal) in mlx4_en_moderation_update()
72 for (i = 0; i < priv->rx_ring_num; i++) { in mlx4_en_moderation_update()
73 priv->rx_cq[i]->moder_cnt = priv->rx_frames; in mlx4_en_moderation_update()
74 priv->rx_cq[i]->moder_time = priv->rx_usecs; in mlx4_en_moderation_update()
75 priv->last_moder_time[i] = MLX4_EN_AUTO_CONF; in mlx4_en_moderation_update()
76 if (priv->port_up) { in mlx4_en_moderation_update()
77 err = mlx4_en_set_cq_moder(priv, priv->rx_cq[i]); in mlx4_en_moderation_update()
90 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_get_drvinfo()
92 strscpy(drvinfo->driver, DRV_NAME, sizeof(drvinfo->driver)); in mlx4_en_get_drvinfo()
93 strscpy(drvinfo->version, DRV_VERSION, in mlx4_en_get_drvinfo()
94 sizeof(drvinfo->version)); in mlx4_en_get_drvinfo()
95 snprintf(drvinfo->fw_version, sizeof(drvinfo->fw_version), in mlx4_en_get_drvinfo()
97 (u16) (mdev->dev->caps.fw_ver >> 32), in mlx4_en_get_drvinfo()
98 (u16) ((mdev->dev->caps.fw_ver >> 16) & 0xffff), in mlx4_en_get_drvinfo()
99 (u16) (mdev->dev->caps.fw_ver & 0xffff)); in mlx4_en_get_drvinfo()
100 strscpy(drvinfo->bus_info, pci_name(mdev->dev->persist->pdev), in mlx4_en_get_drvinfo()
101 sizeof(drvinfo->bus_info)); in mlx4_en_get_drvinfo()
106 "phv-bit"
221 return ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable; in mlx4_en_get_msglevel()
226 ((struct mlx4_en_priv *) netdev_priv(dev))->msg_enable = val; in mlx4_en_set_msglevel()
230 struct ethtool_wolinfo *wol) in mlx4_en_get_wol() argument
233 struct mlx4_caps *caps = &priv->mdev->dev->caps; in mlx4_en_get_wol()
238 if ((priv->port < 1) || (priv->port > 2)) { in mlx4_en_get_wol()
239 en_err(priv, "Failed to get WoL information\n"); in mlx4_en_get_wol()
243 mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 : in mlx4_en_get_wol()
246 if (!(caps->flags & mask)) { in mlx4_en_get_wol()
247 wol->supported = 0; in mlx4_en_get_wol()
248 wol->wolopts = 0; in mlx4_en_get_wol()
252 if (caps->wol_port[priv->port]) in mlx4_en_get_wol()
253 wol->supported = WAKE_MAGIC; in mlx4_en_get_wol()
255 wol->supported = 0; in mlx4_en_get_wol()
257 err = mlx4_wol_read(priv->mdev->dev, &config, priv->port); in mlx4_en_get_wol()
259 en_err(priv, "Failed to get WoL information\n"); in mlx4_en_get_wol()
264 wol->wolopts = WAKE_MAGIC; in mlx4_en_get_wol()
266 wol->wolopts = 0; in mlx4_en_get_wol()
270 struct ethtool_wolinfo *wol) in mlx4_en_set_wol() argument
277 if ((priv->port < 1) || (priv->port > 2)) in mlx4_en_set_wol()
278 return -EOPNOTSUPP; in mlx4_en_set_wol()
280 mask = (priv->port == 1) ? MLX4_DEV_CAP_FLAG_WOL_PORT1 : in mlx4_en_set_wol()
283 if (!(priv->mdev->dev->caps.flags & mask)) in mlx4_en_set_wol()
284 return -EOPNOTSUPP; in mlx4_en_set_wol()
286 if (wol->supported & ~WAKE_MAGIC) in mlx4_en_set_wol()
287 return -EINVAL; in mlx4_en_set_wol()
289 err = mlx4_wol_read(priv->mdev->dev, &config, priv->port); in mlx4_en_set_wol()
291 en_err(priv, "Failed to get WoL info, unable to modify\n"); in mlx4_en_set_wol()
295 if (wol->wolopts & WAKE_MAGIC) { in mlx4_en_set_wol()
303 err = mlx4_wol_write(priv->mdev->dev, config, priv->port); in mlx4_en_set_wol()
305 en_err(priv, "Failed to set WoL information\n"); in mlx4_en_set_wol()
321 h->iterator = 0; in bitmap_iterator_init()
322 h->advance_array = !bitmap_empty(stats_bitmap, count); in bitmap_iterator_init()
323 h->count = h->advance_array ? bitmap_weight(stats_bitmap, count) in bitmap_iterator_init()
325 h->stats_bitmap = stats_bitmap; in bitmap_iterator_init()
330 return !h->advance_array ? 1 : test_bit(h->iterator, h->stats_bitmap); in bitmap_iterator_test()
335 return h->iterator++; in bitmap_iterator_inc()
341 return h->count; in bitmap_iterator_count()
349 bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); in mlx4_en_get_sset_count()
354 (priv->tx_ring_num[TX] * 2) + in mlx4_en_get_sset_count()
355 (priv->rx_ring_num * (3 + NUM_XDP_STATS)); in mlx4_en_get_sset_count()
357 return MLX4_EN_NUM_SELF_TEST - !(priv->mdev->dev->caps.flags in mlx4_en_get_sset_count()
362 return -EOPNOTSUPP; in mlx4_en_get_sset_count()
374 bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); in mlx4_en_get_ethtool_stats()
376 spin_lock_bh(&priv->stats_lock); in mlx4_en_get_ethtool_stats()
382 data[index++] = ((unsigned long *)&dev->stats)[i]; in mlx4_en_get_ethtool_stats()
386 data[index++] = ((unsigned long *)&priv->port_stats)[i]; in mlx4_en_get_ethtool_stats()
391 ((unsigned long *)&priv->pf_stats)[i]; in mlx4_en_get_ethtool_stats()
397 ((u64 *)&priv->rx_priority_flowstats)[i]; in mlx4_en_get_ethtool_stats()
401 data[index++] = ((u64 *)&priv->rx_flowstats)[i]; in mlx4_en_get_ethtool_stats()
407 ((u64 *)&priv->tx_priority_flowstats)[i]; in mlx4_en_get_ethtool_stats()
411 data[index++] = ((u64 *)&priv->tx_flowstats)[i]; in mlx4_en_get_ethtool_stats()
415 data[index++] = ((unsigned long *)&priv->pkstats)[i]; in mlx4_en_get_ethtool_stats()
419 data[index++] = ((unsigned long *)&priv->xdp_stats)[i]; in mlx4_en_get_ethtool_stats()
423 data[index++] = ((unsigned long *)&priv->phy_stats)[i]; in mlx4_en_get_ethtool_stats()
425 for (i = 0; i < priv->tx_ring_num[TX]; i++) { in mlx4_en_get_ethtool_stats()
426 data[index++] = priv->tx_ring[TX][i]->packets; in mlx4_en_get_ethtool_stats()
427 data[index++] = priv->tx_ring[TX][i]->bytes; in mlx4_en_get_ethtool_stats()
429 for (i = 0; i < priv->rx_ring_num; i++) { in mlx4_en_get_ethtool_stats()
430 data[index++] = priv->rx_ring[i]->packets; in mlx4_en_get_ethtool_stats()
431 data[index++] = priv->rx_ring[i]->bytes; in mlx4_en_get_ethtool_stats()
432 data[index++] = priv->rx_ring[i]->dropped; in mlx4_en_get_ethtool_stats()
433 data[index++] = priv->rx_ring[i]->xdp_drop; in mlx4_en_get_ethtool_stats()
434 data[index++] = priv->rx_ring[i]->xdp_redirect; in mlx4_en_get_ethtool_stats()
435 data[index++] = priv->rx_ring[i]->xdp_redirect_fail; in mlx4_en_get_ethtool_stats()
436 data[index++] = priv->rx_ring[i]->xdp_tx; in mlx4_en_get_ethtool_stats()
437 data[index++] = priv->rx_ring[i]->xdp_tx_full; in mlx4_en_get_ethtool_stats()
439 spin_unlock_bh(&priv->stats_lock); in mlx4_en_get_ethtool_stats()
446 mlx4_en_ex_selftest(dev, &etest->flags, buf); in mlx4_en_self_test()
456 bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); in mlx4_en_get_strings()
460 for (i = 0; i < MLX4_EN_NUM_SELF_TEST - 2; i++) in mlx4_en_get_strings()
462 if (priv->mdev->dev->caps.flags & MLX4_DEV_CAP_FLAG_UC_LOOPBACK) in mlx4_en_get_strings()
504 for (i = 0; i < priv->tx_ring_num[TX]; i++) { in mlx4_en_get_strings()
508 for (i = 0; i < priv->rx_ring_num; i++) { in mlx4_en_get_strings()
530 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_autoneg_get()
533 if ((mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETH_BACKPL_AN_REP) && in mlx4_en_autoneg_get()
534 (priv->port_state.flags & MLX4_EN_PORT_ANE)) in mlx4_en_autoneg_get()
543 u32 eth_proto = be32_to_cpu(ptys_reg->eth_proto_cap); in ptys2ethtool_update_supported_port()
568 u32 eth_proto = be32_to_cpu(ptys_reg->eth_proto_oper); in ptys_get_active_port()
571 eth_proto = be32_to_cpu(ptys_reg->eth_proto_cap); in ptys_get_active_port()
622 return cfg->supported; in ptys2ethtool_link_mode()
624 return cfg->advertised; in ptys2ethtool_link_mode()
635 cfg->speed = speed_; \
636 linkmode_zero(cfg->supported); \
637 linkmode_zero(cfg->advertised); \
639 __set_bit(modes[i], cfg->supported); \
640 __set_bit(modes[i], cfg->advertised); \
736 ptys_reg.local_port = priv->port; in ethtool_get_ptys_link_ksettings()
738 ret = mlx4_ACCESS_PTYS_REG(priv->mdev->dev, in ethtool_get_ptys_link_ksettings()
760 ptys2ethtool_update_supported_port(link_ksettings->link_modes.supported, in ethtool_get_ptys_link_ksettings()
764 ptys2ethtool_update_link_modes(link_ksettings->link_modes.supported, in ethtool_get_ptys_link_ksettings()
768 ptys2ethtool_update_link_modes(link_ksettings->link_modes.advertising, in ethtool_get_ptys_link_ksettings()
776 if (priv->prof->tx_pause) in ethtool_get_ptys_link_ksettings()
779 if (priv->prof->tx_pause ^ priv->prof->rx_pause) in ethtool_get_ptys_link_ksettings()
783 link_ksettings->base.port = ptys_get_active_port(&ptys_reg); in ethtool_get_ptys_link_ksettings()
792 link_ksettings->base.autoneg in ethtool_get_ptys_link_ksettings()
793 = (priv->port_state.flags & MLX4_EN_PORT_ANC) ? in ethtool_get_ptys_link_ksettings()
800 link_ksettings->link_modes.lp_advertising, in ethtool_get_ptys_link_ksettings()
802 if (priv->port_state.flags & MLX4_EN_PORT_ANC) in ethtool_get_ptys_link_ksettings()
806 link_ksettings->base.phy_address = 0; in ethtool_get_ptys_link_ksettings()
807 link_ksettings->base.mdio_support = 0; in ethtool_get_ptys_link_ksettings()
808 link_ksettings->base.eth_tp_mdix = ETH_TP_MDI_INVALID; in ethtool_get_ptys_link_ksettings()
809 link_ksettings->base.eth_tp_mdix_ctrl = ETH_TP_MDI_AUTO; in ethtool_get_ptys_link_ksettings()
821 link_ksettings->base.autoneg = AUTONEG_DISABLE; in ethtool_get_default_link_ksettings()
831 trans_type = priv->port_state.transceiver; in ethtool_get_default_link_ksettings()
833 link_ksettings->base.port = PORT_FIBRE; in ethtool_get_default_link_ksettings()
839 link_ksettings->base.port = PORT_TP; in ethtool_get_default_link_ksettings()
845 link_ksettings->base.port = -1; in ethtool_get_default_link_ksettings()
854 int ret = -EINVAL; in mlx4_en_get_link_ksettings()
856 if (mlx4_en_QUERY_PORT(priv->mdev, priv->port)) in mlx4_en_get_link_ksettings()
857 return -ENOMEM; in mlx4_en_get_link_ksettings()
860 priv->port_state.flags & MLX4_EN_PORT_ANC, in mlx4_en_get_link_ksettings()
861 priv->port_state.flags & MLX4_EN_PORT_ANE); in mlx4_en_get_link_ksettings()
863 if (priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_ETH_PROT_CTRL) in mlx4_en_get_link_ksettings()
869 link_ksettings->base.speed = priv->port_state.link_speed; in mlx4_en_get_link_ksettings()
870 link_ksettings->base.duplex = DUPLEX_FULL; in mlx4_en_get_link_ksettings()
872 link_ksettings->base.speed = SPEED_UNKNOWN; in mlx4_en_get_link_ksettings()
873 link_ksettings->base.duplex = DUPLEX_UNKNOWN; in mlx4_en_get_link_ksettings()
908 link_ksettings->link_modes.advertising, ADVERTISED); in mlx4_en_set_link_ksettings()
909 const int speed = link_ksettings->base.speed; in mlx4_en_set_link_ksettings()
914 link_ksettings->link_modes.advertising, in mlx4_en_set_link_ksettings()
915 link_ksettings->base.autoneg, in mlx4_en_set_link_ksettings()
916 link_ksettings->base.duplex); in mlx4_en_set_link_ksettings()
918 if (!(priv->mdev->dev->caps.flags2 & in mlx4_en_set_link_ksettings()
920 (link_ksettings->base.duplex == DUPLEX_HALF)) in mlx4_en_set_link_ksettings()
921 return -EINVAL; in mlx4_en_set_link_ksettings()
924 ptys_reg.local_port = priv->port; in mlx4_en_set_link_ksettings()
926 ret = mlx4_ACCESS_PTYS_REG(priv->mdev->dev, in mlx4_en_set_link_ksettings()
937 if (link_ksettings->base.autoneg == AUTONEG_DISABLE) { in mlx4_en_set_link_ksettings()
953 return -EINVAL; /* nothing to change due to bad input */ in mlx4_en_set_link_ksettings()
958 (link_ksettings->base.autoneg == cur_autoneg))) in mlx4_en_set_link_ksettings()
965 ret = mlx4_ACCESS_PTYS_REG(priv->mdev->dev, MLX4_ACCESS_REG_WRITE, in mlx4_en_set_link_ksettings()
973 mutex_lock(&priv->mdev->state_lock); in mlx4_en_set_link_ksettings()
974 if (priv->port_up) { in mlx4_en_set_link_ksettings()
978 en_err(priv, "Failed restarting port %d\n", priv->port); in mlx4_en_set_link_ksettings()
980 mutex_unlock(&priv->mdev->state_lock); in mlx4_en_set_link_ksettings()
991 coal->tx_coalesce_usecs = priv->tx_usecs; in mlx4_en_get_coalesce()
992 coal->tx_max_coalesced_frames = priv->tx_frames; in mlx4_en_get_coalesce()
993 coal->tx_max_coalesced_frames_irq = priv->tx_work_limit; in mlx4_en_get_coalesce()
995 coal->rx_coalesce_usecs = priv->rx_usecs; in mlx4_en_get_coalesce()
996 coal->rx_max_coalesced_frames = priv->rx_frames; in mlx4_en_get_coalesce()
998 coal->pkt_rate_low = priv->pkt_rate_low; in mlx4_en_get_coalesce()
999 coal->rx_coalesce_usecs_low = priv->rx_usecs_low; in mlx4_en_get_coalesce()
1000 coal->pkt_rate_high = priv->pkt_rate_high; in mlx4_en_get_coalesce()
1001 coal->rx_coalesce_usecs_high = priv->rx_usecs_high; in mlx4_en_get_coalesce()
1002 coal->rate_sample_interval = priv->sample_interval; in mlx4_en_get_coalesce()
1003 coal->use_adaptive_rx_coalesce = priv->adaptive_rx_coal; in mlx4_en_get_coalesce()
1015 if (!coal->tx_max_coalesced_frames_irq) in mlx4_en_set_coalesce()
1016 return -EINVAL; in mlx4_en_set_coalesce()
1018 if (coal->tx_coalesce_usecs > MLX4_EN_MAX_COAL_TIME || in mlx4_en_set_coalesce()
1019 coal->rx_coalesce_usecs > MLX4_EN_MAX_COAL_TIME || in mlx4_en_set_coalesce()
1020 coal->rx_coalesce_usecs_low > MLX4_EN_MAX_COAL_TIME || in mlx4_en_set_coalesce()
1021 coal->rx_coalesce_usecs_high > MLX4_EN_MAX_COAL_TIME) { in mlx4_en_set_coalesce()
1024 return -ERANGE; in mlx4_en_set_coalesce()
1027 if (coal->tx_max_coalesced_frames > MLX4_EN_MAX_COAL_PKTS || in mlx4_en_set_coalesce()
1028 coal->rx_max_coalesced_frames > MLX4_EN_MAX_COAL_PKTS) { in mlx4_en_set_coalesce()
1031 return -ERANGE; in mlx4_en_set_coalesce()
1034 priv->rx_frames = (coal->rx_max_coalesced_frames == in mlx4_en_set_coalesce()
1037 coal->rx_max_coalesced_frames; in mlx4_en_set_coalesce()
1038 priv->rx_usecs = (coal->rx_coalesce_usecs == in mlx4_en_set_coalesce()
1041 coal->rx_coalesce_usecs; in mlx4_en_set_coalesce()
1044 if (coal->tx_coalesce_usecs != priv->tx_usecs || in mlx4_en_set_coalesce()
1045 coal->tx_max_coalesced_frames != priv->tx_frames) { in mlx4_en_set_coalesce()
1046 priv->tx_usecs = coal->tx_coalesce_usecs; in mlx4_en_set_coalesce()
1047 priv->tx_frames = coal->tx_max_coalesced_frames; in mlx4_en_set_coalesce()
1051 priv->pkt_rate_low = coal->pkt_rate_low; in mlx4_en_set_coalesce()
1052 priv->rx_usecs_low = coal->rx_coalesce_usecs_low; in mlx4_en_set_coalesce()
1053 priv->pkt_rate_high = coal->pkt_rate_high; in mlx4_en_set_coalesce()
1054 priv->rx_usecs_high = coal->rx_coalesce_usecs_high; in mlx4_en_set_coalesce()
1055 priv->sample_interval = coal->rate_sample_interval; in mlx4_en_set_coalesce()
1056 priv->adaptive_rx_coal = coal->use_adaptive_rx_coalesce; in mlx4_en_set_coalesce()
1057 priv->tx_work_limit = coal->tx_max_coalesced_frames_irq; in mlx4_en_set_coalesce()
1066 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_set_pauseparam()
1070 if (pause->autoneg) in mlx4_en_set_pauseparam()
1071 return -EINVAL; in mlx4_en_set_pauseparam()
1073 tx_pause = !!(pause->tx_pause); in mlx4_en_set_pauseparam()
1074 rx_pause = !!(pause->rx_pause); in mlx4_en_set_pauseparam()
1075 rx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->rx_ppp; in mlx4_en_set_pauseparam()
1076 tx_ppp = (tx_pause || rx_pause) ? 0 : priv->prof->tx_ppp; in mlx4_en_set_pauseparam()
1078 err = mlx4_SET_PORT_general(mdev->dev, priv->port, in mlx4_en_set_pauseparam()
1079 priv->rx_skb_size + ETH_FCS_LEN, in mlx4_en_set_pauseparam()
1086 mlx4_en_update_pfc_stats_bitmap(mdev->dev, &priv->stats_bitmap, in mlx4_en_set_pauseparam()
1089 priv->prof->tx_pause = tx_pause; in mlx4_en_set_pauseparam()
1090 priv->prof->rx_pause = rx_pause; in mlx4_en_set_pauseparam()
1091 priv->prof->tx_ppp = tx_ppp; in mlx4_en_set_pauseparam()
1092 priv->prof->rx_ppp = rx_ppp; in mlx4_en_set_pauseparam()
1103 bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); in mlx4_en_get_pause_stats()
1105 spin_lock_bh(&priv->stats_lock); in mlx4_en_get_pause_stats()
1107 priv->stats_bitmap.bitmap)) in mlx4_en_get_pause_stats()
1108 stats->tx_pause_frames = priv->tx_flowstats.tx_pause; in mlx4_en_get_pause_stats()
1110 priv->stats_bitmap.bitmap)) in mlx4_en_get_pause_stats()
1111 stats->rx_pause_frames = priv->rx_flowstats.rx_pause; in mlx4_en_get_pause_stats()
1112 spin_unlock_bh(&priv->stats_lock); in mlx4_en_get_pause_stats()
1120 pause->tx_pause = priv->prof->tx_pause; in mlx4_en_get_pauseparam()
1121 pause->rx_pause = priv->prof->rx_pause; in mlx4_en_get_pauseparam()
1130 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_set_ringparam()
1137 if (param->rx_jumbo_pending || param->rx_mini_pending) in mlx4_en_set_ringparam()
1138 return -EINVAL; in mlx4_en_set_ringparam()
1140 if (param->rx_pending < MLX4_EN_MIN_RX_SIZE) { in mlx4_en_set_ringparam()
1142 __func__, param->rx_pending, in mlx4_en_set_ringparam()
1144 return -EINVAL; in mlx4_en_set_ringparam()
1146 if (param->tx_pending < MLX4_EN_MIN_TX_SIZE) { in mlx4_en_set_ringparam()
1148 __func__, param->tx_pending, in mlx4_en_set_ringparam()
1150 return -EINVAL; in mlx4_en_set_ringparam()
1153 rx_size = roundup_pow_of_two(param->rx_pending); in mlx4_en_set_ringparam()
1154 tx_size = roundup_pow_of_two(param->tx_pending); in mlx4_en_set_ringparam()
1156 if (rx_size == (priv->port_up ? priv->rx_ring[0]->actual_size : in mlx4_en_set_ringparam()
1157 priv->rx_ring[0]->size) && in mlx4_en_set_ringparam()
1158 tx_size == priv->tx_ring[TX][0]->size) in mlx4_en_set_ringparam()
1163 return -ENOMEM; in mlx4_en_set_ringparam()
1165 mutex_lock(&mdev->state_lock); in mlx4_en_set_ringparam()
1166 memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); in mlx4_en_set_ringparam()
1173 if (priv->port_up) { in mlx4_en_set_ringparam()
1189 mutex_unlock(&mdev->state_lock); in mlx4_en_set_ringparam()
1201 param->rx_max_pending = MLX4_EN_MAX_RX_SIZE; in mlx4_en_get_ringparam()
1202 param->tx_max_pending = MLX4_EN_MAX_TX_SIZE; in mlx4_en_get_ringparam()
1203 param->rx_pending = priv->port_up ? in mlx4_en_get_ringparam()
1204 priv->rx_ring[0]->actual_size : priv->rx_ring[0]->size; in mlx4_en_get_ringparam()
1205 param->tx_pending = priv->tx_ring[TX][0]->size; in mlx4_en_get_ringparam()
1212 return rounddown_pow_of_two(priv->rx_ring_num); in mlx4_en_get_rxfh_indir_size()
1226 if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_TOP)) in mlx4_en_check_rxfh_func()
1227 return -EINVAL; in mlx4_en_check_rxfh_func()
1228 if (!(dev->features & NETIF_F_RXHASH)) in mlx4_en_check_rxfh_func()
1232 if (!(priv->mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_RSS_XOR)) in mlx4_en_check_rxfh_func()
1233 return -EINVAL; in mlx4_en_check_rxfh_func()
1234 if (dev->features & NETIF_F_RXHASH) in mlx4_en_check_rxfh_func()
1239 return -EINVAL; in mlx4_en_check_rxfh_func()
1249 rss_rings = priv->prof->rss_rings ?: n; in mlx4_en_get_rxfh()
1253 if (!rxfh->indir) in mlx4_en_get_rxfh()
1255 rxfh->indir[i] = i % rss_rings; in mlx4_en_get_rxfh()
1257 if (rxfh->key) in mlx4_en_get_rxfh()
1258 memcpy(rxfh->key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE); in mlx4_en_get_rxfh()
1259 rxfh->hfunc = priv->rss_hash_fn; in mlx4_en_get_rxfh()
1269 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_set_rxfh()
1279 if (!rxfh->indir) in mlx4_en_set_rxfh()
1281 if (i > 0 && !rxfh->indir[i] && !rss_rings) in mlx4_en_set_rxfh()
1284 if (rxfh->indir[i] != (i % (rss_rings ?: n))) in mlx4_en_set_rxfh()
1285 return -EINVAL; in mlx4_en_set_rxfh()
1293 return -EINVAL; in mlx4_en_set_rxfh()
1295 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE) { in mlx4_en_set_rxfh()
1296 err = mlx4_en_check_rxfh_func(dev, rxfh->hfunc); in mlx4_en_set_rxfh()
1301 mutex_lock(&mdev->state_lock); in mlx4_en_set_rxfh()
1302 if (priv->port_up) { in mlx4_en_set_rxfh()
1307 if (rxfh->indir) in mlx4_en_set_rxfh()
1308 priv->prof->rss_rings = rss_rings; in mlx4_en_set_rxfh()
1309 if (rxfh->key) in mlx4_en_set_rxfh()
1310 memcpy(priv->rss_key, rxfh->key, MLX4_EN_RSS_KEY_SIZE); in mlx4_en_set_rxfh()
1311 if (rxfh->hfunc != ETH_RSS_HASH_NO_CHANGE) in mlx4_en_set_rxfh()
1312 priv->rss_hash_fn = rxfh->hfunc; in mlx4_en_set_rxfh()
1320 mutex_unlock(&mdev->state_lock); in mlx4_en_set_rxfh()
1325 ((field) == 0 || (field) == (__force typeof(field))-1)
1334 if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) in mlx4_en_validate_flow()
1335 return -EINVAL; in mlx4_en_validate_flow()
1337 if (cmd->fs.flow_type & FLOW_MAC_EXT) { in mlx4_en_validate_flow()
1338 /* dest mac mask must be ff:ff:ff:ff:ff:ff */ in mlx4_en_validate_flow()
1339 if (!is_broadcast_ether_addr(cmd->fs.m_ext.h_dest)) in mlx4_en_validate_flow()
1340 return -EINVAL; in mlx4_en_validate_flow()
1343 switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { in mlx4_en_validate_flow()
1346 if (cmd->fs.m_u.tcp_ip4_spec.tos) in mlx4_en_validate_flow()
1347 return -EINVAL; in mlx4_en_validate_flow()
1348 l4_mask = &cmd->fs.m_u.tcp_ip4_spec; in mlx4_en_validate_flow()
1350 if (!all_zeros_or_all_ones(l4_mask->ip4src) || in mlx4_en_validate_flow()
1351 !all_zeros_or_all_ones(l4_mask->ip4dst) || in mlx4_en_validate_flow()
1352 !all_zeros_or_all_ones(l4_mask->psrc) || in mlx4_en_validate_flow()
1353 !all_zeros_or_all_ones(l4_mask->pdst)) in mlx4_en_validate_flow()
1354 return -EINVAL; in mlx4_en_validate_flow()
1357 l3_mask = &cmd->fs.m_u.usr_ip4_spec; in mlx4_en_validate_flow()
1358 if (l3_mask->l4_4_bytes || l3_mask->tos || l3_mask->proto || in mlx4_en_validate_flow()
1359 cmd->fs.h_u.usr_ip4_spec.ip_ver != ETH_RX_NFC_IP4 || in mlx4_en_validate_flow()
1360 (!l3_mask->ip4src && !l3_mask->ip4dst) || in mlx4_en_validate_flow()
1361 !all_zeros_or_all_ones(l3_mask->ip4src) || in mlx4_en_validate_flow()
1362 !all_zeros_or_all_ones(l3_mask->ip4dst)) in mlx4_en_validate_flow()
1363 return -EINVAL; in mlx4_en_validate_flow()
1366 eth_mask = &cmd->fs.m_u.ether_spec; in mlx4_en_validate_flow()
1367 /* source mac mask must not be set */ in mlx4_en_validate_flow()
1368 if (!is_zero_ether_addr(eth_mask->h_source)) in mlx4_en_validate_flow()
1369 return -EINVAL; in mlx4_en_validate_flow()
1371 /* dest mac mask must be ff:ff:ff:ff:ff:ff */ in mlx4_en_validate_flow()
1372 if (!is_broadcast_ether_addr(eth_mask->h_dest)) in mlx4_en_validate_flow()
1373 return -EINVAL; in mlx4_en_validate_flow()
1375 if (!all_zeros_or_all_ones(eth_mask->h_proto)) in mlx4_en_validate_flow()
1376 return -EINVAL; in mlx4_en_validate_flow()
1379 return -EINVAL; in mlx4_en_validate_flow()
1382 if ((cmd->fs.flow_type & FLOW_EXT)) { in mlx4_en_validate_flow()
1383 if (cmd->fs.m_ext.vlan_etype || in mlx4_en_validate_flow()
1384 !((cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) == in mlx4_en_validate_flow()
1386 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK)) == in mlx4_en_validate_flow()
1388 return -EINVAL; in mlx4_en_validate_flow()
1390 if (cmd->fs.m_ext.vlan_tci) { in mlx4_en_validate_flow()
1391 if (be16_to_cpu(cmd->fs.h_ext.vlan_tci) >= VLAN_N_VID) in mlx4_en_validate_flow()
1392 return -EINVAL; in mlx4_en_validate_flow()
1403 unsigned char *mac) in mlx4_en_ethtool_add_mac_rule() argument
1407 spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH; in mlx4_en_ethtool_add_mac_rule()
1408 memcpy(spec_l2->eth.dst_mac_msk, &mac_msk, ETH_ALEN); in mlx4_en_ethtool_add_mac_rule()
1409 memcpy(spec_l2->eth.dst_mac, mac, ETH_ALEN); in mlx4_en_ethtool_add_mac_rule()
1411 if ((cmd->fs.flow_type & FLOW_EXT) && in mlx4_en_ethtool_add_mac_rule()
1412 (cmd->fs.m_ext.vlan_tci & cpu_to_be16(VLAN_VID_MASK))) { in mlx4_en_ethtool_add_mac_rule()
1413 spec_l2->eth.vlan_id = cmd->fs.h_ext.vlan_tci; in mlx4_en_ethtool_add_mac_rule()
1414 spec_l2->eth.vlan_id_msk = cpu_to_be16(VLAN_VID_MASK); in mlx4_en_ethtool_add_mac_rule()
1417 list_add_tail(&spec_l2->list, rule_list_h); in mlx4_en_ethtool_add_mac_rule()
1429 unsigned char mac[ETH_ALEN]; in mlx4_en_ethtool_add_mac_rule_by_ipv4() local
1432 if (cmd->fs.flow_type & FLOW_MAC_EXT) in mlx4_en_ethtool_add_mac_rule_by_ipv4()
1433 memcpy(&mac, cmd->fs.h_ext.h_dest, ETH_ALEN); in mlx4_en_ethtool_add_mac_rule_by_ipv4()
1435 memcpy(&mac, priv->dev->dev_addr, ETH_ALEN); in mlx4_en_ethtool_add_mac_rule_by_ipv4()
1437 ip_eth_mc_map(ipv4_dst, mac); in mlx4_en_ethtool_add_mac_rule_by_ipv4()
1440 return mlx4_en_ethtool_add_mac_rule(cmd, rule_list_h, spec_l2, &mac[0]); in mlx4_en_ethtool_add_mac_rule_by_ipv4()
1442 return -EINVAL; in mlx4_en_ethtool_add_mac_rule_by_ipv4()
1453 struct ethtool_usrip4_spec *l3_mask = &cmd->fs.m_u.usr_ip4_spec; in add_ip_rule()
1458 err = -ENOMEM; in add_ip_rule()
1463 cmd->fs.h_u. in add_ip_rule()
1467 spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4; in add_ip_rule()
1468 spec_l3->ipv4.src_ip = cmd->fs.h_u.usr_ip4_spec.ip4src; in add_ip_rule()
1469 if (l3_mask->ip4src) in add_ip_rule()
1470 spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK; in add_ip_rule()
1471 spec_l3->ipv4.dst_ip = cmd->fs.h_u.usr_ip4_spec.ip4dst; in add_ip_rule()
1472 if (l3_mask->ip4dst) in add_ip_rule()
1473 spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK; in add_ip_rule()
1474 list_add_tail(&spec_l3->list, list_h); in add_ip_rule()
1492 struct ethtool_tcpip4_spec *l4_mask = &cmd->fs.m_u.tcp_ip4_spec; in add_tcp_udp_rule()
1498 err = -ENOMEM; in add_tcp_udp_rule()
1502 spec_l3->id = MLX4_NET_TRANS_RULE_ID_IPV4; in add_tcp_udp_rule()
1507 cmd->fs.h_u. in add_tcp_udp_rule()
1511 spec_l4->id = MLX4_NET_TRANS_RULE_ID_TCP; in add_tcp_udp_rule()
1512 spec_l3->ipv4.src_ip = cmd->fs.h_u.tcp_ip4_spec.ip4src; in add_tcp_udp_rule()
1513 spec_l3->ipv4.dst_ip = cmd->fs.h_u.tcp_ip4_spec.ip4dst; in add_tcp_udp_rule()
1514 spec_l4->tcp_udp.src_port = cmd->fs.h_u.tcp_ip4_spec.psrc; in add_tcp_udp_rule()
1515 spec_l4->tcp_udp.dst_port = cmd->fs.h_u.tcp_ip4_spec.pdst; in add_tcp_udp_rule()
1519 cmd->fs.h_u. in add_tcp_udp_rule()
1523 spec_l4->id = MLX4_NET_TRANS_RULE_ID_UDP; in add_tcp_udp_rule()
1524 spec_l3->ipv4.src_ip = cmd->fs.h_u.udp_ip4_spec.ip4src; in add_tcp_udp_rule()
1525 spec_l3->ipv4.dst_ip = cmd->fs.h_u.udp_ip4_spec.ip4dst; in add_tcp_udp_rule()
1526 spec_l4->tcp_udp.src_port = cmd->fs.h_u.udp_ip4_spec.psrc; in add_tcp_udp_rule()
1527 spec_l4->tcp_udp.dst_port = cmd->fs.h_u.udp_ip4_spec.pdst; in add_tcp_udp_rule()
1530 if (l4_mask->ip4src) in add_tcp_udp_rule()
1531 spec_l3->ipv4.src_ip_msk = EN_ETHTOOL_WORD_MASK; in add_tcp_udp_rule()
1532 if (l4_mask->ip4dst) in add_tcp_udp_rule()
1533 spec_l3->ipv4.dst_ip_msk = EN_ETHTOOL_WORD_MASK; in add_tcp_udp_rule()
1535 if (l4_mask->psrc) in add_tcp_udp_rule()
1536 spec_l4->tcp_udp.src_port_msk = EN_ETHTOOL_SHORT_MASK; in add_tcp_udp_rule()
1537 if (l4_mask->pdst) in add_tcp_udp_rule()
1538 spec_l4->tcp_udp.dst_port_msk = EN_ETHTOOL_SHORT_MASK; in add_tcp_udp_rule()
1540 list_add_tail(&spec_l3->list, list_h); in add_tcp_udp_rule()
1541 list_add_tail(&spec_l4->list, list_h); in add_tcp_udp_rule()
1565 switch (cmd->fs.flow_type & ~(FLOW_EXT | FLOW_MAC_EXT)) { in mlx4_en_ethtool_to_net_trans_rule()
1569 return -ENOMEM; in mlx4_en_ethtool_to_net_trans_rule()
1571 eth_spec = &cmd->fs.h_u.ether_spec; in mlx4_en_ethtool_to_net_trans_rule()
1573 ð_spec->h_dest[0]); in mlx4_en_ethtool_to_net_trans_rule()
1574 spec_l2->eth.ether_type = eth_spec->h_proto; in mlx4_en_ethtool_to_net_trans_rule()
1575 if (eth_spec->h_proto) in mlx4_en_ethtool_to_net_trans_rule()
1576 spec_l2->eth.ether_type_enable = 1; in mlx4_en_ethtool_to_net_trans_rule()
1609 rule.port = priv->port; in mlx4_en_flow_replace()
1610 rule.priority = MLX4_DOMAIN_ETHTOOL | cmd->fs.location; in mlx4_en_flow_replace()
1614 if (cmd->fs.ring_cookie == RX_CLS_FLOW_DISC) in mlx4_en_flow_replace()
1615 qpn = priv->drop_qp.qpn; in mlx4_en_flow_replace()
1616 else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { in mlx4_en_flow_replace()
1617 qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); in mlx4_en_flow_replace()
1619 if (cmd->fs.ring_cookie >= priv->rx_ring_num) { in mlx4_en_flow_replace()
1621 cmd->fs.ring_cookie); in mlx4_en_flow_replace()
1622 return -EINVAL; in mlx4_en_flow_replace()
1624 qpn = priv->rss_map.qps[cmd->fs.ring_cookie].qpn; in mlx4_en_flow_replace()
1627 cmd->fs.ring_cookie); in mlx4_en_flow_replace()
1628 return -EINVAL; in mlx4_en_flow_replace()
1636 loc_rule = &priv->ethtool_rules[cmd->fs.location]; in mlx4_en_flow_replace()
1637 if (loc_rule->id) { in mlx4_en_flow_replace()
1638 err = mlx4_flow_detach(priv->mdev->dev, loc_rule->id); in mlx4_en_flow_replace()
1641 cmd->fs.location, loc_rule->id); in mlx4_en_flow_replace()
1644 loc_rule->id = 0; in mlx4_en_flow_replace()
1645 memset(&loc_rule->flow_spec, 0, in mlx4_en_flow_replace()
1647 list_del(&loc_rule->list); in mlx4_en_flow_replace()
1649 err = mlx4_flow_attach(priv->mdev->dev, &rule, ®_id); in mlx4_en_flow_replace()
1652 cmd->fs.location); in mlx4_en_flow_replace()
1655 loc_rule->id = reg_id; in mlx4_en_flow_replace()
1656 memcpy(&loc_rule->flow_spec, &cmd->fs, in mlx4_en_flow_replace()
1658 list_add_tail(&loc_rule->list, &priv->ethtool_list); in mlx4_en_flow_replace()
1662 list_del(&spec->list); in mlx4_en_flow_replace()
1675 if (cmd->fs.location >= MAX_NUM_OF_FS_RULES) in mlx4_en_flow_detach()
1676 return -EINVAL; in mlx4_en_flow_detach()
1678 rule = &priv->ethtool_rules[cmd->fs.location]; in mlx4_en_flow_detach()
1679 if (!rule->id) { in mlx4_en_flow_detach()
1680 err = -ENOENT; in mlx4_en_flow_detach()
1684 err = mlx4_flow_detach(priv->mdev->dev, rule->id); in mlx4_en_flow_detach()
1687 cmd->fs.location, rule->id); in mlx4_en_flow_detach()
1690 rule->id = 0; in mlx4_en_flow_detach()
1691 memset(&rule->flow_spec, 0, sizeof(struct ethtool_rx_flow_spec)); in mlx4_en_flow_detach()
1692 list_del(&rule->list); in mlx4_en_flow_detach()
1706 return -EINVAL; in mlx4_en_get_flow()
1708 rule = &priv->ethtool_rules[loc]; in mlx4_en_get_flow()
1709 if (rule->id) in mlx4_en_get_flow()
1710 memcpy(&cmd->fs, &rule->flow_spec, in mlx4_en_get_flow()
1713 err = -ENOENT; in mlx4_en_get_flow()
1723 if (priv->ethtool_rules[i].id) in mlx4_en_get_num_flows()
1734 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_get_rxnfc()
1738 if ((cmd->cmd == ETHTOOL_GRXCLSRLCNT || in mlx4_en_get_rxnfc()
1739 cmd->cmd == ETHTOOL_GRXCLSRULE || in mlx4_en_get_rxnfc()
1740 cmd->cmd == ETHTOOL_GRXCLSRLALL) && in mlx4_en_get_rxnfc()
1741 (mdev->dev->caps.steering_mode != in mlx4_en_get_rxnfc()
1742 MLX4_STEERING_MODE_DEVICE_MANAGED || !priv->port_up)) in mlx4_en_get_rxnfc()
1743 return -EINVAL; in mlx4_en_get_rxnfc()
1745 switch (cmd->cmd) { in mlx4_en_get_rxnfc()
1747 cmd->data = priv->rx_ring_num; in mlx4_en_get_rxnfc()
1750 cmd->rule_cnt = mlx4_en_get_num_flows(priv); in mlx4_en_get_rxnfc()
1753 err = mlx4_en_get_flow(dev, cmd, cmd->fs.location); in mlx4_en_get_rxnfc()
1756 cmd->data = MAX_NUM_OF_FS_RULES; in mlx4_en_get_rxnfc()
1757 while ((!err || err == -ENOENT) && priority < cmd->rule_cnt) { in mlx4_en_get_rxnfc()
1766 err = -EOPNOTSUPP; in mlx4_en_get_rxnfc()
1777 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_set_rxnfc()
1779 if (mdev->dev->caps.steering_mode != in mlx4_en_set_rxnfc()
1780 MLX4_STEERING_MODE_DEVICE_MANAGED || !priv->port_up) in mlx4_en_set_rxnfc()
1781 return -EINVAL; in mlx4_en_set_rxnfc()
1783 switch (cmd->cmd) { in mlx4_en_set_rxnfc()
1791 en_warn(priv, "Unsupported ethtool command. (%d)\n", cmd->cmd); in mlx4_en_set_rxnfc()
1792 return -EINVAL; in mlx4_en_set_rxnfc()
1808 channel->max_rx = mlx4_en_get_max_num_rx_rings(dev); in mlx4_en_get_channels()
1809 channel->max_tx = priv->mdev->profile.max_num_tx_rings_p_up; in mlx4_en_get_channels()
1811 channel->rx_count = priv->rx_ring_num; in mlx4_en_get_channels()
1812 channel->tx_count = priv->tx_ring_num[TX] / in mlx4_en_get_channels()
1813 priv->prof->num_up; in mlx4_en_get_channels()
1820 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_set_channels()
1829 if (!channel->tx_count || !channel->rx_count) in mlx4_en_set_channels()
1830 return -EINVAL; in mlx4_en_set_channels()
1834 return -ENOMEM; in mlx4_en_set_channels()
1836 mutex_lock(&mdev->state_lock); in mlx4_en_set_channels()
1837 xdp_count = priv->tx_ring_num[TX_XDP] ? channel->rx_count : 0; in mlx4_en_set_channels()
1838 total_tx_count = channel->tx_count * priv->prof->num_up + xdp_count; in mlx4_en_set_channels()
1840 err = -EINVAL; in mlx4_en_set_channels()
1847 memcpy(&new_prof, priv->prof, sizeof(struct mlx4_en_port_profile)); in mlx4_en_set_channels()
1848 new_prof.num_tx_rings_p_up = channel->tx_count; in mlx4_en_set_channels()
1849 new_prof.tx_ring_num[TX] = channel->tx_count * priv->prof->num_up; in mlx4_en_set_channels()
1851 new_prof.rx_ring_num = channel->rx_count; in mlx4_en_set_channels()
1857 if (priv->port_up) { in mlx4_en_set_channels()
1864 netif_set_real_num_rx_queues(dev, priv->rx_ring_num); in mlx4_en_set_channels()
1866 up = (priv->prof->num_up == MLX4_EN_NUM_UP_LOW) ? in mlx4_en_set_channels()
1867 0 : priv->prof->num_up; in mlx4_en_set_channels()
1870 en_warn(priv, "Using %d TX rings\n", priv->tx_ring_num[TX]); in mlx4_en_set_channels()
1871 en_warn(priv, "Using %d RX rings\n", priv->rx_ring_num); in mlx4_en_set_channels()
1881 mutex_unlock(&mdev->state_lock); in mlx4_en_set_channels()
1890 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_get_ts_info()
1897 if (mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_TS) { in mlx4_en_get_ts_info()
1898 info->so_timestamping |= in mlx4_en_get_ts_info()
1903 info->tx_types = in mlx4_en_get_ts_info()
1907 info->rx_filters = in mlx4_en_get_ts_info()
1911 if (mdev->ptp_clock) in mlx4_en_get_ts_info()
1912 info->phc_index = ptp_clock_index(mdev->ptp_clock); in mlx4_en_get_ts_info()
1921 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_set_priv_flags()
1923 bool bf_enabled_old = !!(priv->pflags & MLX4_EN_PRIV_FLAGS_BLUEFLAME); in mlx4_en_set_priv_flags()
1925 bool phv_enabled_old = !!(priv->pflags & MLX4_EN_PRIV_FLAGS_PHV); in mlx4_en_set_priv_flags()
1936 for (i = 0; i < priv->tx_ring_num[t]; i++) in mlx4_en_set_priv_flags()
1938 priv->tx_ring[t][i]->bf_alloced; in mlx4_en_set_priv_flags()
1942 return -EINVAL; in mlx4_en_set_priv_flags()
1945 priv->pflags |= MLX4_EN_PRIV_FLAGS_BLUEFLAME; in mlx4_en_set_priv_flags()
1947 priv->pflags &= ~MLX4_EN_PRIV_FLAGS_BLUEFLAME; in mlx4_en_set_priv_flags()
1951 for (i = 0; i < priv->tx_ring_num[t]; i++) in mlx4_en_set_priv_flags()
1952 priv->tx_ring[t][i]->bf_enabled = in mlx4_en_set_priv_flags()
1960 ret = set_phv_bit(mdev->dev, priv->port, (int)phv_enabled_new); in mlx4_en_set_priv_flags()
1964 priv->pflags |= MLX4_EN_PRIV_FLAGS_PHV; in mlx4_en_set_priv_flags()
1966 priv->pflags &= ~MLX4_EN_PRIV_FLAGS_PHV; in mlx4_en_set_priv_flags()
1977 return priv->pflags; in mlx4_en_get_priv_flags()
1987 switch (tuna->id) { in mlx4_en_get_tunable()
1989 *(u32 *)data = priv->prof->inline_thold; in mlx4_en_get_tunable()
1992 ret = -EINVAL; in mlx4_en_get_tunable()
2006 switch (tuna->id) { in mlx4_en_set_tunable()
2010 ret = -EINVAL; in mlx4_en_set_tunable()
2012 priv->prof->inline_thold = val; in mlx4_en_set_tunable()
2015 ret = -EINVAL; in mlx4_en_set_tunable()
2026 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_get_module_info()
2031 ret = mlx4_get_module_info(mdev->dev, priv->port, in mlx4_en_get_module_info()
2034 return -EIO; in mlx4_en_get_module_info()
2038 modinfo->type = ETH_MODULE_SFF_8436; in mlx4_en_get_module_info()
2039 modinfo->eeprom_len = ETH_MODULE_SFF_8436_MAX_LEN; in mlx4_en_get_module_info()
2043 modinfo->type = ETH_MODULE_SFF_8636; in mlx4_en_get_module_info()
2044 modinfo->eeprom_len = ETH_MODULE_SFF_8636_MAX_LEN; in mlx4_en_get_module_info()
2046 modinfo->type = ETH_MODULE_SFF_8436; in mlx4_en_get_module_info()
2047 modinfo->eeprom_len = ETH_MODULE_SFF_8436_MAX_LEN; in mlx4_en_get_module_info()
2051 modinfo->type = ETH_MODULE_SFF_8636; in mlx4_en_get_module_info()
2052 modinfo->eeprom_len = ETH_MODULE_SFF_8636_MAX_LEN; in mlx4_en_get_module_info()
2055 modinfo->type = ETH_MODULE_SFF_8472; in mlx4_en_get_module_info()
2056 modinfo->eeprom_len = ETH_MODULE_SFF_8472_LEN; in mlx4_en_get_module_info()
2059 return -EINVAL; in mlx4_en_get_module_info()
2070 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_get_module_eeprom()
2071 int offset = ee->offset; in mlx4_en_get_module_eeprom()
2074 if (ee->len == 0) in mlx4_en_get_module_eeprom()
2075 return -EINVAL; in mlx4_en_get_module_eeprom()
2077 memset(data, 0, ee->len); in mlx4_en_get_module_eeprom()
2079 while (i < ee->len) { in mlx4_en_get_module_eeprom()
2082 i, offset, ee->len - i); in mlx4_en_get_module_eeprom()
2084 ret = mlx4_get_module_info(mdev->dev, priv->port, in mlx4_en_get_module_eeprom()
2085 offset, ee->len - i, data + i); in mlx4_en_get_module_eeprom()
2092 "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n", in mlx4_en_get_module_eeprom()
2093 i, offset, ee->len - i, ret); in mlx4_en_get_module_eeprom()
2109 struct mlx4_en_dev *mdev = priv->mdev; in mlx4_en_set_phys_id()
2111 if (!(mdev->dev->caps.flags2 & MLX4_DEV_CAP_FLAG2_PORT_BEACON)) in mlx4_en_set_phys_id()
2112 return -EOPNOTSUPP; in mlx4_en_set_phys_id()
2122 return -EOPNOTSUPP; in mlx4_en_set_phys_id()
2125 err = mlx4_SET_PORT_BEACON(mdev->dev, priv->port, beacon_duration); in mlx4_en_set_phys_id()