[PATCH] libertas: convert libertas_mpp into anycast_mask
Luis Carlos
luisca at cozybit.com
Thu Jun 7 14:55:39 EDT 2007
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 at cozybit.com>
---
drivers/net/wireless/libertas/host.h | 4 ++--
drivers/net/wireless/libertas/main.c | 26 +++++++++++++-------------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index aebeffd..308ccdb 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -310,8 +310,8 @@ enum cmd_mesh_access_opts {
CMD_ACT_MESH_GET_TTL = 1,
CMD_ACT_MESH_SET_TTL,
CMD_ACT_MESH_GET_STATS,
- CMD_ACT_MESH_GET_MPP,
- CMD_ACT_MESH_SET_MPP,
+ CMD_ACT_MESH_GET_ANYCAST,
+ CMD_ACT_MESH_SET_ANYCAST,
CMD_ACT_MESH_SET_LINK_COSTS,
CMD_ACT_MESH_GET_LINK_COSTS,
CMD_ACT_MESH_SET_BCAST_RATE,
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 4760b01..7ec817a 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -210,45 +210,45 @@ u8 libertas_data_rate_to_fw_index(u32 rate)
*/
/**
- * @brief Get function for sysfs attribute libertas_mpp
+ * @brief Get function for sysfs attribute anycast_mask
*/
-static ssize_t libertas_mpp_get(struct device * dev,
+static ssize_t libertas_anycast_get(struct device * dev,
struct device_attribute *attr, char * buf) {
struct cmd_ds_mesh_access mesh_access;
memset(&mesh_access, 0, sizeof(mesh_access));
libertas_prepare_and_send_command(to_net_dev(dev)->priv,
CMD_MESH_ACCESS,
- CMD_ACT_MESH_GET_MPP,
+ CMD_ACT_MESH_GET_ANYCAST,
CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
- return snprintf(buf, 3, "%d\n", le32_to_cpu(mesh_access.data[0]));
+ return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
}
/**
- * @brief Set function for sysfs attribute libertas_mpp
+ * @brief Set function for sysfs attribute anycast_mask
*/
-static ssize_t libertas_mpp_set(struct device * dev,
+static ssize_t libertas_anycast_set(struct device * dev,
struct device_attribute *attr, const char * buf, size_t count) {
struct cmd_ds_mesh_access mesh_access;
uint32_t datum;
memset(&mesh_access, 0, sizeof(mesh_access));
- sscanf(buf, "%d", &datum);
+ sscanf(buf, "%x", &datum);
mesh_access.data[0] = cpu_to_le32(datum);
libertas_prepare_and_send_command((to_net_dev(dev))->priv,
CMD_MESH_ACCESS,
- CMD_ACT_MESH_SET_MPP,
+ CMD_ACT_MESH_SET_ANYCAST,
CMD_OPTION_WAITFORRSP, 0, (void *)&mesh_access);
return strlen(buf);
}
/**
- * libertas_mpp attribute to be exported per mshX interface
- * through sysfs (/sys/class/net/mshX/libertas-mpp)
+ * anycast_mask attribute to be exported per mshX interface
+ * through sysfs (/sys/class/net/mshX/anycast_mask)
*/
-static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, libertas_mpp_set );
+static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set );
/**
* @brief Check if the device can be open and wait if necessary.
@@ -972,7 +972,7 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
goto err_free;
}
- ret = device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
+ ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
if (ret)
goto err_unregister;
@@ -1082,7 +1082,7 @@ void libertas_remove_mesh(wlan_private *priv)
netif_stop_queue(mesh_dev);
netif_carrier_off(priv->mesh_dev);
- device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
+ device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
unregister_netdev(mesh_dev);
priv->mesh_dev = NULL ;
--
1.4.4.2
More information about the libertas-dev
mailing list