| .. | .. |
|---|
| 611 | 611 | } |
|---|
| 612 | 612 | |
|---|
| 613 | 613 | #define MLX4_LINK_MODES_SZ \ |
|---|
| 614 | | - (FIELD_SIZEOF(struct mlx4_ptys_reg, eth_proto_cap) * 8) |
|---|
| 614 | + (sizeof_field(struct mlx4_ptys_reg, eth_proto_cap) * 8) |
|---|
| 615 | 615 | |
|---|
| 616 | 616 | enum ethtool_report { |
|---|
| 617 | 617 | SUPPORTED = 0, |
|---|
| .. | .. |
|---|
| 639 | 639 | #define MLX4_BUILD_PTYS2ETHTOOL_CONFIG(reg_, speed_, ...) \ |
|---|
| 640 | 640 | ({ \ |
|---|
| 641 | 641 | struct ptys2ethtool_config *cfg; \ |
|---|
| 642 | | - const unsigned int modes[] = { __VA_ARGS__ }; \ |
|---|
| 642 | + static const unsigned int modes[] = { __VA_ARGS__ }; \ |
|---|
| 643 | 643 | unsigned int i; \ |
|---|
| 644 | 644 | cfg = &ptys2ethtool_map[reg_]; \ |
|---|
| 645 | 645 | cfg->speed = speed_; \ |
|---|
| .. | .. |
|---|
| 1106 | 1106 | return err; |
|---|
| 1107 | 1107 | } |
|---|
| 1108 | 1108 | |
|---|
| 1109 | +static void mlx4_en_get_pause_stats(struct net_device *dev, |
|---|
| 1110 | + struct ethtool_pause_stats *stats) |
|---|
| 1111 | +{ |
|---|
| 1112 | + struct mlx4_en_priv *priv = netdev_priv(dev); |
|---|
| 1113 | + struct bitmap_iterator it; |
|---|
| 1114 | + |
|---|
| 1115 | + bitmap_iterator_init(&it, priv->stats_bitmap.bitmap, NUM_ALL_STATS); |
|---|
| 1116 | + |
|---|
| 1117 | + spin_lock_bh(&priv->stats_lock); |
|---|
| 1118 | + if (test_bit(FLOW_PRIORITY_STATS_IDX_TX_FRAMES, |
|---|
| 1119 | + priv->stats_bitmap.bitmap)) |
|---|
| 1120 | + stats->tx_pause_frames = priv->tx_flowstats.tx_pause; |
|---|
| 1121 | + if (test_bit(FLOW_PRIORITY_STATS_IDX_RX_FRAMES, |
|---|
| 1122 | + priv->stats_bitmap.bitmap)) |
|---|
| 1123 | + stats->rx_pause_frames = priv->rx_flowstats.rx_pause; |
|---|
| 1124 | + spin_unlock_bh(&priv->stats_lock); |
|---|
| 1125 | +} |
|---|
| 1126 | + |
|---|
| 1109 | 1127 | static void mlx4_en_get_pauseparam(struct net_device *dev, |
|---|
| 1110 | 1128 | struct ethtool_pauseparam *pause) |
|---|
| 1111 | 1129 | { |
|---|
| .. | .. |
|---|
| 1235 | 1253 | struct mlx4_en_priv *priv = netdev_priv(dev); |
|---|
| 1236 | 1254 | u32 n = mlx4_en_get_rxfh_indir_size(dev); |
|---|
| 1237 | 1255 | u32 i, rss_rings; |
|---|
| 1238 | | - int err = 0; |
|---|
| 1239 | 1256 | |
|---|
| 1240 | 1257 | rss_rings = priv->prof->rss_rings ?: n; |
|---|
| 1241 | 1258 | rss_rings = rounddown_pow_of_two(rss_rings); |
|---|
| .. | .. |
|---|
| 1249 | 1266 | memcpy(key, priv->rss_key, MLX4_EN_RSS_KEY_SIZE); |
|---|
| 1250 | 1267 | if (hfunc) |
|---|
| 1251 | 1268 | *hfunc = priv->rss_hash_fn; |
|---|
| 1252 | | - return err; |
|---|
| 1269 | + return 0; |
|---|
| 1253 | 1270 | } |
|---|
| 1254 | 1271 | |
|---|
| 1255 | 1272 | static int mlx4_en_set_rxfh(struct net_device *dev, const u32 *ring_index, |
|---|
| .. | .. |
|---|
| 1393 | 1410 | struct mlx4_spec_list *spec_l2, |
|---|
| 1394 | 1411 | unsigned char *mac) |
|---|
| 1395 | 1412 | { |
|---|
| 1396 | | - int err = 0; |
|---|
| 1397 | 1413 | __be64 mac_msk = cpu_to_be64(MLX4_MAC_MASK << 16); |
|---|
| 1398 | 1414 | |
|---|
| 1399 | 1415 | spec_l2->id = MLX4_NET_TRANS_RULE_ID_ETH; |
|---|
| .. | .. |
|---|
| 1408 | 1424 | |
|---|
| 1409 | 1425 | list_add_tail(&spec_l2->list, rule_list_h); |
|---|
| 1410 | 1426 | |
|---|
| 1411 | | - return err; |
|---|
| 1427 | + return 0; |
|---|
| 1412 | 1428 | } |
|---|
| 1413 | 1429 | |
|---|
| 1414 | 1430 | static int mlx4_en_ethtool_add_mac_rule_by_ipv4(struct mlx4_en_priv *priv, |
|---|
| .. | .. |
|---|
| 2083 | 2099 | en_err(priv, |
|---|
| 2084 | 2100 | "mlx4_get_module_info i(%d) offset(%d) bytes_to_read(%d) - FAILED (0x%x)\n", |
|---|
| 2085 | 2101 | i, offset, ee->len - i, ret); |
|---|
| 2086 | | - return 0; |
|---|
| 2102 | + return ret; |
|---|
| 2087 | 2103 | } |
|---|
| 2088 | 2104 | |
|---|
| 2089 | 2105 | i += ret; |
|---|
| .. | .. |
|---|
| 2119 | 2135 | } |
|---|
| 2120 | 2136 | |
|---|
| 2121 | 2137 | const struct ethtool_ops mlx4_en_ethtool_ops = { |
|---|
| 2138 | + .supported_coalesce_params = ETHTOOL_COALESCE_USECS | |
|---|
| 2139 | + ETHTOOL_COALESCE_MAX_FRAMES | |
|---|
| 2140 | + ETHTOOL_COALESCE_TX_MAX_FRAMES_IRQ | |
|---|
| 2141 | + ETHTOOL_COALESCE_PKT_RATE_RX_USECS, |
|---|
| 2122 | 2142 | .get_drvinfo = mlx4_en_get_drvinfo, |
|---|
| 2123 | 2143 | .get_link_ksettings = mlx4_en_get_link_ksettings, |
|---|
| 2124 | 2144 | .set_link_ksettings = mlx4_en_set_link_ksettings, |
|---|
| .. | .. |
|---|
| 2134 | 2154 | .set_msglevel = mlx4_en_set_msglevel, |
|---|
| 2135 | 2155 | .get_coalesce = mlx4_en_get_coalesce, |
|---|
| 2136 | 2156 | .set_coalesce = mlx4_en_set_coalesce, |
|---|
| 2157 | + .get_pause_stats = mlx4_en_get_pause_stats, |
|---|
| 2137 | 2158 | .get_pauseparam = mlx4_en_get_pauseparam, |
|---|
| 2138 | 2159 | .set_pauseparam = mlx4_en_set_pauseparam, |
|---|
| 2139 | 2160 | .get_ringparam = mlx4_en_get_ringparam, |
|---|