net/mlx5: Devcom, Rename paired to ready
In downstream patch devcom will provide support for more than two devices. The term 'paired' will be renamed as 'ready' to convey a more accurate meaning. Signed-off-by: Shay Drory <shayd@nvidia.com> Reviewed-by: Mark Bloch <mbloch@nvidia.com> Reviewed-by: Roi Dayan <roid@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
This commit is contained in:
parent
6d5b7321d8
commit
e67f928a52
@ -414,7 +414,7 @@ static int mlx5e_sqs2vport_start(struct mlx5_eswitch *esw,
|
||||
return 0;
|
||||
|
||||
rpriv = mlx5e_rep_to_rep_priv(rep);
|
||||
if (mlx5_devcom_is_paired(esw->dev->priv.devcom, MLX5_DEVCOM_ESW_OFFLOADS))
|
||||
if (mlx5_devcom_comp_is_ready(esw->dev->priv.devcom, MLX5_DEVCOM_ESW_OFFLOADS))
|
||||
peer_esw = mlx5_devcom_get_peer_data(esw->dev->priv.devcom,
|
||||
MLX5_DEVCOM_ESW_OFFLOADS);
|
||||
|
||||
|
@ -4210,8 +4210,8 @@ static bool is_peer_flow_needed(struct mlx5e_tc_flow *flow)
|
||||
flow_flag_test(flow, INGRESS);
|
||||
bool act_is_encap = !!(attr->action &
|
||||
MLX5_FLOW_CONTEXT_ACTION_PACKET_REFORMAT);
|
||||
bool esw_paired = mlx5_devcom_is_paired(esw_attr->in_mdev->priv.devcom,
|
||||
MLX5_DEVCOM_ESW_OFFLOADS);
|
||||
bool esw_paired = mlx5_devcom_comp_is_ready(esw_attr->in_mdev->priv.devcom,
|
||||
MLX5_DEVCOM_ESW_OFFLOADS);
|
||||
|
||||
if (!esw_paired)
|
||||
return false;
|
||||
|
@ -2836,14 +2836,14 @@ static int mlx5_esw_offloads_devcom_event(int event,
|
||||
|
||||
esw->paired[mlx5_get_dev_index(peer_esw->dev)] = true;
|
||||
peer_esw->paired[mlx5_get_dev_index(esw->dev)] = true;
|
||||
mlx5_devcom_set_paired(devcom, MLX5_DEVCOM_ESW_OFFLOADS, true);
|
||||
mlx5_devcom_comp_set_ready(devcom, MLX5_DEVCOM_ESW_OFFLOADS, true);
|
||||
break;
|
||||
|
||||
case ESW_OFFLOADS_DEVCOM_UNPAIR:
|
||||
if (!esw->paired[mlx5_get_dev_index(peer_esw->dev)])
|
||||
break;
|
||||
|
||||
mlx5_devcom_set_paired(devcom, MLX5_DEVCOM_ESW_OFFLOADS, false);
|
||||
mlx5_devcom_comp_set_ready(devcom, MLX5_DEVCOM_ESW_OFFLOADS, false);
|
||||
esw->paired[mlx5_get_dev_index(peer_esw->dev)] = false;
|
||||
peer_esw->paired[mlx5_get_dev_index(esw->dev)] = false;
|
||||
mlx5_esw_offloads_unpair(peer_esw, esw);
|
||||
|
@ -824,8 +824,8 @@ bool mlx5_shared_fdb_supported(struct mlx5_lag *ldev)
|
||||
is_mdev_switchdev_mode(dev1) &&
|
||||
mlx5_eswitch_vport_match_metadata_enabled(dev0->priv.eswitch) &&
|
||||
mlx5_eswitch_vport_match_metadata_enabled(dev1->priv.eswitch) &&
|
||||
mlx5_devcom_is_paired(dev0->priv.devcom,
|
||||
MLX5_DEVCOM_ESW_OFFLOADS) &&
|
||||
mlx5_devcom_comp_is_ready(dev0->priv.devcom,
|
||||
MLX5_DEVCOM_ESW_OFFLOADS) &&
|
||||
MLX5_CAP_GEN(dev1, lag_native_fdb_selection) &&
|
||||
MLX5_CAP_ESW(dev1, root_ft_on_other_esw) &&
|
||||
MLX5_CAP_ESW(dev0, esw_shared_ingress_acl))
|
||||
|
@ -19,7 +19,7 @@ struct mlx5_devcom_component {
|
||||
|
||||
mlx5_devcom_event_handler_t handler;
|
||||
struct rw_semaphore sem;
|
||||
bool paired;
|
||||
bool ready;
|
||||
};
|
||||
|
||||
struct mlx5_devcom_list {
|
||||
@ -218,25 +218,25 @@ int mlx5_devcom_send_event(struct mlx5_devcom *devcom,
|
||||
return err;
|
||||
}
|
||||
|
||||
void mlx5_devcom_set_paired(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id,
|
||||
bool paired)
|
||||
void mlx5_devcom_comp_set_ready(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id,
|
||||
bool ready)
|
||||
{
|
||||
struct mlx5_devcom_component *comp;
|
||||
|
||||
comp = &devcom->priv->components[id];
|
||||
WARN_ON(!rwsem_is_locked(&comp->sem));
|
||||
|
||||
WRITE_ONCE(comp->paired, paired);
|
||||
WRITE_ONCE(comp->ready, ready);
|
||||
}
|
||||
|
||||
bool mlx5_devcom_is_paired(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id)
|
||||
bool mlx5_devcom_comp_is_ready(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id)
|
||||
{
|
||||
if (IS_ERR_OR_NULL(devcom))
|
||||
return false;
|
||||
|
||||
return READ_ONCE(devcom->priv->components[id].paired);
|
||||
return READ_ONCE(devcom->priv->components[id].ready);
|
||||
}
|
||||
|
||||
void *mlx5_devcom_get_peer_data(struct mlx5_devcom *devcom,
|
||||
@ -250,7 +250,7 @@ void *mlx5_devcom_get_peer_data(struct mlx5_devcom *devcom,
|
||||
|
||||
comp = &devcom->priv->components[id];
|
||||
down_read(&comp->sem);
|
||||
if (!READ_ONCE(comp->paired)) {
|
||||
if (!READ_ONCE(comp->ready)) {
|
||||
up_read(&comp->sem);
|
||||
return NULL;
|
||||
}
|
||||
@ -278,7 +278,7 @@ void *mlx5_devcom_get_peer_data_rcu(struct mlx5_devcom *devcom, enum mlx5_devcom
|
||||
/* This can change concurrently, however 'data' pointer will remain
|
||||
* valid for the duration of RCU read section.
|
||||
*/
|
||||
if (!READ_ONCE(comp->paired))
|
||||
if (!READ_ONCE(comp->ready))
|
||||
return NULL;
|
||||
|
||||
return rcu_dereference(comp->device[i].data);
|
||||
|
@ -33,11 +33,11 @@ int mlx5_devcom_send_event(struct mlx5_devcom *devcom,
|
||||
int event,
|
||||
void *event_data);
|
||||
|
||||
void mlx5_devcom_set_paired(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id,
|
||||
bool paired);
|
||||
bool mlx5_devcom_is_paired(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id);
|
||||
void mlx5_devcom_comp_set_ready(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id,
|
||||
bool ready);
|
||||
bool mlx5_devcom_comp_is_ready(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id);
|
||||
|
||||
void *mlx5_devcom_get_peer_data(struct mlx5_devcom *devcom,
|
||||
enum mlx5_devcom_components id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user