Skip to contentSkip to conversation

MIPS: octeon: fix DT pruning bug with pip ports

PATCH In review Faidon Liambotis 3 participants 3 messages Jul 11, 2013 – Jul 18, 2013 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: octeon: fix DT pruning bug with pip ports

During the pruning of the device tree octeon_fdt_pip_iface() is called for each PIP interface and every port up to the port count is removed from the device tree. However, the count was set to the return value of cvmx_helper_interface_enumerate() which doesn't actually return the count but just returns zero on success. This effectively removed *all* ports from the tree.

Use cvmx_helper_ports_on_interface() instead to fix this. This successfully restores the 3 ports of my ERLite-3 and fixes the "kernel assigns random MAC addresses" issue.

---
 arch/mips/cavium-octeon/octeon-platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/cavium-octeon/octeon-platform.c +3 -2
index 389512e..250eb20 100644
@@ -334,9 +334,10 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac)
 	char name_buffer[20];
 	int iface;
 	int p;
-	int count;
+	int count = 0;
 
-	count = cvmx_helper_interface_enumerate(idx);
+	if (cvmx_helper_interface_enumerate(idx) == 0)
+		count = cvmx_helper_ports_on_interface(idx);
 
 	snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx);
 	iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer);
Signature · 1 line
1.8.3.2
Tested-by on v1 1/1
#1 lore raw
Quoted 7 lines · Faidon Liambotis

During the pruning of the device tree octeon_fdt_pip_iface() is called for each PIP interface and every port up to the port count is removed from the device tree. However, the count was set to the return value of cvmx_helper_interface_enumerate() which doesn't actually return the count but just returns zero on success. This effectively removed *all* ports from the tree.

Quoted 5 lines

Use cvmx_helper_ports_on_interface() instead to fix this. This successfully restores the 3 ports of my ERLite-3 and fixes the "kernel assigns random MAC addresses" issue.

Thanks,

A.

Quoted 25 lines
---
 arch/mips/cavium-octeon/octeon-platform.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/cavium-octeon/octeon-platform.c +3 -2
index 389512e..250eb20 100644
@@ -334,9 +334,10 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac)
 	char name_buffer[20];
 	int iface;
 	int p;
-	int count;
+	int count = 0;
 
-	count = cvmx_helper_interface_enumerate(idx);
+	if (cvmx_helper_interface_enumerate(idx) == 0)
+		count = cvmx_helper_ports_on_interface(idx);
 
 	snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx);
 	iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer);
Signature · 1 line
1.8.3.2
Acked-by on v1 1/1
#2 lore raw
In reply to Faidon Liambotis
Quoted 7 lines · Faidon Liambotis

During the pruning of the device tree octeon_fdt_pip_iface() is called for each PIP interface and every port up to the port count is removed from the device tree. However, the count was set to the return value of cvmx_helper_interface_enumerate() which doesn't actually return the count but just returns zero on success. This effectively removed *all* ports from the tree.

Quoted 5 lines

Use cvmx_helper_ports_on_interface() instead to fix this. This successfully restores the 3 ports of my ERLite-3 and fixes the "kernel assigns random MAC addresses" issue.

Yes, this seems to be correct. It doesn't seem to break my ebt3000 board so...

Ralf, please try to get it merged for 3.11, thanks.

Quoted 22 lines
---
  arch/mips/cavium-octeon/octeon-platform.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
arch/mips/cavium-octeon/octeon-platform.c +3 -2
index 389512e..250eb20 100644
@@ -334,9 +334,10 @@ static void __init octeon_fdt_pip_iface(int pip, int idx, u64 *pmac)
  	char name_buffer[20];
  	int iface;
  	int p;
-	int count;
+	int count = 0;
 
-	count = cvmx_helper_interface_enumerate(idx);
+	if (cvmx_helper_interface_enumerate(idx) == 0)
+		count = cvmx_helper_ports_on_interface(idx);
 
  	snprintf(name_buffer, sizeof(name_buffer), "interface@%d", idx);
  	iface = fdt_subnode_offset(initial_boot_params, pip, name_buffer);