Skip to contentSkip to conversation

libertas: Improvements on automatic tx power control via SIOCSIWTXPOW.

PATCH In review Anna Neal 3 participants 5 messages Sep 11, 2008 Networking drivers (wireless)

lore
Share & tools
lore

Anna Neal

author
#0 lore raw

PATCH 1/1 libertas: Improvements on automatic tx power control via SIOCSIWTXPOW.

Improved the tx power control configuration per Dan Williams suggestions. Added a firmware version check because the current implementation will only work for below version 9.

---
 drivers/net/wireless/libertas/cmd.c  |    4 +-
 drivers/net/wireless/libertas/cmd.h  |    4 +-
 drivers/net/wireless/libertas/wext.c |   44 +++++++++++++++++++++------------
 3 files changed, 32 insertions(+), 20 deletions(-)
drivers/net/wireless/libertas/cmd.c +2 -2
index 6cc4858..5fef05f 100644
@@ -1983,7 +1983,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
  *
  * @return 0 on success
  */
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
 		int8_t p2, int usesnr)
 {
 	struct cmd_ds_802_11_tpc_cfg cmd;
@@ -2015,7 +2015,7 @@ int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
  * @return 0 on Success
  */
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
 		int8_t p1, int8_t p2)
 {
 	struct cmd_ds_802_11_pa_cfg cmd;
drivers/net/wireless/libertas/cmd.h +2 -2
index 77bd070..336a181 100644
@@ -26,10 +26,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
 	      int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
 	      unsigned long callback_arg);
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
 		int8_t p1, int8_t p2);
 
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
 		int8_t p2, int usesnr);
 
 int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
drivers/net/wireless/libertas/wext.c +28 -16

56 lines not on this page · raw message

Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 5 lines · Anna Neal

Improved the tx power control configuration per Dan Williams suggestions. Added a firmware version check because the current implementation will only work for below version 9.

One more round, sorry! :)

First, until the patch has actually been applied, could you post complete diffs? This is a patch against the previous patch, but it's best to keep the whole patch together until it's committed by John to the master wireless tree.

Second, since you get to respin the patch anyway for this, the TPC Config stuff should be just fine on V9+ firmware, only the POWER_ADAPT_CFG command is incompatible on V9+. I probably wasn't clear enough about this yesterday. Any chance you could move the TPC config commands out of the firmware check and just the PACFG ones < V9?

Thanks!
Dan

Quoted 107 lines
---
 drivers/net/wireless/libertas/cmd.c  |    4 +-
 drivers/net/wireless/libertas/cmd.h  |    4 +-
 drivers/net/wireless/libertas/wext.c |   44 +++++++++++++++++++++------------
 3 files changed, 32 insertions(+), 20 deletions(-)
drivers/net/wireless/libertas/cmd.c +2 -2
index 6cc4858..5fef05f 100644
@@ -1983,7 +1983,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
  *
  * @return 0 on success
  */
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
 		int8_t p2, int usesnr)
 {
 	struct cmd_ds_802_11_tpc_cfg cmd;
@@ -2015,7 +2015,7 @@ int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
  * @return 0 on Success
  */
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
 		int8_t p1, int8_t p2)
 {
 	struct cmd_ds_802_11_pa_cfg cmd;
drivers/net/wireless/libertas/cmd.h +2 -2
index 77bd070..336a181 100644
@@ -26,10 +26,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
 	      int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
 	      unsigned long callback_arg);
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
 		int8_t p1, int8_t p2);
 
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
 		int8_t p2, int usesnr);
 
 int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
drivers/net/wireless/libertas/wext.c +28 -16
index b08bad8..8a81aca 100644
@@ -1823,14 +1823,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
 		/* User requests automatic tx power control, however there are
 		 * many auto tx settings.  For now use firmware defaults until
 		 * we come up with a good way to expose these to the user. */
-		ret = lbs_power_adapt_cfg(priv, 1, POW_ADAPT_DEFAULT_P0,
-				POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-		if (ret)
-			goto out;
-		ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-				TPC_DEFAULT_P2, 1);
-		if (ret)
-			goto out;
+		if (priv->fwrelease < 0x09000000) {
+			ret = lbs_set_power_adapt_cfg(priv, 1,
+					POW_ADAPT_DEFAULT_P0,
+					POW_ADAPT_DEFAULT_P1,
+					POW_ADAPT_DEFAULT_P2);
+			if (ret)
+				goto out;
+			ret = lbs_set_tpc_cfg(priv, 0,
+					TPC_DEFAULT_P0,
+					TPC_DEFAULT_P1,
+					TPC_DEFAULT_P2, 1);
+			if (ret)
+				goto out;
+		}
 		dbm = priv->txpower_max;
 	} else {
 		/* Userspace check in iwrange if it should use dBm or mW,
@@ -1851,14 +1857,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
 			ret = -EINVAL;
 			goto out;
 		}
-		ret = lbs_power_adapt_cfg(priv, 0, POW_ADAPT_DEFAULT_P0,
-				POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-		if (ret)
-			goto out;
-		ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-				TPC_DEFAULT_P2, 1);
-		if (ret)
-			goto out;
+		if (priv->fwrelease < 0x09000000) {
+			ret = lbs_set_power_adapt_cfg(priv, 0,
+					POW_ADAPT_DEFAULT_P0,
+					POW_ADAPT_DEFAULT_P1,
+					POW_ADAPT_DEFAULT_P2);
+			if (ret)
+				goto out;
+			ret = lbs_set_tpc_cfg(priv, 0,
+					TPC_DEFAULT_P0,
+					TPC_DEFAULT_P1,
+					TPC_DEFAULT_P2, 1);
+			if (ret)
+				goto out;
+		}
 	}
 
 	/* If the radio was off, turn it on */
author
#2 lore raw
Quoted 14 lines · Dan Williams
Quoted 5 lines · Anna Neal

Improved the tx power control configuration per Dan Williams suggestions. Added a firmware version check because the current implementation will only work for below version 9.

One more round, sorry! :)

First, until the patch has actually been applied, could you post complete diffs? This is a patch against the previous patch, but it's best to keep the whole patch together until it's committed by John to the master wireless tree.

Quoted 8 lines

Second, since you get to respin the patch anyway for this, the TPC Config stuff should be just fine on V9+ firmware, only the POWER_ADAPT_CFG command is incompatible on V9+. I probably wasn't clear enough about this yesterday. Any chance you could move the TPC config commands out of the firmware check and just the PACFG ones < V9?

Thanks!
Dan

No problem, will send a new patch later today.

I just wanted to point out that it seems the original patch was already committed by John.

Here is the link:
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commith=cdd799f13e3a2a47b501286551ba9386e8936272

Thanks,
Anna

Quoted 110 lines
Quoted 108 lines
---
 drivers/net/wireless/libertas/cmd.c  |    4 +-
 drivers/net/wireless/libertas/cmd.h  |    4 +-
 drivers/net/wireless/libertas/wext.c |   44 +++++++++++++++++++++------------
 3 files changed, 32 insertions(+), 20 deletions(-)
drivers/net/wireless/libertas/cmd.c +2 -2
index 6cc4858..5fef05f 100644
@@ -1983,7 +1983,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
  *
  * @return 0 on success
  */
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
              int8_t p2, int usesnr)
 {
      struct cmd_ds_802_11_tpc_cfg cmd;
@@ -2015,7 +2015,7 @@ int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
  * @return 0 on Success
  */
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
              int8_t p1, int8_t p2)
 {
      struct cmd_ds_802_11_pa_cfg cmd;
drivers/net/wireless/libertas/cmd.h +2 -2
index 77bd070..336a181 100644
@@ -26,10 +26,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
            int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
            unsigned long callback_arg);
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
              int8_t p1, int8_t p2);
 
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
              int8_t p2, int usesnr);
 
 int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
drivers/net/wireless/libertas/wext.c +28 -16
index b08bad8..8a81aca 100644
@@ -1823,14 +1823,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
              /* User requests automatic tx power control, however there are
               * many auto tx settings.  For now use firmware defaults until
               * we come up with a good way to expose these to the user. */
-             ret = lbs_power_adapt_cfg(priv, 1, POW_ADAPT_DEFAULT_P0,
-                             POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-             if (ret)
-                     goto out;
-             ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-                             TPC_DEFAULT_P2, 1);
-             if (ret)
-                     goto out;
+             if (priv->fwrelease < 0x09000000) {
+                     ret = lbs_set_power_adapt_cfg(priv, 1,
+                                     POW_ADAPT_DEFAULT_P0,
+                                     POW_ADAPT_DEFAULT_P1,
+                                     POW_ADAPT_DEFAULT_P2);
+                     if (ret)
+                             goto out;
+                     ret = lbs_set_tpc_cfg(priv, 0,
+                                     TPC_DEFAULT_P0,
+                                     TPC_DEFAULT_P1,
+                                     TPC_DEFAULT_P2, 1);
+                     if (ret)
+                             goto out;
+             }
              dbm = priv->txpower_max;
      } else {
              /* Userspace check in iwrange if it should use dBm or mW,
@@ -1851,14 +1857,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
                      ret = -EINVAL;
                      goto out;
              }
-             ret = lbs_power_adapt_cfg(priv, 0, POW_ADAPT_DEFAULT_P0,
-                             POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-             if (ret)
-                     goto out;
-             ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-                             TPC_DEFAULT_P2, 1);
-             if (ret)
-                     goto out;
+             if (priv->fwrelease < 0x09000000) {
+                     ret = lbs_set_power_adapt_cfg(priv, 0,
+                                     POW_ADAPT_DEFAULT_P0,
+                                     POW_ADAPT_DEFAULT_P1,
+                                     POW_ADAPT_DEFAULT_P2);
+                     if (ret)
+                             goto out;
+                     ret = lbs_set_tpc_cfg(priv, 0,
+                                     TPC_DEFAULT_P0,
+                                     TPC_DEFAULT_P1,
+                                     TPC_DEFAULT_P2, 1);
+                     if (ret)
+                             goto out;
+             }
      }
 
      /* If the radio was off, turn it on */
author
#3 lore raw
Quoted 26 lines · Anna Neal
Quoted 14 lines · Dan Williams
Quoted 5 lines · Anna Neal

Improved the tx power control configuration per Dan Williams suggestions. Added a firmware version check because the current implementation will only work for below version 9.

One more round, sorry! :)

First, until the patch has actually been applied, could you post complete diffs? This is a patch against the previous patch, but it's best to keep the whole patch together until it's committed by John to the master wireless tree.

Quoted 8 lines

Second, since you get to respin the patch anyway for this, the TPC Config stuff should be just fine on V9+ firmware, only the POWER_ADAPT_CFG command is incompatible on V9+. I probably wasn't clear enough about this yesterday. Any chance you could move the TPC config commands out of the firmware check and just the PACFG ones < V9?

Thanks!
Dan

No problem, will send a new patch later today.

Quoted 8 lines

I just wanted to point out that it seems the original patch was already committed by John.

Here is the link:
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commith=cdd799f13e3a2a47b501286551ba9386e8936272

Thanks,
Anna

I'm sorry, I sent a bad link.

Here is a good one.

http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commit&h=cdd799f13e3a2a47b501286551ba9386e8936272

Thanks,
Anna

Quoted 112 lines
Quoted 111 lines
Quoted 109 lines

---
 drivers/net/wireless/libertas/cmd.c  |    4 +-
 drivers/net/wireless/libertas/cmd.h  |    4 +-
 drivers/net/wireless/libertas/wext.c |   44 +++++++++++++++++++++------------
 3 files changed, 32 insertions(+), 20 deletions(-)
drivers/net/wireless/libertas/cmd.c +2 -2
index 6cc4858..5fef05f 100644
@@ -1983,7 +1983,7 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv)
  *
  * @return 0 on success
  */
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
              int8_t p2, int usesnr)
 {
      struct cmd_ds_802_11_tpc_cfg cmd;
@@ -2015,7 +2015,7 @@ int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
  * @return 0 on Success
  */
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
              int8_t p1, int8_t p2)
 {
      struct cmd_ds_802_11_pa_cfg cmd;
drivers/net/wireless/libertas/cmd.h +2 -2
index 77bd070..336a181 100644
@@ -26,10 +26,10 @@ int __lbs_cmd(struct lbs_private *priv, uint16_t command,
            int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
            unsigned long callback_arg);
 
-int lbs_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
+int lbs_set_power_adapt_cfg(struct lbs_private *priv, int enable, int8_t p0,
              int8_t p1, int8_t p2);
 
-int lbs_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
+int lbs_set_tpc_cfg(struct lbs_private *priv, int enable, int8_t p0, int8_t p1,
              int8_t p2, int usesnr);
 
 int lbs_cmd_copyback(struct lbs_private *priv, unsigned long extra,
drivers/net/wireless/libertas/wext.c +28 -16
index b08bad8..8a81aca 100644
@@ -1823,14 +1823,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
              /* User requests automatic tx power control, however there are
               * many auto tx settings.  For now use firmware defaults until
               * we come up with a good way to expose these to the user. */
-             ret = lbs_power_adapt_cfg(priv, 1, POW_ADAPT_DEFAULT_P0,
-                             POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-             if (ret)
-                     goto out;
-             ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-                             TPC_DEFAULT_P2, 1);
-             if (ret)
-                     goto out;
+             if (priv->fwrelease < 0x09000000) {
+                     ret = lbs_set_power_adapt_cfg(priv, 1,
+                                     POW_ADAPT_DEFAULT_P0,
+                                     POW_ADAPT_DEFAULT_P1,
+                                     POW_ADAPT_DEFAULT_P2);
+                     if (ret)
+                             goto out;
+                     ret = lbs_set_tpc_cfg(priv, 0,
+                                     TPC_DEFAULT_P0,
+                                     TPC_DEFAULT_P1,
+                                     TPC_DEFAULT_P2, 1);
+                     if (ret)
+                             goto out;
+             }
              dbm = priv->txpower_max;
      } else {
              /* Userspace check in iwrange if it should use dBm or mW,
@@ -1851,14 +1857,20 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info,
                      ret = -EINVAL;
                      goto out;
              }
-             ret = lbs_power_adapt_cfg(priv, 0, POW_ADAPT_DEFAULT_P0,
-                             POW_ADAPT_DEFAULT_P1, POW_ADAPT_DEFAULT_P2);
-             if (ret)
-                     goto out;
-             ret = lbs_tpc_cfg(priv, 0, TPC_DEFAULT_P0, TPC_DEFAULT_P1,
-                             TPC_DEFAULT_P2, 1);
-             if (ret)
-                     goto out;
+             if (priv->fwrelease < 0x09000000) {
+                     ret = lbs_set_power_adapt_cfg(priv, 0,
+                                     POW_ADAPT_DEFAULT_P0,
+                                     POW_ADAPT_DEFAULT_P1,
+                                     POW_ADAPT_DEFAULT_P2);
+                     if (ret)
+                             goto out;
+                     ret = lbs_set_tpc_cfg(priv, 0,
+                                     TPC_DEFAULT_P0,
+                                     TPC_DEFAULT_P1,
+                                     TPC_DEFAULT_P2, 1);
+                     if (ret)
+                             goto out;
+             }
      }
 
      /* If the radio was off, turn it on */
#4 lore raw
Quoted 33 lines · Anna Neal
Quoted 32 lines · Anna Neal
Quoted 14 lines · Dan Williams
Quoted 5 lines · Anna Neal

Improved the tx power control configuration per Dan Williams suggestions. Added a firmware version check because the current implementation will only work for below version 9.

One more round, sorry! :)

First, until the patch has actually been applied, could you post complete diffs? This is a patch against the previous patch, but it's best to keep the whole patch together until it's committed by John to the master wireless tree.

Quoted 8 lines

Second, since you get to respin the patch anyway for this, the TPC Config stuff should be just fine on V9+ firmware, only the POWER_ADAPT_CFG command is incompatible on V9+. I probably wasn't clear enough about this yesterday. Any chance you could move the TPC config commands out of the firmware check and just the PACFG ones < V9?

Thanks!
Dan

No problem, will send a new patch later today.

I just wanted to point out that it seems the original patch was already committed by John.

Here is the link:
http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commith=cdd799f13e3a2a47b501286551ba9386e8936272

Quoted 8 lines
Quoted 2 lines

Thanks,
Anna

I'm sorry, I sent a bad link.

Here is a good one.

http://git.kernel.org/?p=linux/kernel/git/linville/wireless-testing.git;a=commit&h=cdd799f13e3a2a47b501286551ba9386e8936272

FWIW, it hasn't been sent to Dave M. yet -- it's only in wireless-testing.

That said, I'm fine with either a whole new patch or the incremental one. But if Dan wants a new one and you don't mind...

John

Signature · 2 lines
John W. Linville
[email protected]