mlxsw: spectrum: Fix refcount bug on span entries
authorYotam Gigi <yotamg@mellanox.com>
Fri, 11 Nov 2016 15:34:25 +0000 (16:34 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 13 Nov 2016 17:51:00 +0000 (12:51 -0500)
commit2d644d4c7506646f9c4a2afceb7fd5f030bc0c9f
treef00e19c06fdbd7dccfad6e1223ed6bb451d849f6
parenta055450a3340fc0d9a6b39257e6710f121d92385
mlxsw: spectrum: Fix refcount bug on span entries

When binding port to a newly created span entry, its refcount is
initialized to zero even though it has a bound port. That leads
to unexpected behaviour when the user tries to delete that port
from the span entry.

Fix this by initializing the reference count to 1.

Also add a warning to put function.

Fixes: 763b4b70afcd ("mlxsw: spectrum: Add support in matchall mirror TC offloading")
Signed-off-by: Yotam Gigi <yotamg@mellanox.com>
Reviewed-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/spectrum.c