aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_roboswitch.c
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2009-02-04 20:05:14 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-04 20:05:14 (GMT)
commit94abc2f11bb13001c0b688af3abda04a57e1fdd4 (patch)
treed6e33f25182b83975f92e833293bd6bb698f3071 /src/drivers/driver_roboswitch.c
parent81e59f1070f223c4b244a20aa496b79d9cdb5961 (diff)
downloadhostap-94abc2f11bb13001c0b688af3abda04a57e1fdd4.zip
hostap-94abc2f11bb13001c0b688af3abda04a57e1fdd4.tar.gz
hostap-94abc2f11bb13001c0b688af3abda04a57e1fdd4.tar.bz2
Better support in RoboSwitch driver
I am terribly sorry, but because of a lack of testing equipment the patch was submitted not properly tested. Because the chipset documentation is not publicly available all behaviour has to be found out by experimentation. The other day, I made some incorrect assumptions based on my findings. I do believe the attached patch does support the whole RoboSwitch line (5325, 5350, 5352, 5365 and others). It is a drop-in substitution for my previous submission.
Diffstat (limited to 'src/drivers/driver_roboswitch.c')
-rw-r--r--src/drivers/driver_roboswitch.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/drivers/driver_roboswitch.c b/src/drivers/driver_roboswitch.c
index b25a72b..4394ddb 100644
--- a/src/drivers/driver_roboswitch.c
+++ b/src/drivers/driver_roboswitch.c
@@ -49,6 +49,7 @@
#define ROBO_VLAN_ACCESS 0x06 /* VLAN table Access register */
#define ROBO_VLAN_ACCESS_5365 0x08 /* VLAN table Access register (5365) */
#define ROBO_VLAN_READ 0x0C /* VLAN read register */
+#define ROBO_VLAN_MAX 0xFF /* Maximum number of VLANs */
static const u8 pae_group_addr[ETH_ALEN] =
@@ -319,7 +320,7 @@ static void * wpa_driver_roboswitch_init(void *ctx, const char *ifname)
{
struct wpa_driver_roboswitch_data *drv;
int len = -1, sep = -1;
- u16 _read, vlan = 0, vlan_read[2];
+ u16 vlan_max = ROBO_VLAN_MAX, vlan = 0, vlan_read[2];
drv = os_zalloc(sizeof(*drv));
if (drv == NULL) return NULL;
@@ -352,7 +353,7 @@ static void * wpa_driver_roboswitch_init(void *ctx, const char *ifname)
}
vlan *= 10;
vlan += ifname[sep] - '0';
- if (vlan > 255) {
+ if (vlan > ROBO_VLAN_MAX) {
wpa_printf(MSG_INFO, "%s: VLAN out of range in "
"interface name %s", __func__, ifname);
os_free(drv);
@@ -381,13 +382,17 @@ static void * wpa_driver_roboswitch_init(void *ctx, const char *ifname)
return NULL;
}
+ /* set the read bit */
vlan |= 1 << 13;
+ /* set and read back to see if the register can be used */
wpa_driver_roboswitch_write(drv, ROBO_VLAN_PAGE, ROBO_VLAN_ACCESS,
- &vlan, 1);
- /* Read back: The BCM5365 uses a different register */
+ &vlan_max, 1);
wpa_driver_roboswitch_read(drv, ROBO_VLAN_PAGE, ROBO_VLAN_ACCESS,
- &_read, 1);
- if (_read != vlan)
+ &vlan_max, 1);
+ if (vlan_max == ROBO_VLAN_MAX) /* pre-5365 */
+ wpa_driver_roboswitch_write(drv, ROBO_VLAN_PAGE,
+ ROBO_VLAN_ACCESS, &vlan, 1);
+ else /* 5365 uses a different register */
wpa_driver_roboswitch_write(drv, ROBO_VLAN_PAGE,
ROBO_VLAN_ACCESS_5365, &vlan, 1);
wpa_driver_roboswitch_read(drv, ROBO_VLAN_PAGE, ROBO_VLAN_READ,