Lines Matching defs:table
62 void mlx4_init_mac_table(struct mlx4_dev *dev, struct mlx4_mac_table *table)
66 mutex_init(&table->mutex);
68 table->entries[i] = 0;
69 table->refs[i] = 0;
70 table->is_dup[i] = false;
72 table->max = 1 << dev->caps.log_num_macs;
73 table->total = 0;
76 void mlx4_init_vlan_table(struct mlx4_dev *dev, struct mlx4_vlan_table *table)
80 mutex_init(&table->mutex);
82 table->entries[i] = 0;
83 table->refs[i] = 0;
84 table->is_dup[i] = false;
86 table->max = (1 << dev->caps.log_num_vlans) - MLX4_VLAN_REGULAR;
87 table->total = 0;
91 struct mlx4_roce_gid_table *table)
95 mutex_init(&table->mutex);
97 memset(table->roce_gids[i].raw, 0, MLX4_ROCE_GID_ENTRY_SIZE);
101 struct mlx4_mac_table *table, int index)
105 if (index < 0 || index >= table->max || !table->entries[index]) {
113 struct mlx4_mac_table *table, u64 mac)
118 if (table->refs[i] &&
120 (MLX4_MAC_MASK & be64_to_cpu(table->entries[i])))
165 struct mlx4_mac_table *table = &info->mac_table;
181 mutex_lock(&table->mutex);
185 mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
188 mutex_lock(&table->mutex);
196 if (((MLX4_MAC_MASK & mac) == (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))))
208 /* If the mac is already in the primary table, the slot must be
209 * available in the duplicate table as well.
215 /* If the mac is already in the duplicate table, check that the
216 * corresponding index is not occupied in the primary table, or
217 * the primary table already contains the mac at the same index.
222 if (!table->refs[index_at_dup_port] ||
223 ((MLX4_MAC_MASK & mac) == (MLX4_MAC_MASK & be64_to_cpu(table->entries[index_at_dup_port]))))
231 if (!table->refs[i]) {
242 (MLX4_MAC_MASK & be64_to_cpu(table->entries[i]))) {
245 ++table->refs[i];
260 mlx4_warn(dev, "Fail to allocate duplicate MAC table entry\n");
272 if (table->total == table->max) {
279 table->entries[free] = cpu_to_be64(mac | MLX4_MAC_VALID);
281 err = mlx4_set_port_mac_table(dev, port, table->entries);
285 table->entries[free] = 0;
288 table->refs[free] = 1;
289 table->is_dup[free] = false;
290 ++table->total;
309 mutex_unlock(&table->mutex);
313 mutex_unlock(&table->mutex);
316 mutex_unlock(&table->mutex);
362 struct mlx4_mac_table *table;
373 table = &info->mac_table;
377 mutex_lock(&table->mutex);
381 mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
384 mutex_lock(&table->mutex);
387 index = find_index(dev, table, mac);
389 if (validate_index(dev, table, index))
392 if (--table->refs[index] || table->is_dup[index]) {
393 mlx4_dbg(dev, "Have more references for index %d, no need to modify mac table\n",
395 if (!table->refs[index])
400 table->entries[index] = 0;
401 if (mlx4_set_port_mac_table(dev, port, table->entries))
403 --table->total;
413 --table->total;
418 mutex_unlock(&table->mutex);
422 mutex_unlock(&table->mutex);
425 mutex_unlock(&table->mutex);
457 struct mlx4_mac_table *table = &info->mac_table;
467 mutex_lock(&table->mutex);
471 mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
474 mutex_lock(&table->mutex);
477 err = validate_index(dev, table, index);
481 table->entries[index] = cpu_to_be64(new_mac | MLX4_MAC_VALID);
483 err = mlx4_set_port_mac_table(dev, port, table->entries);
487 table->entries[index] = 0;
503 mutex_unlock(&table->mutex);
507 mutex_unlock(&table->mutex);
510 mutex_unlock(&table->mutex);
540 struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
544 if (table->refs[i] &&
546 be32_to_cpu(table->entries[i])))) {
560 struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
576 mutex_lock(&table->mutex);
580 mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
583 mutex_lock(&table->mutex);
586 if (table->total == table->max) {
597 if (vlan == (MLX4_VLAN_MASK & be32_to_cpu(table->entries[i])))
608 /* If the vlan is already in the primary table, the slot must be
609 * available in the duplicate table as well.
615 /* If the vlan is already in the duplicate table, check that the
616 * corresponding index is not occupied in the primary table, or
617 * the primary table already contains the vlan at the same index.
622 if (!table->refs[index_at_dup_port] ||
631 if (!table->refs[i]) {
640 if ((table->refs[i] || table->is_dup[i]) &&
642 be32_to_cpu(table->entries[i])))) {
646 ++table->refs[i];
661 mlx4_warn(dev, "Fail to allocate duplicate VLAN table entry\n");
677 table->refs[free] = 1;
678 table->is_dup[free] = false;
679 table->entries[free] = cpu_to_be32(vlan | MLX4_VLAN_VALID);
681 err = mlx4_set_port_vlan_table(dev, port, table->entries);
684 table->refs[free] = 0;
685 table->entries[free] = 0;
688 ++table->total;
708 mutex_unlock(&table->mutex);
712 mutex_unlock(&table->mutex);
715 mutex_unlock(&table->mutex);
744 struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table;
752 mutex_lock(&table->mutex);
756 mutex_lock_nested(&table->mutex, SINGLE_DEPTH_NESTING);
759 mutex_lock(&table->mutex);
763 mlx4_warn(dev, "vlan 0x%x is not in the vlan table\n", vlan);
772 if (--table->refs[index] || table->is_dup[index]) {
773 mlx4_dbg(dev, "Have %d more references for index %d, no need to modify vlan table\n",
774 table->refs[index], index);
775 if (!table->refs[index])
779 table->entries[index] = 0;
780 if (mlx4_set_port_vlan_table(dev, port, table->entries))
782 --table->total;
795 mutex_unlock(&table->mutex);
799 mutex_unlock(&table->mutex);
802 mutex_unlock(&table->mutex);
836 mlx4_warn(dev, "can't duplicate entry %d in mac table\n", i);
860 mlx4_warn(dev, "failed to set MAC table for port 1 (%d)\n", ret);
865 mlx4_warn(dev, "failed to set MAC table for port 2 (%d)\n", ret);
890 mlx4_warn(dev, "mac table is in an unexpected state when trying to unbond\n");
943 mlx4_warn(dev, "can't duplicate entry %d in vlan table\n", i);
967 mlx4_warn(dev, "failed to set VLAN table for port 1 (%d)\n", ret);
972 mlx4_warn(dev, "failed to set VLAN table for port 2 (%d)\n", ret);
997 mlx4_warn(dev, "vlan table is in an unexpected state when trying to unbond\n");
1163 /* Zero-out gids belonging to that slave in the port GID table */
1168 /* Now, copy roce port gids table to mailbox for passing to FW */
1218 mlx4_warn(dev, "Could not reset ETH port GID table for slave %d, port %d (%d)\n",
1410 * entries in the port GID table
1442 /* Now, copy roce port gids table to current mailbox for passing to FW */
1500 * MTU or PKEY table size
1864 * table and not a globally unique slave number.