Commit a9ee8d4a authored by Edward Cree's avatar Edward Cree Committed by Jakub Kicinski
Browse files

sfc: use new rxfh_context API



The core is now responsible for allocating IDs and a memory region for
 us to store our state (struct efx_rss_context_priv), so we no longer
 need efx_alloc_rss_context_entry() and friends.
Since the contexts are now maintained by the core, use the core's lock
 (net_dev->ethtool->rss_lock), rather than our own mutex (efx->rss_lock),
 to serialise access against changes; and remove the now-unused
 efx->rss_lock from struct efx_nic.

Signed-off-by: default avatarEdward Cree <ecree.xilinx@gmail.com>
Reviewed-by: default avatarPrzemek Kitszel <przemyslaw.kitszel@intel.com>
Link: https://patch.msgid.link/150274740ea8cc137fef5502541ce573d32fb319.1719502240.git.ecree.xilinx@gmail.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 87925151
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1396,7 +1396,7 @@ static void efx_ef10_table_reset_mc_allocations(struct efx_nic *efx)
	efx_mcdi_filter_table_reset_mc_allocations(efx);
	nic_data->must_restore_piobufs = true;
	efx_ef10_forget_old_piobufs(efx);
	efx->rss_context.context_id = EFX_MCDI_RSS_CONTEXT_INVALID;
	efx->rss_context.priv.context_id = EFX_MCDI_RSS_CONTEXT_INVALID;

	/* Driver-created vswitches and vports must be re-created */
	nic_data->must_probe_vswitching = true;
+4 −0
Original line number Diff line number Diff line
@@ -59,8 +59,12 @@ const struct ethtool_ops ef100_ethtool_ops = {

	.get_rxfh_indir_size	= efx_ethtool_get_rxfh_indir_size,
	.get_rxfh_key_size	= efx_ethtool_get_rxfh_key_size,
	.rxfh_priv_size		= sizeof(struct efx_rss_context_priv),
	.get_rxfh		= efx_ethtool_get_rxfh,
	.set_rxfh		= efx_ethtool_set_rxfh,
	.create_rxfh_context	= efx_ethtool_create_rxfh_context,
	.modify_rxfh_context	= efx_ethtool_modify_rxfh_context,
	.remove_rxfh_context	= efx_ethtool_remove_rxfh_context,

	.get_module_info	= efx_ethtool_get_module_info,
	.get_module_eeprom	= efx_ethtool_get_module_eeprom,
+1 −1
Original line number Diff line number Diff line
@@ -299,7 +299,7 @@ static int efx_probe_nic(struct efx_nic *efx)
	if (efx->n_channels > 1)
		netdev_rss_key_fill(efx->rss_context.rx_hash_key,
				    sizeof(efx->rss_context.rx_hash_key));
	efx_set_default_rx_indir_table(efx, &efx->rss_context);
	efx_set_default_rx_indir_table(efx, efx->rss_context.rx_indir_table);

	/* Initialise the interrupt moderation settings */
	efx->irq_mod_step_us = DIV_ROUND_UP(efx->timer_quantum_ns, 1000);
+1 −1
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ static inline s32 efx_filter_get_rx_ids(struct efx_nic *efx,
}

/* RSS contexts */
static inline bool efx_rss_active(struct efx_rss_context *ctx)
static inline bool efx_rss_active(struct efx_rss_context_priv *ctx)
{
	return ctx->context_id != EFX_MCDI_RSS_CONTEXT_INVALID;
}
+4 −6
Original line number Diff line number Diff line
@@ -714,7 +714,7 @@ void efx_reset_down(struct efx_nic *efx, enum reset_type method)

	mutex_lock(&efx->mac_lock);
	down_write(&efx->filter_sem);
	mutex_lock(&efx->rss_lock);
	mutex_lock(&efx->net_dev->ethtool->rss_lock);
	efx->type->fini(efx);
}

@@ -777,7 +777,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)

	if (efx->type->rx_restore_rss_contexts)
		efx->type->rx_restore_rss_contexts(efx);
	mutex_unlock(&efx->rss_lock);
	mutex_unlock(&efx->net_dev->ethtool->rss_lock);
	efx->type->filter_table_restore(efx);
	up_write(&efx->filter_sem);

@@ -793,7 +793,7 @@ int efx_reset_up(struct efx_nic *efx, enum reset_type method, bool ok)
fail:
	efx->port_initialized = false;

	mutex_unlock(&efx->rss_lock);
	mutex_unlock(&efx->net_dev->ethtool->rss_lock);
	up_write(&efx->filter_sem);
	mutex_unlock(&efx->mac_lock);

@@ -1000,9 +1000,7 @@ int efx_init_struct(struct efx_nic *efx, struct pci_dev *pci_dev)
		efx->type->rx_hash_offset - efx->type->rx_prefix_size;
	efx->rx_packet_ts_offset =
		efx->type->rx_ts_offset - efx->type->rx_prefix_size;
	INIT_LIST_HEAD(&efx->rss_context.list);
	efx->rss_context.context_id = EFX_MCDI_RSS_CONTEXT_INVALID;
	mutex_init(&efx->rss_lock);
	efx->rss_context.priv.context_id = EFX_MCDI_RSS_CONTEXT_INVALID;
	efx->vport_id = EVB_PORT_ID_ASSIGNED;
	spin_lock_init(&efx->stats_lock);
	efx->vi_stride = EFX_DEFAULT_VI_STRIDE;
Loading