Skip to content

Commit

Permalink
Merge branch 'mlx5e-next'
Browse files Browse the repository at this point in the history
Amir Vadai says:

====================
net/mlx5e: Driver update 29-Jul-2015

This patchset contain bug fixes and code cleaning patches to the ConnectX-4
Ethernet driver.

Patchset was applied and tested over commit 8c1a91f ("Merge branch
'mlx4-802.1ad-accel'")
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 30, 2015
2 parents dcc38c0 + 98e81b0 commit e82a08b
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 101 deletions.
3 changes: 0 additions & 3 deletions drivers/net/ethernet/mellanox/mlx5/core/en.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ struct mlx5e_flow_table {

struct mlx5e_priv {
/* priv data path fields - start */
int num_tc;
int default_vlan_prio;
struct mlx5e_sq **txq_to_sq_map;
/* priv data path fields - end */
Expand Down Expand Up @@ -497,8 +496,6 @@ void mlx5e_del_all_vlan_rules(struct mlx5e_priv *priv);

int mlx5e_open_locked(struct net_device *netdev);
int mlx5e_close_locked(struct net_device *netdev);
int mlx5e_update_priv_params(struct mlx5e_priv *priv,
struct mlx5e_params *new_params);

static inline void mlx5e_tx_notify_hw(struct mlx5e_sq *sq,
struct mlx5e_tx_wqe *wqe, int bf_sz)
Expand Down
63 changes: 42 additions & 21 deletions drivers/net/ethernet/mellanox/mlx5/core/en_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int mlx5e_get_sset_count(struct net_device *dev, int sset)
case ETH_SS_STATS:
return NUM_VPORT_COUNTERS +
priv->params.num_channels * NUM_RQ_STATS +
priv->params.num_channels * priv->num_tc *
priv->params.num_channels * priv->params.num_tc *
NUM_SQ_STATS;
/* fallthrough */
default:
Expand Down Expand Up @@ -207,7 +207,7 @@ static void mlx5e_get_strings(struct net_device *dev,
"rx%d_%s", i, rq_stats_strings[j]);

for (i = 0; i < priv->params.num_channels; i++)
for (tc = 0; tc < priv->num_tc; tc++)
for (tc = 0; tc < priv->params.num_tc; tc++)
for (j = 0; j < NUM_SQ_STATS; j++)
sprintf(data +
(idx++) * ETH_GSTRING_LEN,
Expand Down Expand Up @@ -242,7 +242,7 @@ static void mlx5e_get_ethtool_stats(struct net_device *dev,
((u64 *)&priv->channel[i]->rq.stats)[j];

for (i = 0; i < priv->params.num_channels; i++)
for (tc = 0; tc < priv->num_tc; tc++)
for (tc = 0; tc < priv->params.num_tc; tc++)
for (j = 0; j < NUM_SQ_STATS; j++)
data[idx++] = !test_bit(MLX5E_STATE_OPENED,
&priv->state) ? 0 :
Expand All @@ -264,7 +264,7 @@ static int mlx5e_set_ringparam(struct net_device *dev,
struct ethtool_ringparam *param)
{
struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5e_params new_params;
bool was_opened;
u16 min_rx_wqes;
u8 log_rq_size;
u8 log_sq_size;
Expand Down Expand Up @@ -316,11 +316,18 @@ static int mlx5e_set_ringparam(struct net_device *dev,
return 0;

mutex_lock(&priv->state_lock);
new_params = priv->params;
new_params.log_rq_size = log_rq_size;
new_params.log_sq_size = log_sq_size;
new_params.min_rx_wqes = min_rx_wqes;
err = mlx5e_update_priv_params(priv, &new_params);

was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
if (was_opened)
mlx5e_close_locked(dev);

priv->params.log_rq_size = log_rq_size;
priv->params.log_sq_size = log_sq_size;
priv->params.min_rx_wqes = min_rx_wqes;

if (was_opened)
err = mlx5e_open_locked(dev);

mutex_unlock(&priv->state_lock);

return err;
Expand All @@ -342,7 +349,7 @@ static int mlx5e_set_channels(struct net_device *dev,
struct mlx5e_priv *priv = netdev_priv(dev);
int ncv = priv->mdev->priv.eq_table.num_comp_vectors;
unsigned int count = ch->combined_count;
struct mlx5e_params new_params;
bool was_opened;
int err = 0;

if (!count) {
Expand All @@ -365,9 +372,16 @@ static int mlx5e_set_channels(struct net_device *dev,
return 0;

mutex_lock(&priv->state_lock);
new_params = priv->params;
new_params.num_channels = count;
err = mlx5e_update_priv_params(priv, &new_params);

was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
if (was_opened)
mlx5e_close_locked(dev);

priv->params.num_channels = count;

if (was_opened)
err = mlx5e_open_locked(dev);

mutex_unlock(&priv->state_lock);

return err;
Expand Down Expand Up @@ -673,10 +687,10 @@ static int mlx5e_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
return 0;
}

static int mlx5e_set_rxfh(struct net_device *netdev, const u32 *indir,
static int mlx5e_set_rxfh(struct net_device *dev, const u32 *indir,
const u8 *key, const u8 hfunc)
{
struct mlx5e_priv *priv = netdev_priv(netdev);
struct mlx5e_priv *priv = netdev_priv(dev);
int err = 0;

if (hfunc == ETH_RSS_HASH_NO_CHANGE)
Expand All @@ -690,8 +704,8 @@ static int mlx5e_set_rxfh(struct net_device *netdev, const u32 *indir,

priv->params.rss_hfunc = hfunc;
if (test_bit(MLX5E_STATE_OPENED, &priv->state)) {
mlx5e_close_locked(priv->netdev);
err = mlx5e_open_locked(priv->netdev);
mlx5e_close_locked(dev);
err = mlx5e_open_locked(dev);
}

mutex_unlock(&priv->state_lock);
Expand Down Expand Up @@ -724,7 +738,7 @@ static int mlx5e_set_tunable(struct net_device *dev,
{
struct mlx5e_priv *priv = netdev_priv(dev);
struct mlx5_core_dev *mdev = priv->mdev;
struct mlx5e_params new_params;
bool was_opened;
u32 val;
int err = 0;

Expand All @@ -737,9 +751,16 @@ static int mlx5e_set_tunable(struct net_device *dev,
}

mutex_lock(&priv->state_lock);
new_params = priv->params;
new_params.tx_max_inline = val;
err = mlx5e_update_priv_params(priv, &new_params);

was_opened = test_bit(MLX5E_STATE_OPENED, &priv->state);
if (was_opened)
mlx5e_close_locked(dev);

priv->params.tx_max_inline = val;

if (was_opened)
err = mlx5e_open_locked(dev);

mutex_unlock(&priv->state_lock);
break;
default:
Expand Down
Loading

0 comments on commit e82a08b

Please sign in to comment.