libertas: Enable/disable automatic tx power control via SIOCSIWTXPOW.
PATCH 1/1 libertas: Enable/disable automatic tx power control via SIOCSIWTXPOW.
iwconfig txpower can now be used to set tx power to fixed or auto. If set to auto the default firmware settings are used.
--- drivers/net/wireless/libertas/cmd.c | 64 +++++++++++++++++++++++++++++++ drivers/net/wireless/libertas/cmd.h | 6 +++ drivers/net/wireless/libertas/defs.h | 9 ++++ drivers/net/wireless/libertas/host.h | 1 + drivers/net/wireless/libertas/hostcmd.h | 24 +++++++++-- drivers/net/wireless/libertas/wext.c | 23 ++++++++++- 6 files changed, 120 insertions(+), 7 deletions(-)
drivers/net/wireless/libertas/cmd.c +64 -0
@@ -1971,6 +1971,70 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv) } +/** +* @brief Configures the transmission power control functionality. +* +* @param priv A pointer to struct lbs_private structure +* @param enable Transmission power control enable +* @param p0 Power level when link quality is good (dBm). +* @param p1 Power level when link quality is fair (dBm). +* @param p2 Power level when link quality is poor (dBm). +* @param usesnr Use Signal to Noise Ratio in TPC +* +* @return 0 on success +*/ +int lbs_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; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_SET ); + cmd.enable = !!enable; + cmd.usesnr = !!enable; + cmd.P0 = p0; + cmd.P1 = p1; + cmd.P2 = p2; + + ret =lbs_cmd_with_response (priv,CMD_802_11_TPC_CFG , &cmd); + +return ret; +} + +/** +* @brief Configures the power adaptation settings. +* +* @param priv A pointer to struct lbs_private structure +* @param enable Power adaptation enable +* @param p0 Power level for 1, 2, 5.5 and 11 Mbps (dBm). +* @param p1 Power level for 6, 9, 12, 18, 22, 24 and 36 Mbps (dBm). +* @param p2 Power level for 48 and 54 Mbps (dBm). +* +* @return 0 on Success +*/ + +int lbs_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; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_SET ); + cmd.enable = !!enable; + cmd.P0 = p0; + cmd.P1 = p1; + cmd.P2 = p2; + + ret =lbs_cmd_with_response (priv,CMD_802_11_PA_CFG , &cmd); + +return ret; +} + + static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),
drivers/net/wireless/libertas/cmd.h +6 -0
@@ -26,6 +26,12 @@ 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, +int8_t p1,int8_t p2); + +int lbs_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,struct cmd_header *resp);
drivers/net/wireless/libertas/defs.h +9 -0
@@ -189,6 +189,15 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in#define MRVDRV_CMD_UPLD_RDY 0x0008#define MRVDRV_CARDEVENT 0x0010 + +/* Automatic TX control default levels */ +#define POW_ADAPT_DEFAULT_P0 13 +#define POW_ADAPT_DEFAULT_P1 15 +#define POW_ADAPT_DEFAULT_P2 18 +#define TPC_DEFAULT_P0 5 +#define TPC_DEFAULT_P1 10 +#define TPC_DEFAULT_P2 13 +/** TxPD status */ /* Station firmware use TxPD status field to report final Tx transmit
drivers/net/wireless/libertas/host.h +1 -0
@@ -83,6 +83,7 @@#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067#define CMD_802_11_SLEEP_PERIOD 0x0068#define CMD_802_11_TPC_CFG 0x0072 +#define CMD_802_11_PA_CFG 0x0073#define CMD_802_11_FW_WAKE_METHOD 0x0074#define CMD_802_11_SUBSCRIBE_EVENT 0x0075#define CMD_802_11_RATE_ADAPT_RATESET 0x0076
drivers/net/wireless/libertas/hostcmd.h +19 -5
@@ -607,14 +607,28 @@ struct cmd_ds_802_11_eeprom_access { } __attribute__ ((packed));struct cmd_ds_802_11_tpc_cfg { +struct cmd_header hdr; +__le16 action; -u8 enable; -s8 P0; -s8 P1; -s8 P2; -u8 usesnr; +uint8_t enable; +int8_t P0; +int8_t P1; +int8_t P2; +uint8_t usesnr; } __attribute__ ((packed)); + +struct cmd_ds_802_11_pa_cfg { +struct cmd_header hdr; + +__le16 action; +uint8_t enable; +int8_t P0; +int8_t P1; +int8_t P2; +} __attribute__ ((packed)); + +struct cmd_ds_802_11_led_ctrl {__le16 action;__le16 numled;
drivers/net/wireless/libertas/wext.c +21 -2
@@ -1820,7 +1820,17 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, }if (vwrq->fixed ==0 ) { -/* Auto power control */ +/* 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; dbm = priv->txpower_max; }else {/* Userspace check in iwrange if it should use dBm or mW,
@@ -1830,7 +1840,8 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, goto out; } -/* Validate requested power level against firmware allowed levels */ +/* Validate requested power level against firmware allowed +* levels */ if (priv->txpower_min && (dbm < priv->txpower_min)) { ret = -EINVAL ; goto out;
@@ -1840,6 +1851,14 @@ 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 the radio was off, turn it on */
Signature · 1 line
1.5.4.3
Quoted 5 lines · Anna Neal
iwconfig txpower can now be used to set tx power to fixed or auto. If set to auto the default firmware settings are used.
Signed-off-by Anna Neal <[email protected]>Signed-off-by Javier Cardona <[email protected]>
Quoted 8 lines
--- drivers/net/wireless/libertas/cmd.c | 64 +++++++++++++++++++++++++++++++ drivers/net/wireless/libertas/cmd.h | 6 +++ drivers/net/wireless/libertas/defs.h | 9 ++++ drivers/net/wireless/libertas/host.h | 1 + drivers/net/wireless/libertas/hostcmd.h | 24 +++++++++-- drivers/net/wireless/libertas/wext.c | 23 ++++++++++- 6 files changed, 120 insertions(+), 7 deletions(-)
Thanks for the patch! A few things...
Quoted 12 lines
drivers/net/wireless/libertas/cmd.c +4
-0@@ -1971,6 +1971,70 @@ void lbs_ps_confirm_sleep(struct lbs_private *priv) } +/** +* @brief Configures the transmission power control functionality. +* +* @param priv A pointer to struct lbs_private structure
drivers/net/wireless/libertas/cmd.c void lbs_ps_confirm_sleep(struct lbs_private *priv) · line 1987
Quoted 10 lines
drivers/net/wireless/libertas/cmd.c +10
-0+* @param enable Transmission power control enable +* @param p0 Power level when link quality is good (dBm). +* @param p1 Power level when link quality is fair (dBm). +* @param p2 Power level when link quality is poor (dBm). +* @param usesnr Use Signal to Noise Ratio in TPC +* +* @return 0 on success +*/ +int lbs_tpc_cfg (struct lbs_private *priv,int enable,int8_t p0,int8_t p1, +int8_t p2,int usesnr)
Can we rename this to lbs_set_tpc_cfg()? It's a setter, and there could be a getter later, best to be clear about this.
Quoted 22 lines
drivers/net/wireless/libertas/cmd.c +22
-0+{ +struct cmd_ds_802_11_tpc_cfg cmd; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_SET ); + cmd.enable = !!enable; + cmd.usesnr = !!enable; + cmd.P0 = p0; + cmd.P1 = p1; + cmd.P2 = p2; + + ret =lbs_cmd_with_response (priv,CMD_802_11_TPC_CFG , &cmd); + +return ret; +} + +/** +* @brief Configures the power adaptation settings. +* +* @param priv A pointer to struct lbs_private structure
drivers/net/wireless/libertas/cmd.c void lbs_ps_confirm_sleep(struct lbs_private *priv) · line 2019
Quoted 10 lines
drivers/net/wireless/libertas/cmd.c +10
-0+* @param enable Power adaptation enable +* @param p0 Power level for 1, 2, 5.5 and 11 Mbps (dBm). +* @param p1 Power level for 6, 9, 12, 18, 22, 24 and 36 Mbps (dBm). +* @param p2 Power level for 48 and 54 Mbps (dBm). +* +* @return 0 on Success +*/ + +int lbs_power_adapt_cfg (struct lbs_private *priv,int enable,int8_t p0, +int8_t p1,int8_t p2)
Same here, can we change this to lbs_set_pa_cfg() or lbs_set_power_adapt_cfg() ?
drivers/net/wireless/libertas/cmd.c void lbs_ps_confirm_sleep(struct lbs_private *priv) · line 2030
Quoted 11 lines
drivers/net/wireless/libertas/cmd.c +11
-0+{ +struct cmd_ds_802_11_pa_cfg cmd; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_SET ); + cmd.enable = !!enable; + cmd.P0 = p0; + cmd.P1 = p1; + cmd.P2 = p2;
And this isn't compatible with the V9 and later firmware, which uses the PowerAdapt_Group_t Marvell IE. I'd suggest defining two different commands, one for V8 and below which uses the format you have here, and one for V9 and above which uses the new format. I have no idea what the fields in PA_Group_t are, but I'm sure you can find out since you're from CozyBit :)
Quoted 51 lines
drivers/net/wireless/libertas/cmd.c +6
-0+ ret =lbs_cmd_with_response (priv,CMD_802_11_PA_CFG , &cmd); + +return ret; +} + + static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, uint16_t command, struct cmd_header *in_cmd, int in_cmd_size, int (*callback)(struct lbs_private *, unsigned long, struct cmd_header *),drivers/net/wireless/libertas/cmd.h +6
-0@@ -26,6 +26,12 @@ 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, +int8_t p1,int8_t p2); + +int lbs_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,struct cmd_header *resp);drivers/net/wireless/libertas/defs.h +9
-0@@ -189,6 +189,15 @@ static inline void lbs_deb_hex(unsigned int grp, const char *prompt, u8 *buf, in#define MRVDRV_CMD_UPLD_RDY 0x0008#define MRVDRV_CARDEVENT 0x0010 + +/* Automatic TX control default levels */ +#define POW_ADAPT_DEFAULT_P0 13 +#define POW_ADAPT_DEFAULT_P1 15 +#define POW_ADAPT_DEFAULT_P2 18 +#define TPC_DEFAULT_P0 5 +#define TPC_DEFAULT_P1 10 +#define TPC_DEFAULT_P2 13 +/** TxPD status */ /* Station firmware use TxPD status field to report final Tx transmit drivers/net/wireless/libertas/host.h +0
-0
drivers/net/wireless/libertas/host.h line 86
Quoted 4 lines
drivers/net/wireless/libertas/host.h +1
-0@@ -83,6 +83,7 @@#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067#define CMD_802_11_SLEEP_PERIOD 0x0068#define CMD_802_11_TPC_CFG 0x0072 +#define CMD_802_11_PA_CFG 0x0073
Should also:
#define CMD_802_11_POWER_ADAPT_CFG_EXT 0x0073 /* v9 firmware and above */
and use that in the v9+ lbs_set_power_adapt_cfg_ext() function.
Quoted 28 lines
drivers/net/wireless/libertas/host.h +0
-0#define CMD_802_11_FW_WAKE_METHOD 0x0074#define CMD_802_11_SUBSCRIBE_EVENT 0x0075#define CMD_802_11_RATE_ADAPT_RATESET 0x0076drivers/net/wireless/libertas/hostcmd.h +9
-5@@ -607,14 +607,28 @@ struct cmd_ds_802_11_eeprom_access { } __attribute__ ((packed));struct cmd_ds_802_11_tpc_cfg { +struct cmd_header hdr; +__le16 action; -u8 enable; -s8 P0; -s8 P1; -s8 P2; -u8 usesnr; +uint8_t enable; +int8_t P0; +int8_t P1; +int8_t P2; +uint8_t usesnr; } __attribute__ ((packed)); + +struct cmd_ds_802_11_pa_cfg {
drivers/net/wireless/libertas/hostcmd.h struct cmd_ds_802_11_eeprom_access { · line 631
Quoted 10 lines
drivers/net/wireless/libertas/hostcmd.h +10
-0+struct cmd_header hdr; + +__le16 action; +uint8_t enable; +int8_t P0 ; +int8_t P1 ; +int8_t P2 ; +} __attribute__ ((packed)); + +
And for v9:
struct pa_group {
u16 level;
u16 rate_map;
u32 reserved;
}struct mrvl_ie_pa_group {
mrvlietypes_header hdr;
struct pa_group groups[5];
}struct cmd_ds_802_11_pa_cfg_ext {
struct cmd_header hdr;
__le16 action;
u16 enable;
struct mrvl_ie_pa_group pa_groups;
}note that there isn't an existing GPL implementation of POWER_ADAPT_CFG_EXT either at moblin or anywhere else, so I can't suggest what to fill in for the rate_map and level of struct pa_group in the implementation. Ask Luis or Javier I guess since they probably have access to that information.
Quoted 8 lines
drivers/net/wireless/libertas/hostcmd.h +0
-0struct cmd_ds_802_11_led_ctrl {__le16 action;__le16 numled;drivers/net/wireless/libertas/wext.c +0
-0
drivers/net/wireless/libertas/wext.c static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, · line 1827
Quoted 9 lines
drivers/net/wireless/libertas/wext.c +5
-1@@ -1820,7 +1820,17 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, }if (vwrq->fixed ==0 ) { -/* Auto power control */ +/* 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 );
and do the firmware check right here and call lbs_set_power_adapt_cfg() for V8 and lower, and lbs_set_power_adapt_cfg_ext() for v9 and higher like so:
if (priv->fwrelease >= 0x09000000) {
ret = lbs_power_adapt_cfg_ext(...);
} else {
ret = lbs_power_adapt_cfg(...);
}Thanks again!
Dan
Quoted 34 lines
drivers/net/wireless/libertas/wext.c +16
-1+if (ret) + goto out; + ret =lbs_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, @@ -1830,7 +1840,8 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, goto out; } -/* Validate requested power level against firmware allowed levels */ +/* Validate requested power level against firmware allowed +* levels */ if (priv->txpower_min && (dbm < priv->txpower_min)) { ret = -EINVAL ; goto out;@@ -1840,6 +1851,14 @@ 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 the radio was off, turn it on */
Hello,
Thanks for the great feedback.
Quoted 10 lines · Dan Williams
drivers/net/wireless/libertas/cmd.c void lbs_ps_confirm_sleep(struct lbs_private *priv) · line 1987
Quoted 6 lines · Anna Neal
drivers/net/wireless/libertas/cmd.c +2
-0+int lbs_tpc_cfg (struct lbs_private *priv,int enable,int8_t p0,int8_t p1, +int8_t p2,int usesnr)Can we rename this to
lbs_set_tpc_cfg()? It's a setter, and there could be a getter later, best to be clear about this.
Definitely.
Quoted 5 lines
drivers/net/wireless/libertas/cmd.c void lbs_ps_confirm_sleep(struct lbs_private *priv) · line 2019
Quoted 2 lines
drivers/net/wireless/libertas/cmd.c +2
-0+int lbs_power_adapt_cfg (struct lbs_private *priv,int enable,int8_t p0, +int8_t p1,int8_t p2)Same here, can we change this to
lbs_set_pa_cfg()orlbs_set_power_adapt_cfg()?
Makes sense.
Quoted 10 lines
Quoted 10 lines
drivers/net/wireless/libertas/cmd.c +10
-0+{ +struct cmd_ds_802_11_pa_cfg cmd; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_SET ); + cmd.enable = !!enable; + cmd.P0 = p0; + cmd.P1 = p1;
Quoted 8 lines
Quoted 1 line
+ cmd.P2 = p2;
And this isn't compatible with the V9 and later firmware, which uses the
PowerAdapt_Group_tMarvell IE. I'd suggest defining two different commands, one for V8 and below which uses the format you have here, and one for V9 and above which uses the new format. I have no idea what the fields inPA_Group_tare, but I'm sure you can find out since you're from CozyBit :)
We don't have V{9,10} hardware nor access to a final published spec. How about if we wrap our changes around version checks and leave things unchanged for other versions?
Quoted 12 lines
drivers/net/wireless/libertas/host.h line 86
Quoted 9 lines
drivers/net/wireless/libertas/host.h +1
-0@@ -83,6 +83,7 @@#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067#define CMD_802_11_SLEEP_PERIOD 0x0068#define CMD_802_11_TPC_CFG 0x0072 +#define CMD_802_11_PA_CFG 0x0073Should also:
Quoted 3 lines
#define
CMD_802_11_POWER_ADAPT_CFG_EXT0x0073/* v9 firmware and above */and use that in the v9+
lbs_set_power_adapt_cfg_ext()function.
Again, without hardware or the final spec implementation of this may need to wait on my end.
Quoted 33 lines
drivers/net/wireless/libertas/host.h
Quoted 11 lines
drivers/net/wireless/libertas/host.h +11
-0+struct cmd_ds_802_11_pa_cfg { +struct cmd_header hdr; + +__le16 action; +uint8_t enable; +int8_t P0; +int8_t P1; +int8_t P2; +} __attribute__ ((packed)); + +And for v9:
struct pa_group { u16 level; u16 rate_map; u32 reserved; }struct mrvl_ie_pa_group { mrvlietypes_header hdr; struct pa_group groups[5]; }struct cmd_ds_802_11_pa_cfg_ext { struct cmd_header hdr; __le16 action; u16 enable; struct mrvl_ie_pa_group pa_groups; }
Quoted 5 lines
note that there isn't an existing GPL implementation of
POWER_ADAPT_CFG_EXTeither at moblin or anywhere else, so I can't suggest what to fill in for therate_mapand level of structpa_groupin the implementation. Ask Luis or Javier I guess since they probably have access to that information.
Javier just confirmed that we don't have access to this.
Quoted 22 lines
Quoted 8 lines
struct cmd_ds_802_11_led_ctrl { __le16 action; __le16 numled;drivers/net/wireless/libertas/wext.c +0
-0drivers/net/wireless/libertas/wext.c static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, · line 1827
Quoted 9 lines
drivers/net/wireless/libertas/wext.c +5
-1@@ -1820,7 +1820,17 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, }if (vwrq->fixed ==0 ) { -/* Auto power control */ +/* 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 );and do the firmware check right here and call
lbs_set_power_adapt_cfg()for V8 and lower, andlbs_set_power_adapt_cfg_ext()for v9 and higher like so:
Quoted 5 lines
if (priv->fwrelease >= 0x09000000) {
ret = lbs_power_adapt_cfg_ext(...);
} else {
ret = lbs_power_adapt_cfg(...);
}So, to summarize, what I can do is...
Quoted 3 lines
if (priv->fwrelease < 0x09000000) {
ret = lbs_power_adapt_cfg(...);
}...would this be acceptable? After all, it is still an improvement over what's currently in the driver.
Thanks again!
Anna
Quoted 45 lines · Anna Neal
Hello,
Thanks for the great feedback.
Quoted 10 lines · Dan Williams
drivers/net/wireless/libertas/cmd.c void lbs_ps_confirm_sleep(struct lbs_private *priv) · line 1987
Quoted 6 lines · Anna Neal
drivers/net/wireless/libertas/cmd.c +2
-0+int lbs_tpc_cfg (struct lbs_private *priv,int enable,int8_t p0,int8_t p1, +int8_t p2,int usesnr)Can we rename this to
lbs_set_tpc_cfg()? It's a setter, and there could be a getter later, best to be clear about this.Definitely.
Quoted 5 lines
drivers/net/wireless/libertas/cmd.c void lbs_ps_confirm_sleep(struct lbs_private *priv) · line 2019
Quoted 2 lines
drivers/net/wireless/libertas/cmd.c +2
-0+int lbs_power_adapt_cfg (struct lbs_private *priv,int enable,int8_t p0, +int8_t p1,int8_t p2)Same here, can we change this to
lbs_set_pa_cfg()orlbs_set_power_adapt_cfg()?Makes sense.
Quoted 10 lines
Quoted 10 lines
drivers/net/wireless/libertas/cmd.c +10
-0+{ +struct cmd_ds_802_11_pa_cfg cmd; +int ret; + +memset (&cmd,0 ,sizeof (cmd)); + cmd.hdr.size =cpu_to_le16 (sizeof (cmd)); + cmd.action =cpu_to_le16 (CMD_ACT_SET ); + cmd.enable = !!enable; + cmd.P0 = p0; + cmd.P1 = p1;Quoted 8 lines
Quoted 1 line
+ cmd.P2 = p2;
And this isn't compatible with the V9 and later firmware, which uses the
PowerAdapt_Group_tMarvell IE. I'd suggest defining two different commands, one for V8 and below which uses the format you have here, and one for V9 and above which uses the new format. I have no idea what the fields inPA_Group_tare, but I'm sure you can find out since you're from CozyBit :)
Quoted 3 lines
We don't have V{9,10} hardware nor access to a final published spec. How about if we wrap our changes around version checks and leave things unchanged for other versions?
Odd. In any case, your suggestion sounds fine. I'll do the V9+ bits when there's time.
Thanks!
Dan
Quoted 100 lines
Quoted 12 lines
drivers/net/wireless/libertas/host.h line 86
Quoted 9 lines
drivers/net/wireless/libertas/host.h +1
-0@@ -83,6 +83,7 @@#define CMD_802_11_INACTIVITY_TIMEOUT 0x0067#define CMD_802_11_SLEEP_PERIOD 0x0068#define CMD_802_11_TPC_CFG 0x0072 +#define CMD_802_11_PA_CFG 0x0073Should also:
Quoted 3 lines
#define
CMD_802_11_POWER_ADAPT_CFG_EXT0x0073/* v9 firmware and above */and use that in the v9+
lbs_set_power_adapt_cfg_ext()function.Again, without hardware or the final spec implementation of this may need to wait on my end.
Quoted 33 lines
drivers/net/wireless/libertas/host.h
Quoted 11 lines
drivers/net/wireless/libertas/host.h +11
-0+struct cmd_ds_802_11_pa_cfg { +struct cmd_header hdr; + +__le16 action; +uint8_t enable; +int8_t P0; +int8_t P1; +int8_t P2; +} __attribute__ ((packed)); + +And for v9:
struct pa_group { u16 level; u16 rate_map; u32 reserved; }struct mrvl_ie_pa_group { mrvlietypes_header hdr; struct pa_group groups[5]; }struct cmd_ds_802_11_pa_cfg_ext { struct cmd_header hdr; __le16 action; u16 enable; struct mrvl_ie_pa_group pa_groups; }Quoted 5 lines
note that there isn't an existing GPL implementation of
POWER_ADAPT_CFG_EXTeither at moblin or anywhere else, so I can't suggest what to fill in for therate_mapand level of structpa_groupin the implementation. Ask Luis or Javier I guess since they probably have access to that information.Javier just confirmed that we don't have access to this.
Quoted 22 lines
Quoted 8 lines
struct cmd_ds_802_11_led_ctrl { __le16 action; __le16 numled;drivers/net/wireless/libertas/wext.c +0
-0drivers/net/wireless/libertas/wext.c static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, · line 1827
Quoted 9 lines
drivers/net/wireless/libertas/wext.c +5
-1@@ -1820,7 +1820,17 @@ static int lbs_set_txpow(struct net_device *dev, struct iw_request_info *info, }if (vwrq->fixed ==0 ) { -/* Auto power control */ +/* 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 );and do the firmware check right here and call
lbs_set_power_adapt_cfg()for V8 and lower, andlbs_set_power_adapt_cfg_ext()for v9 and higher like so:Quoted 5 lines
if (priv->fwrelease >= 0x09000000) { ret = lbs_power_adapt_cfg_ext(...); } else { ret = lbs_power_adapt_cfg(...); }So, to summarize, what I can do is...
Quoted 3 lines
if (priv->fwrelease < 0x09000000) { ret = lbs_power_adapt_cfg(...); }...would this be acceptable? After all, it is still an improvement over what's currently in the driver.
Thanks again!
Anna