Modify

Opened 6 years ago

Last modified 4 years ago

#10357 reopened defect

DIR-825 B2 (AR7161) - wireless still broken by default

Reported by: anonymous Owned by: juhosg
Priority: normal Milestone: Chaos Calmer 15.05
Component: base system Version: Backfire 10.03.1 RC5
Keywords: Cc:

Description

I have excatly the same problem as in /ticket/9669.html.
I tried 10.03.1 release candidates 4 to 6. RC6 should have the latest fix, but it still doesn't work for me.

{{{config wifi-device radio0

option type mac80211
option channel 11
option macaddr 00:00:00:00:00:00
option hwmode 11ng
option htmode HT20
list ht_capab SHORT-GI-40
list ht_capab TX-STBC
list ht_capab RX-STBC1
list ht_capab DSSS_CCK-40
# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 0

config wifi-iface

option device radio0
option network lan
option mode ap
option ssid OpenWrt
option encryption none

}}}

{{{root@VW:/etc/config# wifi
'radio1' is disabled
Configuration file: /var/run/hostapd-phy0.conf
Could not set interface wlan0 flags: Cannot assign requested address
nl80211: Could not set interface 'wlan0' UP
nl80211 driver initialization failed.
rmdir[ctrl_interface]: No such file or directory
Failed to start hostapd for phy0
'radio1' is disabled

}}}


Attachments (0)

Change History (20)

comment:1 follow-up: Changed 6 years ago by Pilot6 <hanipouspilot@…>

It works in trunk. It must be backported.

comment:2 in reply to: ↑ 1 Changed 6 years ago by anonymous

Replying to Pilot6 <hanipouspilot@…>:

It works in trunk. It must be backported.

So do you have any suggestion how to make it work for me?

comment:3 Changed 6 years ago by anonymous

The trunk snapshot works for me, too. But I can't get the web interface online :(

comment:4 Changed 6 years ago by Pilot6 <hanipouspilot@…>

There is no web interface in trunk snapshots. Install Luci

opkg install luci

And this is not a forum.

comment:5 Changed 6 years ago by jow

  • Owner changed from developers to juhosg
  • Status changed from new to assigned

comment:6 Changed 6 years ago by jow

  • Resolution set to wontfix
  • Status changed from assigned to closed

Sorry guys, the required backports for this are massive (r22700 in particular) - I'll not fold this into 10.03.1 anymore.

comment:7 Changed 6 years ago by Pilot6 <hanipouspilot@…>

  • Resolution wontfix deleted
  • Status changed from closed to reopened

Jow, you are not right. All the people want is to backport r28295. With this patch all B* revisions of DIR-825 work perfectly. I applied this patch to Backfire long ago. Without this patch wireless does not work on B2 revision (or part of them).
It is a small patch, there is no problem to backport.

comment:8 Changed 6 years ago by jow

  • Resolution set to invalid
  • Status changed from reopened to closed

And did you look what functions this "small patch" depends on? Did you notice that those are not present in backfire? Did you follow the changes through that introduce those functions? Did you test the resulting images on both new and old models?

comment:9 Changed 6 years ago by Pilot6 <hanipouspilot@…>

Oops! I have my own "stable" branch similar to Backfire. I did not notice backfire lack some functions. But still there is a problem that Backfire is not usable for DIR-825 any more. It makes sense not to backport majior patches, but maybe in this case some workaround must be found to support this target.
It happenwd that in Russia most of the people download my builds for DIR-825 and Tp-Link 1043 and from some other people. But it is not fair for the rest of the world.
The main problem is the location of wireless MACs in caldata. It is simple.

comment:10 Changed 6 years ago by jow

Look, if it is that simple why don't you provide an isolated patch then which can be applied to vanilla Backfire?

comment:11 Changed 6 years ago by Pilot6 <hanipouspilot@…>

OK. Tomorrow I will spend some time to make this patch. It will be not so easy for me, because I need to get back to Backfire. But the patch will be simple.

comment:12 Changed 6 years ago by jow

This is the most minimal variant I came up with, compile tested only. Someone who owns such a unit should test the patch and see if it works, especially if the mac addresses are identical on all interfaces.

Index: target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c
===================================================================
--- target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c	(revision 29022)
+++ target/linux/ar71xx/files/arch/mips/ar71xx/mach-dir-825-b1.c	(working copy)
@@ -44,8 +44,8 @@
 #define DIR825B1_CAL_LOCATION_0			0x1f661000
 #define DIR825B1_CAL_LOCATION_1			0x1f665000
 
-#define DIR825B1_MAC_LOCATION_0			0x2ffa81b8
-#define DIR825B1_MAC_LOCATION_1			0x2ffa8370
+#define DIR825B1_MAC_LOCATION_0			0x1f66ffa0
+#define DIR825B1_MAC_LOCATION_1			0x1f66ffb4
 
 #ifdef CONFIG_MTD_PARTITIONS
 static struct mtd_partition dir825b1_partitions[] = {
@@ -149,15 +149,38 @@
 	}
 };
 
+static void dir825b1_read_ascii_mac(u8 *dest, unsigned int src_addr, int off)
+{
+	int ret;
+	u32 add;
+	u8 *src = (u8 *)KSEG1ADDR(src_addr);
+
+	ret = sscanf(src, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+	             &dest[0], &dest[1], &dest[2],
+	             &dest[3], &dest[4], &dest[5]);
+
+	if (ret != ETH_ALEN) {
+		memset(dest, 0, ETH_ALEN);
+		return;
+	}
+
+	add = (((u32)dest[3]) << 16) + (((u32)dest[4]) << 8) + ((u32)dest[5]);
+	add += off;
+
+	dest[3] = (add >> 16) & 0xFF;
+	dest[4] = (add >> 8) & 0xFF;
+	dest[5] = add & 0xFF;
+}
+
 static void __init dir825b1_setup(void)
 {
-        u8 mac[6], i;
+	u8 mac_base[ETH_ALEN], wmac1[ETH_ALEN], wmac2[ETH_ALEN];
 
-	memcpy(mac, (u8*)KSEG1ADDR(DIR825B1_MAC_LOCATION_1), 6);
-	for(i = 5; i >= 3; i--)
-		if(++mac[i] != 0x00) break;
+	dir825b1_read_ascii_mac(mac_base, DIR825B1_MAC_LOCATION_0, 2);
+	dir825b1_read_ascii_mac(wmac1,    DIR825B1_MAC_LOCATION_0, 0);
+	dir825b1_read_ascii_mac(wmac2,    DIR825B1_MAC_LOCATION_1, 0);
 
-	ar71xx_set_mac_base(mac);
+	ar71xx_set_mac_base(mac_base);
 
 	ar71xx_add_device_mdio(0x0);
 
@@ -191,10 +214,8 @@
 	ap94_pci_setup_wmac_led_pin(0, 5);
 	ap94_pci_setup_wmac_led_pin(1, 5);
 
-	ap94_pci_init((u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0),
-		      (u8 *) KSEG1ADDR(DIR825B1_MAC_LOCATION_0),
-		      (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_1),
-		      (u8 *) KSEG1ADDR(DIR825B1_MAC_LOCATION_1));
+	ap94_pci_init((u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0), wmac1,
+	              (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_1), wmac2);
 }
 
 MIPS_MACHINE(AR71XX_MACH_DIR_825_B1, "DIR-825-B1", "D-Link DIR-825 rev. B1",

comment:13 Changed 6 years ago by Pilot6 <hanipouspilot@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

I just finished writing mine, checked E-mail and saw you've done too )).
I tested yours. It is fine. I got MAC exactly the one written on a sticker.

comment:14 Changed 6 years ago by Pilot6 <hanipouspilot@…>

The only one comment. It may happen with not all revisions. I get this.

mon.wlan0 Link encap:UNSPEC  HWaddr 00-18-E7-8C-3F-71-00-47-00-00-00-00-00-00-00-00

00-18-E7-8C-3F-71

This is the correct mac. But we read it too long.
But all the rest is OK.

wlan0     Link encap:Ethernet  HWaddr 00:18:E7:8C:3F:71
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:11 errors:0 dropped:0 overruns:0 frame:0
          TX packets:19794 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:824 (824.0 B)  TX bytes:1205655 (1.1 MiB)

wlan1     Link encap:Ethernet  HWaddr 00:18:E7:8C:3F:72
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:369 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46514 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32
          RX bytes:85396 (83.3 KiB)  TX bytes:2889940 (2.7 MiB)

comment:15 Changed 6 years ago by Pilot6 <hanipouspilot@…>

This small bug is not in your patch. Same is with trunk.

comment:16 Changed 6 years ago by Pilot6 <hanipouspilot@…>

Another suggestion regarding both trunk and Backfire.
The mac printed on the sticker is the one stored in DIR825B1_MAC_LOCATION_1
It is more logical to set it as wan (eth1) mac and not wlan1. So people can give this mac to ISP, if required. I do not know how it is done in stock firmware, but I can test it.

comment:17 Changed 6 years ago by Pilot6 <hanipouspilot@…>

I checked with stock firmware.

DIR825B1_MAC_LOCATION_0 = LAN and WLAN0 address
DIR825B1_MAC_LOCATION_1 = WAN address
WLAN1 address = WAN + 1

comment:18 Changed 6 years ago by Pilot6 <hanipouspilot@…>

The right way for the patch is

+       dir825b1_read_ascii_mac(mac_base, DIR825B1_MAC_LOCATION_0, 0);
+	dir825b1_read_ascii_mac(wmac1,    DIR825B1_MAC_LOCATION_1, 0);
+	dir825b1_read_ascii_mac(wmac2,    DIR825B1_MAC_LOCATION_1, 1);

comment:19 Changed 6 years ago by Pilot6 <hanipouspilot@…>

Correction

+       dir825b1_read_ascii_mac(mac_base, DIR825B1_MAC_LOCATION_0, 0);
+	dir825b1_read_ascii_mac(wmac1,    DIR825B1_MAC_LOCATION_0, 0);
+	dir825b1_read_ascii_mac(wmac2,    DIR825B1_MAC_LOCATION_1, 1);

eth0 and wlan0 have same mac.

Or just wmac1 = mac_base;

comment:20 Changed 4 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

Add Comment

Modify Ticket

Action
as reopened .
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.