diff options
Diffstat (limited to 'drivers/net/mlx4/port.c')
-rw-r--r-- | drivers/net/mlx4/port.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/net/mlx4/port.c b/drivers/net/mlx4/port.c index 606aa58afdea..56371ef328ef 100644 --- a/drivers/net/mlx4/port.c +++ b/drivers/net/mlx4/port.c | |||
@@ -182,6 +182,25 @@ static int mlx4_set_port_vlan_table(struct mlx4_dev *dev, u8 port, | |||
182 | return err; | 182 | return err; |
183 | } | 183 | } |
184 | 184 | ||
185 | int mlx4_find_cached_vlan(struct mlx4_dev *dev, u8 port, u16 vid, int *idx) | ||
186 | { | ||
187 | struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; | ||
188 | int i; | ||
189 | |||
190 | for (i = 0; i < MLX4_MAX_VLAN_NUM; ++i) { | ||
191 | if (table->refs[i] && | ||
192 | (vid == (MLX4_VLAN_MASK & | ||
193 | be32_to_cpu(table->entries[i])))) { | ||
194 | /* VLAN already registered, increase reference count */ | ||
195 | *idx = i; | ||
196 | return 0; | ||
197 | } | ||
198 | } | ||
199 | |||
200 | return -ENOENT; | ||
201 | } | ||
202 | EXPORT_SYMBOL_GPL(mlx4_find_cached_vlan); | ||
203 | |||
185 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) | 204 | int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index) |
186 | { | 205 | { |
187 | struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; | 206 | struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; |