mlx4_core: Fix VLAN registration

Signed-off-by: Oren Duer <[EMAIL PROTECTED]>

Index: ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/en_port.c
===================================================================
--- ofed_kernel-2.6.18-EL5.1.orig.orig/drivers/net/mlx4/en_port.c       
2008-09-04 15:00:59.497911000 +0300
+++ ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/en_port.c    2008-09-04 
15:01:16.979282000 +0300
@@ -129,6 +129,10 @@ int mlx4_SET_PORT_qpn_calc(struct mlx4_d
        context->base_qpn = cpu_to_be32(base_qpn);
        context->promisc = cpu_to_be32(promisc << SET_PORT_PROMISC_SHIFT | 
base_qpn);
        context->mcast = cpu_to_be32(1 << SET_PORT_PROMISC_SHIFT | base_qpn);
+       context->intra_no_vlan = 0;
+       context->no_vlan = MLX4_NO_VLAN_IDX;
+       context->intra_vlan_miss = 0;
+       context->vlan_miss = MLX4_VLAN_MISS_IDX;
 
        in_mod = MLX4_SET_PORT_RQP_CALC << 8 | port;
        err = mlx4_cmd(dev, mailbox->dma, in_mod, 1, MLX4_CMD_SET_PORT,
Index: ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/en_port.h
===================================================================
--- ofed_kernel-2.6.18-EL5.1.orig.orig/drivers/net/mlx4/en_port.h       
2008-09-04 15:00:59.500913000 +0300
+++ ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/en_port.h    2008-09-04 
15:01:16.984285000 +0300
@@ -75,9 +75,9 @@ struct mlx4_set_port_rqp_calc_context {
        __be32 flags;
        u8 reserved[3];
        u8 mac_miss;
-       u8 reserved2;
+       u8 intra_no_vlan;
        u8 no_vlan;
-       u8 reserved3;
+       u8 intra_vlan_miss;
        u8 vlan_miss;
        u8 reserved4[3];
        u8 no_vlan_prio;
Index: ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/mlx4.h
===================================================================
--- ofed_kernel-2.6.18-EL5.1.orig.orig/drivers/net/mlx4/mlx4.h  2008-09-04 
15:01:13.697393000 +0300
+++ ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/mlx4.h       2008-09-04 
15:01:31.944725000 +0300
@@ -267,7 +267,7 @@ struct mlx4_mac_table {
 };
 
 struct mlx4_vlan_table {
-#define MLX4_MAX_VLAN_NUM      126
+#define MLX4_MAX_VLAN_NUM      128
 #define MLX4_VLAN_MASK         0xfff
 #define MLX4_VLAN_VALID                (1 << 31)
 #define MLX4_VLAN_TABLE_SIZE   (MLX4_MAX_VLAN_NUM << 2)
Index: ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/port.c
===================================================================
--- ofed_kernel-2.6.18-EL5.1.orig.orig/drivers/net/mlx4/port.c  2008-09-04 
15:00:59.507914000 +0300
+++ ofed_kernel-2.6.18-EL5.1.orig/drivers/net/mlx4/port.c       2008-09-04 
15:01:16.995288000 +0300
@@ -56,7 +56,7 @@ void mlx4_init_vlan_table(struct mlx4_de
        int i;
 
        sema_init(&table->vlan_sem, 1);
-       for (i = 0; i < MLX4_MAX_MAC_NUM; i++) {
+       for (i = 0; i < MLX4_MAX_VLAN_NUM; i++) {
                table->entries[i] = 0;
                table->refs[i] = 0;
        }
@@ -185,7 +185,7 @@ int mlx4_register_vlan(struct mlx4_dev *
        int free = -1;
 
        down(&table->vlan_sem);
-       for (i = 0; i < MLX4_MAX_VLAN_NUM; i++) {
+       for (i = MLX4_VLAN_REGULAR; i < MLX4_MAX_VLAN_NUM; i++) {
                if (free < 0 && (table->refs[i] == 0)) {
                        free = i;
                        continue;
@@ -231,6 +231,11 @@ void mlx4_unregister_vlan(struct mlx4_de
 {
        struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
 
+       if (index < MLX4_VLAN_REGULAR) {
+               mlx4_warn(dev, "Trying to free special vlan index %d\n", index);
+               return;
+       }
+
        down(&table->vlan_sem);
        if (!table->refs[index]) {
                mlx4_warn(dev, "No vlan entry for index %d\n", index);
Index: ofed_kernel-2.6.18-EL5.1.orig/include/linux/mlx4/device.h
===================================================================
--- ofed_kernel-2.6.18-EL5.1.orig.orig/include/linux/mlx4/device.h      
2008-09-04 15:00:59.514915000 +0300
+++ ofed_kernel-2.6.18-EL5.1.orig/include/linux/mlx4/device.h   2008-09-04 
15:01:17.003285000 +0300
@@ -162,6 +162,12 @@ enum {
        MLX4_NUM_FEXCH          = 64 * 1024,
 };
 
+enum mlx4_special_vlan_idx {
+       MLX4_NO_VLAN_IDX        = 0,
+       MLX4_VLAN_MISS_IDX,
+       MLX4_VLAN_REGULAR
+};
+
 #define MLX4_LEAST_ATTACHED_VECTOR     0xffffffff
 
 static inline u64 mlx4_fw_ver(u64 major, u64 minor, u64 subminor)
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to