[PATCH] libertas: updated mesh commands for 5.220.9.p11

Luis Carlos Cobo Rus luisca at cozybit.com
Sat Mar 17 17:52:51 EDT 2007


On 3/16/07, Dan Williams <dcbw at redhat.com> wrote:
> I think your mailer mangled the patches; it replaced tabs with spaces.

Ups, sorry about that, hope this time it goes thru properly.

Signed-off-by: Luis Carlos Cobo <luisca at cozybit.com>
---
 drivers/net/wireless/libertas/cmd.c     |    5 ++
 drivers/net/wireless/libertas/defs.h    |    2 +
 drivers/net/wireless/libertas/host.h    |    4 +-
 drivers/net/wireless/libertas/hostcmd.h |    3 +
 drivers/net/wireless/libertas/ioctl.c   |   85 ++++++++++++++++++++++++++++--
 drivers/net/wireless/libertas/wext.c    |   10 ++++
 drivers/net/wireless/libertas/wext.h    |   12 +++--
 7 files changed, 109 insertions(+), 12 deletions(-)

diff --git a/drivers/net/wireless/libertas/cmd.c
b/drivers/net/wireless/libertas/cmd.c
index 935cce2..b499559 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -861,6 +861,11 @@ static int wlan_cmd_bt_access(wlan_priva
 		break;
 	case cmd_act_bt_access_reset:
 		break;
+	case cmd_act_bt_access_set_invert:
+		bt_access->id = cpu_to_le32(*(u32 *) pdata_buf);
+		break;
+	case cmd_act_bt_access_get_invert:
+		break;
 	default:
 		break;
 	}
diff --git a/drivers/net/wireless/libertas/defs.h
b/drivers/net/wireless/libertas/defs.h
index 67de2a6..9207cae 100644
--- a/drivers/net/wireless/libertas/defs.h
+++ b/drivers/net/wireless/libertas/defs.h
@@ -409,6 +409,8 @@ enum SNMP_MIB_VALUE_e {
 /* Default values for fwt commands. */
 #define FWT_DEFAULT_METRIC 0
 #define FWT_DEFAULT_DIR 1
+/* Default Rate, 11Mbps */
+#define FWT_DEFAULT_RATE 3
 #define FWT_DEFAULT_SSN 0xffffffff
 #define FWT_DEFAULT_DSN 0
 #define FWT_DEFAULT_HOPCOUNT 0
diff --git a/drivers/net/wireless/libertas/host.h
b/drivers/net/wireless/libertas/host.h
index c80eb59..ba38ded 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -287,7 +287,9 @@ enum cmd_bt_access_opts {
 	cmd_act_bt_access_add = 5,
 	cmd_act_bt_access_del,
 	cmd_act_bt_access_list,
-	cmd_act_bt_access_reset
+	cmd_act_bt_access_reset,
+	cmd_act_bt_access_set_invert,
+	cmd_act_bt_access_get_invert
 };

 /* Define action or option for cmd_fwt_access */
diff --git a/drivers/net/wireless/libertas/hostcmd.h
b/drivers/net/wireless/libertas/hostcmd.h
index 6911820..cf8e26f 100644
--- a/drivers/net/wireless/libertas/hostcmd.h
+++ b/drivers/net/wireless/libertas/hostcmd.h
@@ -607,18 +607,21 @@ struct cmd_ds_bt_access {
 struct cmd_ds_fwt_access {
 	u16 action;
 	u32 id;
+	u8 valid;
 	u8 da[ETH_ALEN];
 	u8 dir;
 	u8 ra[ETH_ALEN];
 	u32 ssn;
 	u32 dsn;
 	u32 metric;
+	u8 rate;
 	u8 hopcount;
 	u8 ttl;
 	u32 expiration;
 	u8 sleepmode;
 	u32 snr;
 	u32 references;
+	u8 prec[ETH_ALEN];
 } __attribute__ ((packed));

 #define MESH_STATS_NUM 7
diff --git a/drivers/net/wireless/libertas/ioctl.c
b/drivers/net/wireless/libertas/ioctl.c
index 803d270..f2acb3d 100644
--- a/drivers/net/wireless/libertas/ioctl.c
+++ b/drivers/net/wireless/libertas/ioctl.c
@@ -1337,8 +1337,8 @@ static int wlan_bt_list_ioctl(wlan_priva

 	if (ret == 0) {
 		addr1 = param.addr1addr2;
-
-		pos = sprintf(pbuf, "ignoring traffic from ");
+
+		pos = sprintf(pbuf, "BT includes node ");
 		pbuf += pos;
 		pos = eth_addr2str(addr1, pbuf);
 		pbuf += pos;
@@ -1352,7 +1352,65 @@ static int wlan_bt_list_ioctl(wlan_priva
 			 wrq->u.data.length)) {
 		lbs_deb_ioctl("BT_LIST: Copy to user failed!\n");
 		return -EFAULT;
-	}
+	}	
+
+	lbs_deb_leave(LBS_DEB_IOCTL);
+	return 0 ;
+}
+
+/**
+ *  @brief          Sets inverted state of blacklist (non-zero if inverted)
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         0 --success, otherwise fail
+ */
+static int wlan_bt_set_invert_ioctl(wlan_private * priv, struct ifreq *req)
+{
+	int ret;
+	struct iwreq *wrq = (struct iwreq *)req;
+	union {
+		int id;
+		char addr1addr2[2 * ETH_ALEN];
+	} param;
+
+	lbs_deb_enter(LBS_DEB_IOCTL);
+
+	param.id = SUBCMD_DATA(wrq) ;
+	ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
+				    cmd_act_bt_access_set_invert,
+				    cmd_option_waitforrsp, 0,
+				    (char *)&param);
+	if (ret != 0)
+		return -EFAULT;
+	lbs_deb_leave(LBS_DEB_IOCTL);
+	return 0;
+}
+
+/**
+ *  @brief          Gets inverted state of blacklist (non-zero if inverted)
+ *  @param priv     A pointer to wlan_private structure
+ *  @param req      A pointer to ifreq structure
+ *  @return         0 --success, otherwise fail
+ */
+static int wlan_bt_get_invert_ioctl(wlan_private * priv, struct ifreq *req)
+{
+	int ret;
+	union {
+		int id;
+		char addr1addr2[2 * ETH_ALEN];
+	} param;
+
+	lbs_deb_enter(LBS_DEB_IOCTL);
+
+	ret = libertas_prepare_and_send_command(priv, cmd_bt_access,
+				    cmd_act_bt_access_get_invert,
+				    cmd_option_waitforrsp, 0,
+				    (char *)&param);
+
+	if (ret == 0)
+		req->ifr_data = (char *)(le32_to_cpu(param.id));
+	else
+		return -EFAULT;

 	lbs_deb_leave(LBS_DEB_IOCTL);
 	return 0;
@@ -1411,6 +1469,11 @@ static int wlan_fwt_add_ioctl(wlan_priva
 		fwt_access.dir = FWT_DEFAULT_DIR;

 	if ((ptr = next_param(ptr)))
+		fwt_access.rate = (u8) simple_strtoul(ptr, &ptr, 10);
+	else
+		fwt_access.rate = FWT_DEFAULT_RATE;
+
+	if ((ptr = next_param(ptr)))
 		fwt_access.ssn =
 			cpu_to_le32(simple_strtoul(ptr, &ptr, 10));
 	else
@@ -1538,15 +1601,18 @@ static void print_route(struct cmd_ds_fw
 	buf += eth_addr2str(fwt_access.da, buf);
 	buf += sprintf(buf, " ");
 	buf += eth_addr2str(fwt_access.ra, buf);
+	buf += sprintf(buf, " %u", fwt_access.valid);
 	buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.metric));
 	buf += sprintf(buf, " %u", fwt_access.dir);
+	buf += sprintf(buf, " %u", fwt_access.rate);
 	buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.ssn));
 	buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.dsn));
 	buf += sprintf(buf, " %u", fwt_access.hopcount);
 	buf += sprintf(buf, " %u", fwt_access.ttl);
 	buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.expiration));
 	buf += sprintf(buf, " %u", fwt_access.sleepmode);
-	buf += sprintf(buf, " %u", le32_to_cpu(fwt_access.snr));
+	buf += sprintf(buf, " %u ", le32_to_cpu(fwt_access.snr));
+	buf += eth_addr2str(fwt_access.prec, buf);
 }

 /**
@@ -1869,9 +1935,8 @@ static int wlan_mesh_get_ttl_ioctl(wlan_
 				    cmd_option_waitforrsp, 0,
 				    (void *)&mesh_access);

-	if (ret == 0) {
+	if (ret == 0)
 		req->ifr_data = (char *)(le32_to_cpu(mesh_access.data[0]));
-	}
 	else
 		return -EFAULT;

@@ -2132,6 +2197,10 @@ #define MAX_U16_VAL	65535
 			ret = wlan_mesh_set_ttl_ioctl(priv, idata);
 			break;

+		case WLAN_SUBCMD_BT_SET_INVERT:
+			ret = wlan_bt_set_invert_ioctl(priv, req);
+			break ;
+
 		default:
 			ret = -EOPNOTSUPP;
 			break;
@@ -2249,6 +2318,10 @@ #define MAX_U16_VAL	65535
 			ret = wlan_mesh_get_ttl_ioctl(priv, req);
 			break;

+		case WLAN_SUBCMD_BT_GET_INVERT:
+			ret = wlan_bt_get_invert_ioctl(priv, req);
+			break ;
+
 		default:
 			ret = -EOPNOTSUPP;

diff --git a/drivers/net/wireless/libertas/wext.c
b/drivers/net/wireless/libertas/wext.c
index 992448d..a0d34a7 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -1298,6 +1298,16 @@ static const struct iw_priv_args wlan_pr
 	 IW_PRIV_TYPE_CHAR | 128,
 	 IW_PRIV_TYPE_CHAR | 128,
 	 "bt_list"},
+	{
+	 WLAN_SUBCMD_BT_SET_INVERT,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+	 IW_PRIV_TYPE_NONE,
+	 "bt_set_invert"},
+	{
+	 WLAN_SUBCMD_BT_GET_INVERT,
+	 IW_PRIV_TYPE_NONE,
+	 IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
+	 "bt_get_invert"},
 	/* FWT Management */
 	{
 	 WLAN_SUBCMD_FWT_ADD,
diff --git a/drivers/net/wireless/libertas/wext.h
b/drivers/net/wireless/libertas/wext.h
index 83c6281..f786586 100644
--- a/drivers/net/wireless/libertas/wext.h
+++ b/drivers/net/wireless/libertas/wext.h
@@ -51,6 +51,7 @@ #define WLAN_GET_DEBUGMODE			8
 #define WLAN_SUBCMD_FWT_CLEANUP			15
 #define WLAN_SUBCMD_FWT_TIME			16
 #define WLAN_SUBCMD_MESH_GET_TTL		17
+#define WLAN_SUBCMD_BT_GET_INVERT		18

 #define WLANREGCFRDWR			(WLANIOCTL + 18)

@@ -86,6 +87,7 @@ #define WLAN_SET_LINKMODE			15
 #define WLAN_SET_RADIOMODE			16
 #define WLAN_SET_DEBUGMODE			17
 #define WLAN_SUBCMD_MESH_SET_TTL		18
+#define WLAN_SUBCMD_BT_SET_INVERT		19

 #define WLAN_SET128CHAR_GET128CHAR	(WLANIOCTL + 25)
 #define WLANSCAN_MODE				6
@@ -95,12 +97,12 @@ #define WLAN_GET_ADHOC_STATUS			9
 #define WLAN_SUBCMD_BT_ADD			18
 #define WLAN_SUBCMD_BT_DEL   			19
 #define WLAN_SUBCMD_BT_LIST			20
-#define WLAN_SUBCMD_FWT_ADD				21
-#define WLAN_SUBCMD_FWT_DEL   		22
-#define WLAN_SUBCMD_FWT_LOOKUP		23
-#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR			24
+#define WLAN_SUBCMD_FWT_ADD			21
+#define WLAN_SUBCMD_FWT_DEL   			22
+#define WLAN_SUBCMD_FWT_LOOKUP			23
+#define WLAN_SUBCMD_FWT_LIST_NEIGHBOR		24
 #define WLAN_SUBCMD_FWT_LIST			25
-#define WLAN_SUBCMD_FWT_LIST_ROUTE			26
+#define WLAN_SUBCMD_FWT_LIST_ROUTE		26

 #define WLAN_SET_GET_SIXTEEN_INT       (WLANIOCTL + 29)
 #define WLAN_TPCCFG                             1
-- 
1.4.3



-- 
Luis Carlos Cobo Rus       GnuPG ID: 44019B60
cozybit Inc.



More information about the libertas-dev mailing list