Skip to contentSkip to conversation

net/mlx4e: Remove redundant definition of IB_MTU_XXX

PATCH In review Leon Romanovsky 2 participants 4 messages Jun 16, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx4e: Remove redundant definition of IB_MTU_XXX

From: Mark Zhang <[email protected]>

Remove them to avoid "redeclaration of enumerator" build error, as they are already defined in ib_verbs.h. This is needed for the following patch, which need to include the ib_verbs.h.

Fixes 096335b3f983 ("mlx4_core: Allow dynamic MTU configuration for IB ports")
---
 drivers/net/ethernet/mellanox/mlx4/main.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlx4/main.c +3 -9
index febeadfdd5a5..03d2fc7d9b09 100644
@@ -49,6 +49,8 @@
 #include <linux/mlx4/device.h>
 #include <linux/mlx4/doorbell.h>
 
+#include <rdma/ib_verbs.h>
+
 #include "mlx4.h"
 #include "fw.h"
 #include "icm.h"
@@ -1246,14 +1248,6 @@ static ssize_t set_port_type(struct device *dev,
 	return err ? err : count;
 }
 
-enum ibta_mtu {
-	IB_MTU_256  = 1,
-	IB_MTU_512  = 2,
-	IB_MTU_1024 = 3,
-	IB_MTU_2048 = 4,
-	IB_MTU_4096 = 5
-};
-
 static inline int int_to_ibta_mtu(int mtu)
 {
 	switch (mtu) {
@@ -1266,7 +1260,7 @@ static inline int int_to_ibta_mtu(int mtu)
 	}
 }
 
-static inline int ibta_mtu_to_int(enum ibta_mtu mtu)
+static inline int ibta_mtu_to_int(enum ib_mtu mtu)
 {
 	switch (mtu) {
 	case IB_MTU_256:  return  256;
Signature · 1 line
2.49.0
reviewer
#1 lore raw
Quoted 10 lines · Leon Romanovsky

From: Mark Zhang <[email protected]>

Remove them to avoid "redeclaration of enumerator" build error, as they are already defined in ib_verbs.h. This is needed for the following patch, which need to include the ib_verbs.h.

Fixes 096335b3f983 ("mlx4_core: Allow dynamic MTU configuration for IB ports")

Hi Mark, Leon, all,

If I understand things correctly, without this patch the driver compiles and functions correctly. But if it is modified to include rdma/ib_verbs.h, which is required for some other forthcoming change, then the other parts of this patch are needed to avoid a build failure.

If so, this doesn't match my understanding of a bug fix. Rather, it seems like a change (for net-next; no fixess tag?) which could be included in the patch-set that needs rdma/ib_verbs.h included in this file.

#2 lore raw
Quoted 12 lines · Simon Horman
Quoted 10 lines · Leon Romanovsky

From: Mark Zhang <[email protected]>

Remove them to avoid "redeclaration of enumerator" build error, as they are already defined in ib_verbs.h. This is needed for the following patch, which need to include the ib_verbs.h.

Fixes 096335b3f983 ("mlx4_core: Allow dynamic MTU configuration for IB ports")
Quoted 7 lines

Hi Mark, Leon, all,

If I understand things correctly, without this patch the driver compiles and functions correctly. But if it is modified to include rdma/ib_verbs.h, which is required for some other forthcoming change, then the other parts of this patch are needed to avoid a build failure.

Yes, the inclusion of rdma/ib_verbs.h was needed for series, which at the end doesn't need it. I can drop Fixes line if it is important.

There is no following patches for this. It is standalone change.

Thanks

reviewer
#3 lore raw
Quoted 21 lines · Leon Romanovsky
Quoted 12 lines · Simon Horman
Quoted 10 lines · Leon Romanovsky

From: Mark Zhang <[email protected]>

Remove them to avoid "redeclaration of enumerator" build error, as they are already defined in ib_verbs.h. This is needed for the following patch, which need to include the ib_verbs.h.

Fixes 096335b3f983 ("mlx4_core: Allow dynamic MTU configuration for IB ports")
Quoted 7 lines

Hi Mark, Leon, all,

If I understand things correctly, without this patch the driver compiles and functions correctly. But if it is modified to include rdma/ib_verbs.h, which is required for some other forthcoming change, then the other parts of this patch are needed to avoid a build failure.

Quoted 4 lines

Yes, the inclusion of rdma/ib_verbs.h was needed for series, which at the end doesn't need it. I can drop Fixes line if it is important.

There is no following patches for this. It is standalone change.

Sure, that is fine by me.
But please drop the Fixes tag and resubmit for net-next.

Thanks