diff options
author | Holger Schurig <holgerschurig@googlemail.com> | 2009-12-02 09:25:56 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-22 13:37:12 -0500 |
commit | c24ef46e6b1597e54f185e0b48eb9073ef155a8c (patch) | |
tree | 59cf594556b9ae291580163b0870750aefbf1b22 | |
parent | 5d1ec85f00e999dba61bdcbd959d62439d418e56 (diff) |
libertas: use priv->mesh_tlv instead of priv->mesh_fw_ver
Both variables contained the same information (no mesh, old mesh, new mesh).
So we can get rid of one variable.
Also move the mesh-version test from cmd.c into mesh.c.
Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 13 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/defs.h | 7 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/dev.h | 1 | ||||
-rw-r--r-- | drivers/net/wireless/libertas/mesh.c | 23 |
4 files changed, 16 insertions, 28 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index b9b371bfa30f..dd69191f24eb 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -143,19 +143,6 @@ int lbs_update_hw_spec(struct lbs_private *priv) | |||
143 | lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", | 143 | lbs_deb_cmd("GET_HW_SPEC: hardware interface 0x%x, hardware spec 0x%04x\n", |
144 | cmd.hwifversion, cmd.version); | 144 | cmd.hwifversion, cmd.version); |
145 | 145 | ||
146 | /* Determine mesh_fw_ver from fwrelease and fwcapinfo */ | ||
147 | /* 5.0.16p0 9.0.0.p0 is known to NOT support any mesh */ | ||
148 | /* 5.110.22 have mesh command with 0xa3 command id */ | ||
149 | /* 10.0.0.p0 FW brings in mesh config command with different id */ | ||
150 | /* Check FW version MSB and initialize mesh_fw_ver */ | ||
151 | if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5) | ||
152 | priv->mesh_fw_ver = MESH_FW_OLD; | ||
153 | else if ((MRVL_FW_MAJOR_REV(priv->fwrelease) >= MRVL_FW_V10) && | ||
154 | (priv->fwcapinfo & MESH_CAPINFO_ENABLE_MASK)) | ||
155 | priv->mesh_fw_ver = MESH_FW_NEW; | ||
156 | else | ||
157 | priv->mesh_fw_ver = MESH_NONE; | ||
158 | |||
159 | /* Clamp region code to 8-bit since FW spec indicates that it should | 146 | /* Clamp region code to 8-bit since FW spec indicates that it should |
160 | * only ever be 8-bit, even though the field size is 16-bit. Some firmware | 147 | * only ever be 8-bit, even though the field size is 16-bit. Some firmware |
161 | * returns non-zero high 8 bits here. | 148 | * returns non-zero high 8 bits here. |
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h index 6b6ea9f7bf5b..ea3f10ef4e00 100644 --- a/drivers/net/wireless/libertas/defs.h +++ b/drivers/net/wireless/libertas/defs.h | |||
@@ -397,13 +397,6 @@ enum KEY_INFO_WPA { | |||
397 | KEY_INFO_WPA_ENABLED = 0x04 | 397 | KEY_INFO_WPA_ENABLED = 0x04 |
398 | }; | 398 | }; |
399 | 399 | ||
400 | /** mesh_fw_ver */ | ||
401 | enum _mesh_fw_ver { | ||
402 | MESH_NONE = 0, /* MESH is not supported */ | ||
403 | MESH_FW_OLD, /* MESH is supported in FW V5 */ | ||
404 | MESH_FW_NEW, /* MESH is supported in FW V10 and newer */ | ||
405 | }; | ||
406 | |||
407 | /* Default values for fwt commands. */ | 400 | /* Default values for fwt commands. */ |
408 | #define FWT_DEFAULT_METRIC 0 | 401 | #define FWT_DEFAULT_METRIC 0 |
409 | #define FWT_DEFAULT_DIR 1 | 402 | #define FWT_DEFAULT_DIR 1 |
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h index 6a8d2b291d8c..505b8feaa8b4 100644 --- a/drivers/net/wireless/libertas/dev.h +++ b/drivers/net/wireless/libertas/dev.h | |||
@@ -42,7 +42,6 @@ struct lbs_private { | |||
42 | u32 mesh_connect_status; | 42 | u32 mesh_connect_status; |
43 | struct lbs_mesh_stats mstats; | 43 | struct lbs_mesh_stats mstats; |
44 | int mesh_open; | 44 | int mesh_open; |
45 | int mesh_fw_ver; | ||
46 | int mesh_autostart_enabled; | 45 | int mesh_autostart_enabled; |
47 | uint16_t mesh_tlv; | 46 | uint16_t mesh_tlv; |
48 | u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1]; | 47 | u8 mesh_ssid[IEEE80211_MAX_SSID_LEN + 1]; |
diff --git a/drivers/net/wireless/libertas/mesh.c b/drivers/net/wireless/libertas/mesh.c index 2f91c9b808af..1d94f7d4efc8 100644 --- a/drivers/net/wireless/libertas/mesh.c +++ b/drivers/net/wireless/libertas/mesh.c | |||
@@ -196,7 +196,12 @@ int lbs_init_mesh(struct lbs_private *priv) | |||
196 | 196 | ||
197 | lbs_deb_enter(LBS_DEB_MESH); | 197 | lbs_deb_enter(LBS_DEB_MESH); |
198 | 198 | ||
199 | if (priv->mesh_fw_ver == MESH_FW_OLD) { | 199 | /* Determine mesh_fw_ver from fwrelease and fwcapinfo */ |
200 | /* 5.0.16p0 9.0.0.p0 is known to NOT support any mesh */ | ||
201 | /* 5.110.22 have mesh command with 0xa3 command id */ | ||
202 | /* 10.0.0.p0 FW brings in mesh config command with different id */ | ||
203 | /* Check FW version MSB and initialize mesh_fw_ver */ | ||
204 | if (MRVL_FW_MAJOR_REV(priv->fwrelease) == MRVL_FW_V5) { | ||
200 | /* Enable mesh, if supported, and work out which TLV it uses. | 205 | /* Enable mesh, if supported, and work out which TLV it uses. |
201 | 0x100 + 291 is an unofficial value used in 5.110.20.pXX | 206 | 0x100 + 291 is an unofficial value used in 5.110.20.pXX |
202 | 0x100 + 37 is the official value used in 5.110.21.pXX | 207 | 0x100 + 37 is the official value used in 5.110.21.pXX |
@@ -218,7 +223,9 @@ int lbs_init_mesh(struct lbs_private *priv) | |||
218 | priv->channel)) | 223 | priv->channel)) |
219 | priv->mesh_tlv = 0; | 224 | priv->mesh_tlv = 0; |
220 | } | 225 | } |
221 | } else if (priv->mesh_fw_ver == MESH_FW_NEW) { | 226 | } else |
227 | if ((MRVL_FW_MAJOR_REV(priv->fwrelease) >= MRVL_FW_V10) && | ||
228 | (priv->fwcapinfo & MESH_CAPINFO_ENABLE_MASK)) { | ||
222 | /* 10.0.0.pXX new firmwares should succeed with TLV | 229 | /* 10.0.0.pXX new firmwares should succeed with TLV |
223 | * 0x100+37; Do not invoke command with old TLV. | 230 | * 0x100+37; Do not invoke command with old TLV. |
224 | */ | 231 | */ |
@@ -227,6 +234,8 @@ int lbs_init_mesh(struct lbs_private *priv) | |||
227 | priv->channel)) | 234 | priv->channel)) |
228 | priv->mesh_tlv = 0; | 235 | priv->mesh_tlv = 0; |
229 | } | 236 | } |
237 | |||
238 | |||
230 | if (priv->mesh_tlv) { | 239 | if (priv->mesh_tlv) { |
231 | lbs_add_mesh(priv); | 240 | lbs_add_mesh(priv); |
232 | 241 | ||
@@ -416,10 +425,10 @@ struct net_device *lbs_mesh_set_dev(struct lbs_private *priv, | |||
416 | struct net_device *dev, struct rxpd *rxpd) | 425 | struct net_device *dev, struct rxpd *rxpd) |
417 | { | 426 | { |
418 | if (priv->mesh_dev) { | 427 | if (priv->mesh_dev) { |
419 | if (priv->mesh_fw_ver == MESH_FW_OLD) { | 428 | if (priv->mesh_tlv == TLV_TYPE_OLD_MESH_ID) { |
420 | if (rxpd->rx_control & RxPD_MESH_FRAME) | 429 | if (rxpd->rx_control & RxPD_MESH_FRAME) |
421 | dev = priv->mesh_dev; | 430 | dev = priv->mesh_dev; |
422 | } else if (priv->mesh_fw_ver == MESH_FW_NEW) { | 431 | } else if (priv->mesh_tlv == TLV_TYPE_MESH_ID) { |
423 | if (rxpd->u.bss.bss_num == MESH_IFACE_ID) | 432 | if (rxpd->u.bss.bss_num == MESH_IFACE_ID) |
424 | dev = priv->mesh_dev; | 433 | dev = priv->mesh_dev; |
425 | } | 434 | } |
@@ -432,9 +441,9 @@ void lbs_mesh_set_txpd(struct lbs_private *priv, | |||
432 | struct net_device *dev, struct txpd *txpd) | 441 | struct net_device *dev, struct txpd *txpd) |
433 | { | 442 | { |
434 | if (dev == priv->mesh_dev) { | 443 | if (dev == priv->mesh_dev) { |
435 | if (priv->mesh_fw_ver == MESH_FW_OLD) | 444 | if (priv->mesh_tlv == TLV_TYPE_OLD_MESH_ID) |
436 | txpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); | 445 | txpd->tx_control |= cpu_to_le32(TxPD_MESH_FRAME); |
437 | else if (priv->mesh_fw_ver == MESH_FW_NEW) | 446 | else if (priv->mesh_tlv == TLV_TYPE_MESH_ID) |
438 | txpd->u.bss.bss_num = MESH_IFACE_ID; | 447 | txpd->u.bss.bss_num = MESH_IFACE_ID; |
439 | } | 448 | } |
440 | } | 449 | } |
@@ -538,7 +547,7 @@ static int __lbs_mesh_config_send(struct lbs_private *priv, | |||
538 | * Command id is 0xac for v10 FW along with mesh interface | 547 | * Command id is 0xac for v10 FW along with mesh interface |
539 | * id in bits 14-13-12. | 548 | * id in bits 14-13-12. |
540 | */ | 549 | */ |
541 | if (priv->mesh_fw_ver == MESH_FW_NEW) | 550 | if (priv->mesh_tlv == TLV_TYPE_MESH_ID) |
542 | command = CMD_MESH_CONFIG | | 551 | command = CMD_MESH_CONFIG | |
543 | (MESH_IFACE_ID << MESH_IFACE_BIT_OFFSET); | 552 | (MESH_IFACE_ID << MESH_IFACE_BIT_OFFSET); |
544 | 553 | ||