diff options
author | Eric Dumazet <edumazet@google.com> | 2014-10-05 05:35:22 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-10-06 01:04:16 -0400 |
commit | 1556b8746e52501fdfaadd65837baaa63a9fa937 (patch) | |
tree | 33befd15a97dcb8bb8b3a78bc6d355caf2d37f59 | |
parent | 1255a5055449781a92076fc5429952f2b33cf309 (diff) |
net/mlx4_en: Use the new tx_copybreak to set inline threshold
Instead of setting inline threshold using module parameter only on
driver load, use set_tunable() to set it dynamically.
No need to store the threshold per ring, using instead the netdev global
priv->prof->inline_thold
Initial value still is set using the module parameter, therefore
backward compatability is kept.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Amir Vadai <amirv@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 44 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_tx.c | 1 | ||||
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | 1 |
3 files changed, 44 insertions, 2 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index 42c9f8b09a6e..ae83da9cd18a 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -1267,6 +1267,48 @@ static u32 mlx4_en_get_priv_flags(struct net_device *dev) | |||
1267 | return priv->pflags; | 1267 | return priv->pflags; |
1268 | } | 1268 | } |
1269 | 1269 | ||
1270 | static int mlx4_en_get_tunable(struct net_device *dev, | ||
1271 | const struct ethtool_tunable *tuna, | ||
1272 | void *data) | ||
1273 | { | ||
1274 | const struct mlx4_en_priv *priv = netdev_priv(dev); | ||
1275 | int ret = 0; | ||
1276 | |||
1277 | switch (tuna->id) { | ||
1278 | case ETHTOOL_TX_COPYBREAK: | ||
1279 | *(u32 *)data = priv->prof->inline_thold; | ||
1280 | break; | ||
1281 | default: | ||
1282 | ret = -EINVAL; | ||
1283 | break; | ||
1284 | } | ||
1285 | |||
1286 | return ret; | ||
1287 | } | ||
1288 | |||
1289 | static int mlx4_en_set_tunable(struct net_device *dev, | ||
1290 | const struct ethtool_tunable *tuna, | ||
1291 | const void *data) | ||
1292 | { | ||
1293 | struct mlx4_en_priv *priv = netdev_priv(dev); | ||
1294 | int val, ret = 0; | ||
1295 | |||
1296 | switch (tuna->id) { | ||
1297 | case ETHTOOL_TX_COPYBREAK: | ||
1298 | val = *(u32 *)data; | ||
1299 | if (val < MIN_PKT_LEN || val > MAX_INLINE) | ||
1300 | ret = -EINVAL; | ||
1301 | else | ||
1302 | priv->prof->inline_thold = val; | ||
1303 | break; | ||
1304 | default: | ||
1305 | ret = -EINVAL; | ||
1306 | break; | ||
1307 | } | ||
1308 | |||
1309 | return ret; | ||
1310 | } | ||
1311 | |||
1270 | 1312 | ||
1271 | const struct ethtool_ops mlx4_en_ethtool_ops = { | 1313 | const struct ethtool_ops mlx4_en_ethtool_ops = { |
1272 | .get_drvinfo = mlx4_en_get_drvinfo, | 1314 | .get_drvinfo = mlx4_en_get_drvinfo, |
@@ -1297,6 +1339,8 @@ const struct ethtool_ops mlx4_en_ethtool_ops = { | |||
1297 | .get_ts_info = mlx4_en_get_ts_info, | 1339 | .get_ts_info = mlx4_en_get_ts_info, |
1298 | .set_priv_flags = mlx4_en_set_priv_flags, | 1340 | .set_priv_flags = mlx4_en_set_priv_flags, |
1299 | .get_priv_flags = mlx4_en_get_priv_flags, | 1341 | .get_priv_flags = mlx4_en_get_priv_flags, |
1342 | .get_tunable = mlx4_en_get_tunable, | ||
1343 | .set_tunable = mlx4_en_set_tunable, | ||
1300 | }; | 1344 | }; |
1301 | 1345 | ||
1302 | 1346 | ||
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_tx.c b/drivers/net/ethernet/mellanox/mlx4/en_tx.c index f0080c5417c3..92a7cf46d9af 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_tx.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_tx.c | |||
@@ -66,7 +66,6 @@ int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, | |||
66 | ring->size = size; | 66 | ring->size = size; |
67 | ring->size_mask = size - 1; | 67 | ring->size_mask = size - 1; |
68 | ring->stride = stride; | 68 | ring->stride = stride; |
69 | ring->inline_thold = priv->prof->inline_thold; | ||
70 | 69 | ||
71 | tmp = size * sizeof(struct mlx4_en_tx_info); | 70 | tmp = size * sizeof(struct mlx4_en_tx_info); |
72 | ring->tx_info = kmalloc_node(tmp, GFP_KERNEL | __GFP_NOWARN, node); | 71 | ring->tx_info = kmalloc_node(tmp, GFP_KERNEL | __GFP_NOWARN, node); |
diff --git a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h index a90403000577..8fef65840b3b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h +++ b/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h | |||
@@ -295,7 +295,6 @@ struct mlx4_en_tx_ring { | |||
295 | bool bf_alloced; | 295 | bool bf_alloced; |
296 | struct netdev_queue *tx_queue; | 296 | struct netdev_queue *tx_queue; |
297 | int hwtstamp_tx_type; | 297 | int hwtstamp_tx_type; |
298 | int inline_thold; | ||
299 | } ____cacheline_aligned_in_smp; | 298 | } ____cacheline_aligned_in_smp; |
300 | 299 | ||
301 | struct mlx4_en_rx_desc { | 300 | struct mlx4_en_rx_desc { |