Commit 062bb997 authored by David S. Miller's avatar David S. Miller

Merge tag 'mlx5-fixes-2017-06-11' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
Mellanox mlx5 fixes 2017-06-11

This series contains some fixes for the mlx5 core and netdev driver.

Please pull and let me know if there's any problem.

For -stable:
("net/mlx5e: Added BW check for DIM decision mechanism")              kernels >= 4.9
("net/mlx5e: Fix wrong indications in DIM due to counter wraparound") kernels >= 4.9
("net/mlx5: Remove several module events out of ethtool stats")       kernels >= 4.10
("net/mlx5: Enable 4K UAR only when page size is bigger than 4K")     kernels >= 4.11

*all patches apply with no issue on their -stable.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 77a6bb5a 91828bd8
...@@ -458,12 +458,14 @@ struct mlx5e_mpw_info { ...@@ -458,12 +458,14 @@ struct mlx5e_mpw_info {
struct mlx5e_rx_am_stats { struct mlx5e_rx_am_stats {
int ppms; /* packets per msec */ int ppms; /* packets per msec */
int bpms; /* bytes per msec */
int epms; /* events per msec */ int epms; /* events per msec */
}; };
struct mlx5e_rx_am_sample { struct mlx5e_rx_am_sample {
ktime_t time; ktime_t time;
unsigned int pkt_ctr; u32 pkt_ctr;
u32 byte_ctr;
u16 event_ctr; u16 event_ctr;
}; };
......
...@@ -183,27 +183,26 @@ static void mlx5e_am_exit_parking(struct mlx5e_rx_am *am) ...@@ -183,27 +183,26 @@ static void mlx5e_am_exit_parking(struct mlx5e_rx_am *am)
mlx5e_am_step(am); mlx5e_am_step(am);
} }
#define IS_SIGNIFICANT_DIFF(val, ref) \
(((100 * abs((val) - (ref))) / (ref)) > 10) /* more than 10% difference */
static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr, static int mlx5e_am_stats_compare(struct mlx5e_rx_am_stats *curr,
struct mlx5e_rx_am_stats *prev) struct mlx5e_rx_am_stats *prev)
{ {
int diff; if (!prev->bpms)
return curr->bpms ? MLX5E_AM_STATS_BETTER :
if (!prev->ppms)
return curr->ppms ? MLX5E_AM_STATS_BETTER :
MLX5E_AM_STATS_SAME; MLX5E_AM_STATS_SAME;
diff = curr->ppms - prev->ppms; if (IS_SIGNIFICANT_DIFF(curr->bpms, prev->bpms))
if (((100 * abs(diff)) / prev->ppms) > 10) /* more than 10% diff */ return (curr->bpms > prev->bpms) ? MLX5E_AM_STATS_BETTER :
return (diff > 0) ? MLX5E_AM_STATS_BETTER :
MLX5E_AM_STATS_WORSE; MLX5E_AM_STATS_WORSE;
if (!prev->epms) if (IS_SIGNIFICANT_DIFF(curr->ppms, prev->ppms))
return curr->epms ? MLX5E_AM_STATS_WORSE : return (curr->ppms > prev->ppms) ? MLX5E_AM_STATS_BETTER :
MLX5E_AM_STATS_SAME; MLX5E_AM_STATS_WORSE;
diff = curr->epms - prev->epms; if (IS_SIGNIFICANT_DIFF(curr->epms, prev->epms))
if (((100 * abs(diff)) / prev->epms) > 10) /* more than 10% diff */ return (curr->epms < prev->epms) ? MLX5E_AM_STATS_BETTER :
return (diff < 0) ? MLX5E_AM_STATS_BETTER :
MLX5E_AM_STATS_WORSE; MLX5E_AM_STATS_WORSE;
return MLX5E_AM_STATS_SAME; return MLX5E_AM_STATS_SAME;
...@@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e_rq *rq, ...@@ -266,10 +265,13 @@ static void mlx5e_am_sample(struct mlx5e_rq *rq,
{ {
s->time = ktime_get(); s->time = ktime_get();
s->pkt_ctr = rq->stats.packets; s->pkt_ctr = rq->stats.packets;
s->byte_ctr = rq->stats.bytes;
s->event_ctr = rq->cq.event_ctr; s->event_ctr = rq->cq.event_ctr;
} }
#define MLX5E_AM_NEVENTS 64 #define MLX5E_AM_NEVENTS 64
#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
#define BIT_GAP(bits, end, start) ((((end) - (start)) + BIT_ULL(bits)) & (BIT_ULL(bits) - 1))
static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start,
struct mlx5e_rx_am_sample *end, struct mlx5e_rx_am_sample *end,
...@@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start, ...@@ -277,13 +279,17 @@ static void mlx5e_am_calc_stats(struct mlx5e_rx_am_sample *start,
{ {
/* u32 holds up to 71 minutes, should be enough */ /* u32 holds up to 71 minutes, should be enough */
u32 delta_us = ktime_us_delta(end->time, start->time); u32 delta_us = ktime_us_delta(end->time, start->time);
unsigned int npkts = end->pkt_ctr - start->pkt_ctr; u32 npkts = BIT_GAP(BITS_PER_TYPE(u32), end->pkt_ctr, start->pkt_ctr);
u32 nbytes = BIT_GAP(BITS_PER_TYPE(u32), end->byte_ctr,
start->byte_ctr);
if (!delta_us) if (!delta_us)
return; return;
curr_stats->ppms = (npkts * USEC_PER_MSEC) / delta_us; curr_stats->ppms = DIV_ROUND_UP(npkts * USEC_PER_MSEC, delta_us);
curr_stats->epms = (MLX5E_AM_NEVENTS * USEC_PER_MSEC) / delta_us; curr_stats->bpms = DIV_ROUND_UP(nbytes * USEC_PER_MSEC, delta_us);
curr_stats->epms = DIV_ROUND_UP(MLX5E_AM_NEVENTS * USEC_PER_MSEC,
delta_us);
} }
void mlx5e_rx_am_work(struct work_struct *work) void mlx5e_rx_am_work(struct work_struct *work)
...@@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq) ...@@ -308,7 +314,8 @@ void mlx5e_rx_am(struct mlx5e_rq *rq)
switch (am->state) { switch (am->state) {
case MLX5E_AM_MEASURE_IN_PROGRESS: case MLX5E_AM_MEASURE_IN_PROGRESS:
nevents = rq->cq.event_ctr - am->start_sample.event_ctr; nevents = BIT_GAP(BITS_PER_TYPE(u16), rq->cq.event_ctr,
am->start_sample.event_ctr);
if (nevents < MLX5E_AM_NEVENTS) if (nevents < MLX5E_AM_NEVENTS)
break; break;
mlx5e_am_sample(rq, &end_sample); mlx5e_am_sample(rq, &end_sample);
......
...@@ -417,20 +417,13 @@ struct mlx5e_stats { ...@@ -417,20 +417,13 @@ struct mlx5e_stats {
}; };
static const struct counter_desc mlx5e_pme_status_desc[] = { static const struct counter_desc mlx5e_pme_status_desc[] = {
{ "module_plug", 0 },
{ "module_unplug", 8 }, { "module_unplug", 8 },
}; };
static const struct counter_desc mlx5e_pme_error_desc[] = { static const struct counter_desc mlx5e_pme_error_desc[] = {
{ "module_pwr_budget_exd", 0 }, /* power budget exceed */
{ "module_long_range", 8 }, /* long range for non MLNX cable */
{ "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */ { "module_bus_stuck", 16 }, /* bus stuck (I2C or data shorted) */
{ "module_no_eeprom", 24 }, /* no eeprom/retry time out */
{ "module_enforce_part", 32 }, /* enforce part number list */
{ "module_unknown_id", 40 }, /* unknown identifier */
{ "module_high_temp", 48 }, /* high temperature */ { "module_high_temp", 48 }, /* high temperature */
{ "module_bad_shorted", 56 }, /* bad or shorted cable/module */ { "module_bad_shorted", 56 }, /* bad or shorted cable/module */
{ "module_unknown_status", 64 },
}; };
#endif /* __MLX5_EN_STATS_H__ */ #endif /* __MLX5_EN_STATS_H__ */
...@@ -862,7 +862,7 @@ struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace ...@@ -862,7 +862,7 @@ struct mlx5_flow_table *mlx5_create_vport_flow_table(struct mlx5_flow_namespace
ft_attr.level = level; ft_attr.level = level;
ft_attr.prio = prio; ft_attr.prio = prio;
return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, 0); return __mlx5_create_flow_table(ns, &ft_attr, FS_FT_OP_MOD_NORMAL, vport);
} }
struct mlx5_flow_table* struct mlx5_flow_table*
......
...@@ -275,10 +275,8 @@ static void poll_health(unsigned long data) ...@@ -275,10 +275,8 @@ static void poll_health(unsigned long data)
struct mlx5_core_health *health = &dev->priv.health; struct mlx5_core_health *health = &dev->priv.health;
u32 count; u32 count;
if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) { if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR)
mod_timer(&health->timer, get_next_poll_jiffies()); goto out;
return;
}
count = ioread32be(health->health_counter); count = ioread32be(health->health_counter);
if (count == health->prev) if (count == health->prev)
...@@ -290,8 +288,6 @@ static void poll_health(unsigned long data) ...@@ -290,8 +288,6 @@ static void poll_health(unsigned long data)
if (health->miss_counter == MAX_MISSES) { if (health->miss_counter == MAX_MISSES) {
dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n"); dev_err(&dev->pdev->dev, "device's health compromised - reached miss count\n");
print_health_info(dev); print_health_info(dev);
} else {
mod_timer(&health->timer, get_next_poll_jiffies());
} }
if (in_fatal(dev) && !health->sick) { if (in_fatal(dev) && !health->sick) {
...@@ -305,6 +301,9 @@ static void poll_health(unsigned long data) ...@@ -305,6 +301,9 @@ static void poll_health(unsigned long data)
"new health works are not permitted at this stage\n"); "new health works are not permitted at this stage\n");
spin_unlock(&health->wq_lock); spin_unlock(&health->wq_lock);
} }
out:
mod_timer(&health->timer, get_next_poll_jiffies());
} }
void mlx5_start_health_poll(struct mlx5_core_dev *dev) void mlx5_start_health_poll(struct mlx5_core_dev *dev)
......
...@@ -537,8 +537,10 @@ static int handle_hca_cap(struct mlx5_core_dev *dev) ...@@ -537,8 +537,10 @@ static int handle_hca_cap(struct mlx5_core_dev *dev)
/* disable cmdif checksum */ /* disable cmdif checksum */
MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0); MLX5_SET(cmd_hca_cap, set_hca_cap, cmdif_checksum, 0);
/* If the HCA supports 4K UARs use it */ /* Enable 4K UAR only when HCA supports it and page size is bigger
if (MLX5_CAP_GEN_MAX(dev, uar_4k)) * than 4K.
*/
if (MLX5_CAP_GEN_MAX(dev, uar_4k) && PAGE_SIZE > 4096)
MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1); MLX5_SET(cmd_hca_cap, set_hca_cap, uar_4k, 1);
MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12); MLX5_SET(cmd_hca_cap, set_hca_cap, log_uar_page_sz, PAGE_SHIFT - 12);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment