Message ID | 12a1d143-35d6-43f3-b8b3-ab0198f5540a@ans.pl (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,1/4] mlx4/mlx5: {mlx4,mlx5e}_en_get_module_info cleanup | expand |
On 11.09.2024 at 23:40, Krzysztof Olędzki wrote: > Use MLX4_ATTR_CABLE_INFO instead of 0xFF60 magic value. > > Also, remove MLX4_ATTR_EXTENDED_PORT_INFO which should have been done in > commit 8154c07fe14e ("mlx4_core: Get rid of redundant ext_port_cap flags"). Turns out this is not true, as it is still used in ib_link_query_port() from drivers/infiniband/hw/mlx4/main.c Will wait for other comments and then send v2, for consistency how about I'll move cpu_to_be16() into that function? > > Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl> > --- > drivers/net/ethernet/mellanox/mlx4/port.c | 8 ++++---- > include/linux/mlx4/device.h | 2 +- > 2 files changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c > index 6dbd505e7f30..1ebd459d1d21 100644 > --- a/drivers/net/ethernet/mellanox/mlx4/port.c > +++ b/drivers/net/ethernet/mellanox/mlx4/port.c > @@ -2052,7 +2052,7 @@ static int mlx4_get_module_id(struct mlx4_dev *dev, u8 port, u8 *module_id) > inmad->class_version = 0x1; > inmad->mgmt_class = 0x1; > inmad->base_version = 0x1; > - inmad->attr_id = cpu_to_be16(0xFF60); /* Module Info */ > + inmad->attr_id = cpu_to_be16(MLX4_ATTR_CABLE_INFO); > > cable_info = (struct mlx4_cable_info *)inmad->data; > cable_info->dev_mem_address = 0; > @@ -2071,7 +2071,7 @@ static int mlx4_get_module_id(struct mlx4_dev *dev, u8 port, u8 *module_id) > ret = be16_to_cpu(outmad->status); > mlx4_warn(dev, > "MLX4_CMD_MAD_IFC Get Module ID attr(%x) port(%d) i2c_addr(%x) offset(%d) size(%d): Response Mad Status(%x) - %s\n", > - 0xFF60, port, I2C_ADDR_LOW, 0, 1, ret, > + MLX4_ATTR_CABLE_INFO, port, I2C_ADDR_LOW, 0, 1, ret, > cable_info_mad_err_str(ret)); > ret = -ret; > goto out; > @@ -2170,7 +2170,7 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, > inmad->class_version = 0x1; > inmad->mgmt_class = 0x1; > inmad->base_version = 0x1; > - inmad->attr_id = cpu_to_be16(0xFF60); /* Module Info */ > + inmad->attr_id = cpu_to_be16(MLX4_ATTR_CABLE_INFO); > > if (offset < I2C_PAGE_SIZE && offset + size > I2C_PAGE_SIZE) > /* Cross pages reads are not allowed > @@ -2195,7 +2195,7 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, > ret = be16_to_cpu(outmad->status); > mlx4_warn(dev, > "MLX4_CMD_MAD_IFC Get Module info attr(%x) port(%d) i2c_addr(%x) offset(%d) size(%d): Response Mad Status(%x) - %s\n", > - 0xFF60, port, i2c_addr, offset, size, > + MLX4_ATTR_CABLE_INFO, port, i2c_addr, offset, size, > ret, cable_info_mad_err_str(ret)); > > if (i2c_addr == I2C_ADDR_HIGH && > diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h > index a75bfb2a4438..4f2ff466b459 100644 > --- a/include/linux/mlx4/device.h > +++ b/include/linux/mlx4/device.h > @@ -265,7 +265,7 @@ enum { > }; > > > -#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) > +#define MLX4_ATTR_CABLE_INFO 0xff60 > > enum { > MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1,
Hi Krzysztof,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Ol-dzki/mlx4-Use-MLX4_ATTR_CABLE_INFO-instead-of-0xFF60-magic-value/20240912-144426
base: net-next/main
patch link: https://lore.kernel.org/r/12a1d143-35d6-43f3-b8b3-ab0198f5540a%40ans.pl
patch subject: [PATCH net-next 2/4] mlx4: Use MLX4_ATTR_CABLE_INFO instead of 0xFF60 magic value
config: loongarch-allmodconfig (https://download.01.org/0day-ci/archive/20240913/202409131225.ZqIX7nce-lkp@intel.com/config)
compiler: loongarch64-linux-gcc (GCC) 14.1.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240913/202409131225.ZqIX7nce-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409131225.ZqIX7nce-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/infiniband/hw/mlx4/main.c: In function 'ib_link_query_port':
>> drivers/infiniband/hw/mlx4/main.c:722:35: error: 'MLX4_ATTR_EXTENDED_PORT_INFO' undeclared (first use in this function)
722 | in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/infiniband/hw/mlx4/main.c:722:35: note: each undeclared identifier is reported only once for each function it appears in
vim +/MLX4_ATTR_EXTENDED_PORT_INFO +722 drivers/infiniband/hw/mlx4/main.c
225c7b1feef1b4 Roland Dreier 2007-05-08 654
1fb7f8973f51ca Mark Bloch 2021-03-01 655 static int ib_link_query_port(struct ib_device *ibdev, u32 port,
0a9a01884d447c Jack Morgenstein 2012-08-03 656 struct ib_port_attr *props, int netw_view)
fa417f7b520ee6 Eli Cohen 2010-10-24 657 {
a45e5f1859579f Ruan Jinjie 2023-07-28 658 struct ib_smp *in_mad;
a45e5f1859579f Ruan Jinjie 2023-07-28 659 struct ib_smp *out_mad;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 660 int ext_active_speed;
0a9a01884d447c Jack Morgenstein 2012-08-03 661 int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS;
a9c766bb75ee2c Or Gerlitz 2012-01-11 662 int err = -ENOMEM;
a9c766bb75ee2c Or Gerlitz 2012-01-11 663
a9c766bb75ee2c Or Gerlitz 2012-01-11 664 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
a9c766bb75ee2c Or Gerlitz 2012-01-11 665 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
a9c766bb75ee2c Or Gerlitz 2012-01-11 666 if (!in_mad || !out_mad)
a9c766bb75ee2c Or Gerlitz 2012-01-11 667 goto out;
a9c766bb75ee2c Or Gerlitz 2012-01-11 668
d82e2b27ad3a4f Leon Romanovsky 2022-01-05 669 ib_init_query_mad(in_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 670 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO;
a9c766bb75ee2c Or Gerlitz 2012-01-11 671 in_mad->attr_mod = cpu_to_be32(port);
a9c766bb75ee2c Or Gerlitz 2012-01-11 672
0a9a01884d447c Jack Morgenstein 2012-08-03 673 if (mlx4_is_mfunc(to_mdev(ibdev)->dev) && netw_view)
0a9a01884d447c Jack Morgenstein 2012-08-03 674 mad_ifc_flags |= MLX4_MAD_IFC_NET_VIEW;
0a9a01884d447c Jack Morgenstein 2012-08-03 675
0a9a01884d447c Jack Morgenstein 2012-08-03 676 err = mlx4_MAD_IFC(to_mdev(ibdev), mad_ifc_flags, port, NULL, NULL,
a9c766bb75ee2c Or Gerlitz 2012-01-11 677 in_mad, out_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 678 if (err)
a9c766bb75ee2c Or Gerlitz 2012-01-11 679 goto out;
a9c766bb75ee2c Or Gerlitz 2012-01-11 680
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 681
225c7b1feef1b4 Roland Dreier 2007-05-08 682 props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16));
225c7b1feef1b4 Roland Dreier 2007-05-08 683 props->lmc = out_mad->data[34] & 0x7;
225c7b1feef1b4 Roland Dreier 2007-05-08 684 props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18));
225c7b1feef1b4 Roland Dreier 2007-05-08 685 props->sm_sl = out_mad->data[36] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 686 props->state = out_mad->data[32] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 687 props->phys_state = out_mad->data[33] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 688 props->port_cap_flags = be32_to_cpup((__be32 *) (out_mad->data + 20));
0a9a01884d447c Jack Morgenstein 2012-08-03 689 if (netw_view)
0a9a01884d447c Jack Morgenstein 2012-08-03 690 props->gid_tbl_len = out_mad->data[50];
0a9a01884d447c Jack Morgenstein 2012-08-03 691 else
5ae2a7a836be66 Roland Dreier 2007-06-18 692 props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port];
149983af609e8f Dotan Barak 2007-06-26 693 props->max_msg_sz = to_mdev(ibdev)->dev->caps.max_msg_sz;
5ae2a7a836be66 Roland Dreier 2007-06-18 694 props->pkey_tbl_len = to_mdev(ibdev)->dev->caps.pkey_table_len[port];
225c7b1feef1b4 Roland Dreier 2007-05-08 695 props->bad_pkey_cntr = be16_to_cpup((__be16 *) (out_mad->data + 46));
225c7b1feef1b4 Roland Dreier 2007-05-08 696 props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48));
225c7b1feef1b4 Roland Dreier 2007-05-08 697 props->active_width = out_mad->data[31] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 698 props->active_speed = out_mad->data[35] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 699 props->max_mtu = out_mad->data[41] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 700 props->active_mtu = out_mad->data[36] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 701 props->subnet_timeout = out_mad->data[51] & 0x1f;
225c7b1feef1b4 Roland Dreier 2007-05-08 702 props->max_vl_num = out_mad->data[37] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 703 props->init_type_reply = out_mad->data[41] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 704
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 705 /* Check if extended speeds (EDR/FDR/...) are supported */
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 706 if (props->port_cap_flags & IB_PORT_EXTENDED_SPEEDS_SUP) {
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 707 ext_active_speed = out_mad->data[62] >> 4;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 708
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 709 switch (ext_active_speed) {
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 710 case 1:
2e96691c31ecf7 Or Gerlitz 2012-02-28 711 props->active_speed = IB_SPEED_FDR;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 712 break;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 713 case 2:
2e96691c31ecf7 Or Gerlitz 2012-02-28 714 props->active_speed = IB_SPEED_EDR;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 715 break;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 716 }
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 717 }
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 718
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 719 /* If reported active speed is QDR, check if is FDR-10 */
2e96691c31ecf7 Or Gerlitz 2012-02-28 720 if (props->active_speed == IB_SPEED_QDR) {
d82e2b27ad3a4f Leon Romanovsky 2022-01-05 721 ib_init_query_mad(in_mad);
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 @722 in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 723 in_mad->attr_mod = cpu_to_be32(port);
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 724
0a9a01884d447c Jack Morgenstein 2012-08-03 725 err = mlx4_MAD_IFC(to_mdev(ibdev), mad_ifc_flags, port,
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 726 NULL, NULL, in_mad, out_mad);
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 727 if (err)
bf6b47deb40f9f Jesper Juhl 2012-04-11 728 goto out;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 729
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 730 /* Checking LinkSpeedActive for FDR-10 */
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 731 if (out_mad->data[15] & 0x1)
2e96691c31ecf7 Or Gerlitz 2012-02-28 732 props->active_speed = IB_SPEED_FDR10;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 733 }
d2ef406866620f Or Gerlitz 2012-04-02 734
d2ef406866620f Or Gerlitz 2012-04-02 735 /* Avoid wrong speed value returned by FW if the IB link is down. */
d2ef406866620f Or Gerlitz 2012-04-02 736 if (props->state == IB_PORT_DOWN)
d2ef406866620f Or Gerlitz 2012-04-02 737 props->active_speed = IB_SPEED_SDR;
d2ef406866620f Or Gerlitz 2012-04-02 738
a9c766bb75ee2c Or Gerlitz 2012-01-11 739 out:
a9c766bb75ee2c Or Gerlitz 2012-01-11 740 kfree(in_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 741 kfree(out_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 742 return err;
fa417f7b520ee6 Eli Cohen 2010-10-24 743 }
fa417f7b520ee6 Eli Cohen 2010-10-24 744
Hi Krzysztof,
kernel test robot noticed the following build errors:
[auto build test ERROR on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Ol-dzki/mlx4-Use-MLX4_ATTR_CABLE_INFO-instead-of-0xFF60-magic-value/20240912-144426
base: net-next/main
patch link: https://lore.kernel.org/r/12a1d143-35d6-43f3-b8b3-ab0198f5540a%40ans.pl
patch subject: [PATCH net-next 2/4] mlx4: Use MLX4_ATTR_CABLE_INFO instead of 0xFF60 magic value
config: s390-defconfig (https://download.01.org/0day-ci/archive/20240913/202409131245.mVHqb5R3-lkp@intel.com/config)
compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project bf684034844c660b778f0eba103582f582b710c9)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240913/202409131245.mVHqb5R3-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409131245.mVHqb5R3-lkp@intel.com/
All errors (new ones prefixed by >>):
In file included from drivers/infiniband/hw/mlx4/main.c:34:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:181:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2232:
include/linux/vmstat.h:503:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
503 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
504 | item];
| ~~~~
include/linux/vmstat.h:510:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
510 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
511 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:517:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
517 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:523:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
523 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
524 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/infiniband/hw/mlx4/main.c:38:
In file included from include/linux/netdevice.h:38:
In file included from include/net/net_namespace.h:43:
In file included from include/linux/skbuff.h:28:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:93:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
| ^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
102 | #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
| ^
In file included from drivers/infiniband/hw/mlx4/main.c:38:
In file included from include/linux/netdevice.h:38:
In file included from include/net/net_namespace.h:43:
In file included from include/linux/skbuff.h:28:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:93:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
| ^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
115 | #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
| ^
In file included from drivers/infiniband/hw/mlx4/main.c:38:
In file included from include/linux/netdevice.h:38:
In file included from include/net/net_namespace.h:43:
In file included from include/linux/skbuff.h:28:
In file included from include/linux/dma-mapping.h:11:
In file included from include/linux/scatterlist.h:9:
In file included from arch/s390/include/asm/io.h:93:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
693 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
701 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
709 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
718 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
727 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
736 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
>> drivers/infiniband/hw/mlx4/main.c:722:21: error: use of undeclared identifier 'MLX4_ATTR_EXTENDED_PORT_INFO'
722 | in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO;
| ^
16 warnings and 1 error generated.
vim +/MLX4_ATTR_EXTENDED_PORT_INFO +722 drivers/infiniband/hw/mlx4/main.c
225c7b1feef1b4 Roland Dreier 2007-05-08 654
1fb7f8973f51ca Mark Bloch 2021-03-01 655 static int ib_link_query_port(struct ib_device *ibdev, u32 port,
0a9a01884d447c Jack Morgenstein 2012-08-03 656 struct ib_port_attr *props, int netw_view)
fa417f7b520ee6 Eli Cohen 2010-10-24 657 {
a45e5f1859579f Ruan Jinjie 2023-07-28 658 struct ib_smp *in_mad;
a45e5f1859579f Ruan Jinjie 2023-07-28 659 struct ib_smp *out_mad;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 660 int ext_active_speed;
0a9a01884d447c Jack Morgenstein 2012-08-03 661 int mad_ifc_flags = MLX4_MAD_IFC_IGNORE_KEYS;
a9c766bb75ee2c Or Gerlitz 2012-01-11 662 int err = -ENOMEM;
a9c766bb75ee2c Or Gerlitz 2012-01-11 663
a9c766bb75ee2c Or Gerlitz 2012-01-11 664 in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL);
a9c766bb75ee2c Or Gerlitz 2012-01-11 665 out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL);
a9c766bb75ee2c Or Gerlitz 2012-01-11 666 if (!in_mad || !out_mad)
a9c766bb75ee2c Or Gerlitz 2012-01-11 667 goto out;
a9c766bb75ee2c Or Gerlitz 2012-01-11 668
d82e2b27ad3a4f Leon Romanovsky 2022-01-05 669 ib_init_query_mad(in_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 670 in_mad->attr_id = IB_SMP_ATTR_PORT_INFO;
a9c766bb75ee2c Or Gerlitz 2012-01-11 671 in_mad->attr_mod = cpu_to_be32(port);
a9c766bb75ee2c Or Gerlitz 2012-01-11 672
0a9a01884d447c Jack Morgenstein 2012-08-03 673 if (mlx4_is_mfunc(to_mdev(ibdev)->dev) && netw_view)
0a9a01884d447c Jack Morgenstein 2012-08-03 674 mad_ifc_flags |= MLX4_MAD_IFC_NET_VIEW;
0a9a01884d447c Jack Morgenstein 2012-08-03 675
0a9a01884d447c Jack Morgenstein 2012-08-03 676 err = mlx4_MAD_IFC(to_mdev(ibdev), mad_ifc_flags, port, NULL, NULL,
a9c766bb75ee2c Or Gerlitz 2012-01-11 677 in_mad, out_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 678 if (err)
a9c766bb75ee2c Or Gerlitz 2012-01-11 679 goto out;
a9c766bb75ee2c Or Gerlitz 2012-01-11 680
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 681
225c7b1feef1b4 Roland Dreier 2007-05-08 682 props->lid = be16_to_cpup((__be16 *) (out_mad->data + 16));
225c7b1feef1b4 Roland Dreier 2007-05-08 683 props->lmc = out_mad->data[34] & 0x7;
225c7b1feef1b4 Roland Dreier 2007-05-08 684 props->sm_lid = be16_to_cpup((__be16 *) (out_mad->data + 18));
225c7b1feef1b4 Roland Dreier 2007-05-08 685 props->sm_sl = out_mad->data[36] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 686 props->state = out_mad->data[32] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 687 props->phys_state = out_mad->data[33] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 688 props->port_cap_flags = be32_to_cpup((__be32 *) (out_mad->data + 20));
0a9a01884d447c Jack Morgenstein 2012-08-03 689 if (netw_view)
0a9a01884d447c Jack Morgenstein 2012-08-03 690 props->gid_tbl_len = out_mad->data[50];
0a9a01884d447c Jack Morgenstein 2012-08-03 691 else
5ae2a7a836be66 Roland Dreier 2007-06-18 692 props->gid_tbl_len = to_mdev(ibdev)->dev->caps.gid_table_len[port];
149983af609e8f Dotan Barak 2007-06-26 693 props->max_msg_sz = to_mdev(ibdev)->dev->caps.max_msg_sz;
5ae2a7a836be66 Roland Dreier 2007-06-18 694 props->pkey_tbl_len = to_mdev(ibdev)->dev->caps.pkey_table_len[port];
225c7b1feef1b4 Roland Dreier 2007-05-08 695 props->bad_pkey_cntr = be16_to_cpup((__be16 *) (out_mad->data + 46));
225c7b1feef1b4 Roland Dreier 2007-05-08 696 props->qkey_viol_cntr = be16_to_cpup((__be16 *) (out_mad->data + 48));
225c7b1feef1b4 Roland Dreier 2007-05-08 697 props->active_width = out_mad->data[31] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 698 props->active_speed = out_mad->data[35] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 699 props->max_mtu = out_mad->data[41] & 0xf;
225c7b1feef1b4 Roland Dreier 2007-05-08 700 props->active_mtu = out_mad->data[36] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 701 props->subnet_timeout = out_mad->data[51] & 0x1f;
225c7b1feef1b4 Roland Dreier 2007-05-08 702 props->max_vl_num = out_mad->data[37] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 703 props->init_type_reply = out_mad->data[41] >> 4;
225c7b1feef1b4 Roland Dreier 2007-05-08 704
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 705 /* Check if extended speeds (EDR/FDR/...) are supported */
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 706 if (props->port_cap_flags & IB_PORT_EXTENDED_SPEEDS_SUP) {
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 707 ext_active_speed = out_mad->data[62] >> 4;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 708
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 709 switch (ext_active_speed) {
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 710 case 1:
2e96691c31ecf7 Or Gerlitz 2012-02-28 711 props->active_speed = IB_SPEED_FDR;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 712 break;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 713 case 2:
2e96691c31ecf7 Or Gerlitz 2012-02-28 714 props->active_speed = IB_SPEED_EDR;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 715 break;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 716 }
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 717 }
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 718
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 719 /* If reported active speed is QDR, check if is FDR-10 */
2e96691c31ecf7 Or Gerlitz 2012-02-28 720 if (props->active_speed == IB_SPEED_QDR) {
d82e2b27ad3a4f Leon Romanovsky 2022-01-05 721 ib_init_query_mad(in_mad);
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 @722 in_mad->attr_id = MLX4_ATTR_EXTENDED_PORT_INFO;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 723 in_mad->attr_mod = cpu_to_be32(port);
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 724
0a9a01884d447c Jack Morgenstein 2012-08-03 725 err = mlx4_MAD_IFC(to_mdev(ibdev), mad_ifc_flags, port,
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 726 NULL, NULL, in_mad, out_mad);
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 727 if (err)
bf6b47deb40f9f Jesper Juhl 2012-04-11 728 goto out;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 729
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 730 /* Checking LinkSpeedActive for FDR-10 */
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 731 if (out_mad->data[15] & 0x1)
2e96691c31ecf7 Or Gerlitz 2012-02-28 732 props->active_speed = IB_SPEED_FDR10;
a5e12dff757b56 Marcel Apfelbaum 2011-10-03 733 }
d2ef406866620f Or Gerlitz 2012-04-02 734
d2ef406866620f Or Gerlitz 2012-04-02 735 /* Avoid wrong speed value returned by FW if the IB link is down. */
d2ef406866620f Or Gerlitz 2012-04-02 736 if (props->state == IB_PORT_DOWN)
d2ef406866620f Or Gerlitz 2012-04-02 737 props->active_speed = IB_SPEED_SDR;
d2ef406866620f Or Gerlitz 2012-04-02 738
a9c766bb75ee2c Or Gerlitz 2012-01-11 739 out:
a9c766bb75ee2c Or Gerlitz 2012-01-11 740 kfree(in_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 741 kfree(out_mad);
a9c766bb75ee2c Or Gerlitz 2012-01-11 742 return err;
fa417f7b520ee6 Eli Cohen 2010-10-24 743 }
fa417f7b520ee6 Eli Cohen 2010-10-24 744
diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c index 6dbd505e7f30..1ebd459d1d21 100644 --- a/drivers/net/ethernet/mellanox/mlx4/port.c +++ b/drivers/net/ethernet/mellanox/mlx4/port.c @@ -2052,7 +2052,7 @@ static int mlx4_get_module_id(struct mlx4_dev *dev, u8 port, u8 *module_id) inmad->class_version = 0x1; inmad->mgmt_class = 0x1; inmad->base_version = 0x1; - inmad->attr_id = cpu_to_be16(0xFF60); /* Module Info */ + inmad->attr_id = cpu_to_be16(MLX4_ATTR_CABLE_INFO); cable_info = (struct mlx4_cable_info *)inmad->data; cable_info->dev_mem_address = 0; @@ -2071,7 +2071,7 @@ static int mlx4_get_module_id(struct mlx4_dev *dev, u8 port, u8 *module_id) ret = be16_to_cpu(outmad->status); mlx4_warn(dev, "MLX4_CMD_MAD_IFC Get Module ID attr(%x) port(%d) i2c_addr(%x) offset(%d) size(%d): Response Mad Status(%x) - %s\n", - 0xFF60, port, I2C_ADDR_LOW, 0, 1, ret, + MLX4_ATTR_CABLE_INFO, port, I2C_ADDR_LOW, 0, 1, ret, cable_info_mad_err_str(ret)); ret = -ret; goto out; @@ -2170,7 +2170,7 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, inmad->class_version = 0x1; inmad->mgmt_class = 0x1; inmad->base_version = 0x1; - inmad->attr_id = cpu_to_be16(0xFF60); /* Module Info */ + inmad->attr_id = cpu_to_be16(MLX4_ATTR_CABLE_INFO); if (offset < I2C_PAGE_SIZE && offset + size > I2C_PAGE_SIZE) /* Cross pages reads are not allowed @@ -2195,7 +2195,7 @@ int mlx4_get_module_info(struct mlx4_dev *dev, u8 port, ret = be16_to_cpu(outmad->status); mlx4_warn(dev, "MLX4_CMD_MAD_IFC Get Module info attr(%x) port(%d) i2c_addr(%x) offset(%d) size(%d): Response Mad Status(%x) - %s\n", - 0xFF60, port, i2c_addr, offset, size, + MLX4_ATTR_CABLE_INFO, port, i2c_addr, offset, size, ret, cable_info_mad_err_str(ret)); if (i2c_addr == I2C_ADDR_HIGH && diff --git a/include/linux/mlx4/device.h b/include/linux/mlx4/device.h index a75bfb2a4438..4f2ff466b459 100644 --- a/include/linux/mlx4/device.h +++ b/include/linux/mlx4/device.h @@ -265,7 +265,7 @@ enum { }; -#define MLX4_ATTR_EXTENDED_PORT_INFO cpu_to_be16(0xff90) +#define MLX4_ATTR_CABLE_INFO 0xff60 enum { MLX4_BMME_FLAG_WIN_TYPE_2B = 1 << 1,
Use MLX4_ATTR_CABLE_INFO instead of 0xFF60 magic value. Also, remove MLX4_ATTR_EXTENDED_PORT_INFO which should have been done in commit 8154c07fe14e ("mlx4_core: Get rid of redundant ext_port_cap flags"). Signed-off-by: Krzysztof Piotr Oledzki <ole@ans.pl> --- drivers/net/ethernet/mellanox/mlx4/port.c | 8 ++++---- include/linux/mlx4/device.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)