net/mlx5: Replace irq_to_desc() abuse
No driver has any business with the internals of an interrupt descriptor. Storing a pointer to it just to use yet another helper at the actual usage site to retrieve the affinity mask is creative at best. Just because C does not allow encapsulation does not mean that the kernel has no limits. Retrieve a pointer to the affinity mask itself and use that. It's still using an interface which is usually not for random drivers, but definitely less hideous than the previous hack. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Saeed Mahameed <saeedm@nvidia.com> Link: https://lore.kernel.org/r/20201210194044.769458162@linutronix.de
This commit is contained in:
@@ -669,7 +669,7 @@ struct mlx5e_channel {
|
|||||||
spinlock_t async_icosq_lock;
|
spinlock_t async_icosq_lock;
|
||||||
|
|
||||||
/* data path - accessed per napi poll */
|
/* data path - accessed per napi poll */
|
||||||
struct irq_desc *irq_desc;
|
const struct cpumask *aff_mask;
|
||||||
struct mlx5e_ch_stats *stats;
|
struct mlx5e_ch_stats *stats;
|
||||||
|
|
||||||
/* control */
|
/* control */
|
||||||
|
|||||||
@@ -1998,7 +1998,7 @@ static int mlx5e_open_channel(struct mlx5e_priv *priv, int ix,
|
|||||||
c->num_tc = params->num_tc;
|
c->num_tc = params->num_tc;
|
||||||
c->xdp = !!params->xdp_prog;
|
c->xdp = !!params->xdp_prog;
|
||||||
c->stats = &priv->channel_stats[ix].ch;
|
c->stats = &priv->channel_stats[ix].ch;
|
||||||
c->irq_desc = irq_to_desc(irq);
|
c->aff_mask = irq_get_affinity_mask(irq);
|
||||||
c->lag_port = mlx5e_enumerate_lag_port(priv->mdev, ix);
|
c->lag_port = mlx5e_enumerate_lag_port(priv->mdev, ix);
|
||||||
|
|
||||||
netif_napi_add(netdev, &c->napi, mlx5e_napi_poll, 64);
|
netif_napi_add(netdev, &c->napi, mlx5e_napi_poll, 64);
|
||||||
|
|||||||
@@ -40,12 +40,8 @@
|
|||||||
static inline bool mlx5e_channel_no_affinity_change(struct mlx5e_channel *c)
|
static inline bool mlx5e_channel_no_affinity_change(struct mlx5e_channel *c)
|
||||||
{
|
{
|
||||||
int current_cpu = smp_processor_id();
|
int current_cpu = smp_processor_id();
|
||||||
const struct cpumask *aff;
|
|
||||||
struct irq_data *idata;
|
|
||||||
|
|
||||||
idata = irq_desc_get_irq_data(c->irq_desc);
|
return cpumask_test_cpu(current_cpu, c->aff_mask);
|
||||||
aff = irq_data_get_affinity_mask(idata);
|
|
||||||
return cpumask_test_cpu(current_cpu, aff);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq)
|
static void mlx5e_handle_tx_dim(struct mlx5e_txqsq *sq)
|
||||||
|
|||||||
Reference in New Issue
Block a user