drivers/net: Add export.h to files using EXPORT_SYMBOL/THIS_MODULE
[pandora-kernel.git] / drivers / net / ethernet / mellanox / mlx4 / port.c
index 609e0ec..b7c4c08 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <linux/errno.h>
 #include <linux/if_ether.h>
+#include <linux/export.h>
 
 #include <linux/mlx4/cmd.h>
 
@@ -65,7 +66,7 @@ void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table)
                table->entries[i] = 0;
                table->refs[i]   = 0;
        }
-       table->max   = 1 << dev->caps.log_num_vlans;
+       table->max   = (1 << dev->caps.log_num_vlans) - MLX4_VLAN_REGULAR;
        table->total = 0;
 }
 
@@ -354,6 +355,13 @@ int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
        int free = -1;
 
        mutex_lock(&table->mutex);
+
+       if (table->total == table->max) {
+               /* No free vlan entries */
+               err = -ENOSPC;
+               goto out;
+       }
+
        for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
                if (free < 0 && (table->refs[i] == 0)) {
                        free = i;
@@ -375,12 +383,6 @@ int mlx4_register_vlan(struct mlx4_dev *dev, u8 port, u16 vlan, int *index)
                goto out;
        }
 
-       if (table->total == table->max) {
-               /* No free vlan entries */
-               err = -ENOSPC;
-               goto out;
-       }
-
        /* Register new MAC */
        table->refs[free] = 1;
        table->entries[free] = cpu_to_be32(vlan | MLX4_VLAN_VALID);