aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/spectrum.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index e0804599fcae..696b99e65a5a 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -575,15 +575,14 @@ static void mlxsw_sp_span_entry_destroy(struct mlxsw_sp *mlxsw_sp,
575} 575}
576 576
577static struct mlxsw_sp_span_entry * 577static struct mlxsw_sp_span_entry *
578mlxsw_sp_span_entry_find(struct mlxsw_sp_port *port) 578mlxsw_sp_span_entry_find(struct mlxsw_sp *mlxsw_sp, u8 local_port)
579{ 579{
580 struct mlxsw_sp *mlxsw_sp = port->mlxsw_sp;
581 int i; 580 int i;
582 581
583 for (i = 0; i < mlxsw_sp->span.entries_count; i++) { 582 for (i = 0; i < mlxsw_sp->span.entries_count; i++) {
584 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i]; 583 struct mlxsw_sp_span_entry *curr = &mlxsw_sp->span.entries[i];
585 584
586 if (curr->used && curr->local_port == port->local_port) 585 if (curr->used && curr->local_port == local_port)
587 return curr; 586 return curr;
588 } 587 }
589 return NULL; 588 return NULL;
@@ -594,7 +593,8 @@ static struct mlxsw_sp_span_entry
594{ 593{
595 struct mlxsw_sp_span_entry *span_entry; 594 struct mlxsw_sp_span_entry *span_entry;
596 595
597 span_entry = mlxsw_sp_span_entry_find(port); 596 span_entry = mlxsw_sp_span_entry_find(port->mlxsw_sp,
597 port->local_port);
598 if (span_entry) { 598 if (span_entry) {
599 /* Already exists, just take a reference */ 599 /* Already exists, just take a reference */
600 span_entry->ref_count++; 600 span_entry->ref_count++;
@@ -783,12 +783,13 @@ err_port_bind:
783} 783}
784 784
785static void mlxsw_sp_span_mirror_remove(struct mlxsw_sp_port *from, 785static void mlxsw_sp_span_mirror_remove(struct mlxsw_sp_port *from,
786 struct mlxsw_sp_port *to, 786 u8 destination_port,
787 enum mlxsw_sp_span_type type) 787 enum mlxsw_sp_span_type type)
788{ 788{
789 struct mlxsw_sp_span_entry *span_entry; 789 struct mlxsw_sp_span_entry *span_entry;
790 790
791 span_entry = mlxsw_sp_span_entry_find(to); 791 span_entry = mlxsw_sp_span_entry_find(from->mlxsw_sp,
792 destination_port);
792 if (!span_entry) { 793 if (!span_entry) {
793 netdev_err(from->dev, "no span entry found\n"); 794 netdev_err(from->dev, "no span entry found\n");
794 return; 795 return;
@@ -1563,14 +1564,12 @@ static void
1563mlxsw_sp_port_del_cls_matchall_mirror(struct mlxsw_sp_port *mlxsw_sp_port, 1564mlxsw_sp_port_del_cls_matchall_mirror(struct mlxsw_sp_port *mlxsw_sp_port,
1564 struct mlxsw_sp_port_mall_mirror_tc_entry *mirror) 1565 struct mlxsw_sp_port_mall_mirror_tc_entry *mirror)
1565{ 1566{
1566 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
1567 enum mlxsw_sp_span_type span_type; 1567 enum mlxsw_sp_span_type span_type;
1568 struct mlxsw_sp_port *to_port;
1569 1568
1570 to_port = mlxsw_sp->ports[mirror->to_local_port];
1571 span_type = mirror->ingress ? 1569 span_type = mirror->ingress ?
1572 MLXSW_SP_SPAN_INGRESS : MLXSW_SP_SPAN_EGRESS; 1570 MLXSW_SP_SPAN_INGRESS : MLXSW_SP_SPAN_EGRESS;
1573 mlxsw_sp_span_mirror_remove(mlxsw_sp_port, to_port, span_type); 1571 mlxsw_sp_span_mirror_remove(mlxsw_sp_port, mirror->to_local_port,
1572 span_type);
1574} 1573}
1575 1574
1576static int 1575static int