aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuis Carlos <luisca@cozybit.com>2007-06-07 16:40:59 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-12 14:07:54 -0400
commit82fde74b94f11eee1e9c30e43fb162f80a5e63c0 (patch)
treeb5f0fd209c90b0ba9074a690518e0cd092b83fd9
parent2fb3bd6a23e5d37889a78b6a13a124fa7c586009 (diff)
[PATCH] libertas: convert libertas_mpp into anycast_mask
With firmware 5.220.11.p5, this allows to specify the anycast addresses the device will listen to. The anycast address range is C0:27:C0:27:C0:XX where XX goes from 00 to 1F (or 0 to 31 in dec). The value to write on anycast_mask will specify which addresses the device listens to. Bits in a 32 bit int are numbered from 0 (least significative bit) to 31. A specific address ending in YY will be listened to if bit YY in the value is set to one. Examples: 0x00000000 : do not listen to any anycast address 0xFFFFFFFF : listen to every anycast address from :00 to :1F 0x00000013 : listen to anycast addresses :00, :01 and :04 Signed-off-by: Luis Carlos Cobo <luisca@cozybit.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/libertas/host.h4
-rw-r--r--drivers/net/wireless/libertas/main.c26
2 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index cedf1dbab050..7509cc10af3c 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -310,8 +310,8 @@ enum cmd_mesh_access_opts {
310 cmd_act_mesh_get_ttl = 1, 310 cmd_act_mesh_get_ttl = 1,
311 cmd_act_mesh_set_ttl, 311 cmd_act_mesh_set_ttl,
312 cmd_act_mesh_get_stats, 312 cmd_act_mesh_get_stats,
313 cmd_act_mesh_get_mpp, 313 cmd_act_mesh_get_anycast,
314 cmd_act_mesh_set_mpp, 314 cmd_act_mesh_set_anycast,
315}; 315};
316 316
317/** Card Event definition */ 317/** Card Event definition */
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 20ac7e1cec54..623ab4b16973 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -178,45 +178,45 @@ u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
178 */ 178 */
179 179
180/** 180/**
181 * @brief Get function for sysfs attribute libertas_mpp 181 * @brief Get function for sysfs attribute anycast_mask
182 */ 182 */
183static ssize_t libertas_mpp_get(struct device * dev, 183static ssize_t libertas_anycast_get(struct device * dev,
184 struct device_attribute *attr, char * buf) { 184 struct device_attribute *attr, char * buf) {
185 struct cmd_ds_mesh_access mesh_access; 185 struct cmd_ds_mesh_access mesh_access;
186 186
187 memset(&mesh_access, 0, sizeof(mesh_access)); 187 memset(&mesh_access, 0, sizeof(mesh_access));
188 libertas_prepare_and_send_command(to_net_dev(dev)->priv, 188 libertas_prepare_and_send_command(to_net_dev(dev)->priv,
189 cmd_mesh_access, 189 cmd_mesh_access,
190 cmd_act_mesh_get_mpp, 190 cmd_act_mesh_get_anycast,
191 cmd_option_waitforrsp, 0, (void *)&mesh_access); 191 cmd_option_waitforrsp, 0, (void *)&mesh_access);
192 192
193 return snprintf(buf, 3, "%d\n", le32_to_cpu(mesh_access.data[0])); 193 return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
194} 194}
195 195
196/** 196/**
197 * @brief Set function for sysfs attribute libertas_mpp 197 * @brief Set function for sysfs attribute anycast_mask
198 */ 198 */
199static ssize_t libertas_mpp_set(struct device * dev, 199static ssize_t libertas_anycast_set(struct device * dev,
200 struct device_attribute *attr, const char * buf, size_t count) { 200 struct device_attribute *attr, const char * buf, size_t count) {
201 struct cmd_ds_mesh_access mesh_access; 201 struct cmd_ds_mesh_access mesh_access;
202 uint32_t datum; 202 uint32_t datum;
203 203
204 memset(&mesh_access, 0, sizeof(mesh_access)); 204 memset(&mesh_access, 0, sizeof(mesh_access));
205 sscanf(buf, "%d", &datum); 205 sscanf(buf, "%x", &datum);
206 mesh_access.data[0] = cpu_to_le32(datum); 206 mesh_access.data[0] = cpu_to_le32(datum);
207 207
208 libertas_prepare_and_send_command((to_net_dev(dev))->priv, 208 libertas_prepare_and_send_command((to_net_dev(dev))->priv,
209 cmd_mesh_access, 209 cmd_mesh_access,
210 cmd_act_mesh_set_mpp, 210 cmd_act_mesh_set_anycast,
211 cmd_option_waitforrsp, 0, (void *)&mesh_access); 211 cmd_option_waitforrsp, 0, (void *)&mesh_access);
212 return strlen(buf); 212 return strlen(buf);
213} 213}
214 214
215/** 215/**
216 * libertas_mpp attribute to be exported per mshX interface 216 * anycast_mask attribute to be exported per mshX interface
217 * through sysfs (/sys/class/net/mshX/libertas-mpp) 217 * through sysfs (/sys/class/net/mshX/anycast_mask)
218 */ 218 */
219static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, libertas_mpp_set ); 219static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set);
220 220
221/** 221/**
222 * @brief Check if the device can be open and wait if necessary. 222 * @brief Check if the device can be open and wait if necessary.
@@ -939,7 +939,7 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
939 goto err_free; 939 goto err_free;
940 } 940 }
941 941
942 ret = device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp); 942 ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
943 if (ret) 943 if (ret)
944 goto err_unregister; 944 goto err_unregister;
945 945
@@ -1049,7 +1049,7 @@ void libertas_remove_mesh(wlan_private *priv)
1049 netif_stop_queue(mesh_dev); 1049 netif_stop_queue(mesh_dev);
1050 netif_carrier_off(priv->mesh_dev); 1050 netif_carrier_off(priv->mesh_dev);
1051 1051
1052 device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp); 1052 device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
1053 unregister_netdev(mesh_dev); 1053 unregister_netdev(mesh_dev);
1054 1054
1055 priv->mesh_dev = NULL ; 1055 priv->mesh_dev = NULL ;