Commit a6bb1bce authored by Dan Williams's avatar Dan Williams Committed by John W. Linville

libertas: convert CMD_FWT_ACCESS to a direct command

Slightly different approach here since there are so many arguments to
the firmware command.  Just let the caller fill them in before pushing
the command to the firmware.
Signed-off-by: default avatarDan Williams <dcbw@redhat.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 52148655
...@@ -1206,14 +1206,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, ...@@ -1206,14 +1206,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
ret = lbs_cmd_802_11_ps_mode(cmdptr, cmd_action); ret = lbs_cmd_802_11_ps_mode(cmdptr, cmd_action);
break; break;
#ifdef CONFIG_LIBERTAS_MESH
case CMD_FWT_ACCESS:
ret = lbs_cmd_fwt_access(cmdptr, cmd_action, pdata_buf);
break;
#endif
case CMD_802_11_DEEP_SLEEP: case CMD_802_11_DEEP_SLEEP:
cmdptr->command = cpu_to_le16(CMD_802_11_DEEP_SLEEP); cmdptr->command = cpu_to_le16(CMD_802_11_DEEP_SLEEP);
cmdptr->size = cpu_to_le16(sizeof(struct cmd_header)); cmdptr->size = cpu_to_le16(sizeof(struct cmd_header));
......
...@@ -59,7 +59,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ...@@ -59,7 +59,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
{ {
struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response; struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response;
int ret = 0; int ret = 0;
unsigned long flags;
uint16_t respcmd = le16_to_cpu(resp->command); uint16_t respcmd = le16_to_cpu(resp->command);
lbs_deb_enter(LBS_DEB_HOST); lbs_deb_enter(LBS_DEB_HOST);
...@@ -68,14 +67,6 @@ static inline int handle_cmd_response(struct lbs_private *priv, ...@@ -68,14 +67,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
case CMD_RET(CMD_802_11_BEACON_STOP): case CMD_RET(CMD_802_11_BEACON_STOP):
break; break;
case CMD_RET(CMD_FWT_ACCESS):
spin_lock_irqsave(&priv->driver_lock, flags);
if (priv->cur_cmd->callback_arg)
memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.fwt,
sizeof(resp->params.fwt));
spin_unlock_irqrestore(&priv->driver_lock, flags);
break;
default: default:
lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n", lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n",
le16_to_cpu(resp->command)); le16_to_cpu(resp->command));
......
...@@ -912,6 +912,8 @@ struct cmd_ds_bt_access { ...@@ -912,6 +912,8 @@ struct cmd_ds_bt_access {
} __packed; } __packed;
struct cmd_ds_fwt_access { struct cmd_ds_fwt_access {
struct cmd_header hdr;
__le16 action; __le16 action;
__le32 id; __le32 id;
u8 valid; u8 valid;
...@@ -961,7 +963,6 @@ struct cmd_ds_command { ...@@ -961,7 +963,6 @@ struct cmd_ds_command {
/* command Body */ /* command Body */
union { union {
struct cmd_ds_802_11_ps_mode psmode; struct cmd_ds_802_11_ps_mode psmode;
struct cmd_ds_fwt_access fwt;
} params; } params;
} __packed; } __packed;
#endif #endif
...@@ -613,25 +613,31 @@ int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1) ...@@ -613,25 +613,31 @@ int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1)
return ret; return ret;
} }
int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, /**
u16 cmd_action, void *pdata_buf) * @brief Access the mesh forwarding table
*
* @param priv A pointer to struct lbs_private structure
* @param cmd_action The forwarding table action to perform
* @param cmd The pre-filled FWT_ACCESS command
*
* @return 0 on success and 'cmd' will be filled with the
* firmware's response
*/
int lbs_cmd_fwt_access(struct lbs_private *priv, u16 cmd_action,
struct cmd_ds_fwt_access *cmd)
{ {
struct cmd_ds_fwt_access *fwt_access = &cmd->params.fwt; int ret;
lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
cmd->command = cpu_to_le16(CMD_FWT_ACCESS); lbs_deb_enter_args(LBS_DEB_CMD, "action %d", cmd_action);
cmd->size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access) +
sizeof(struct cmd_header));
cmd->result = 0;
if (pdata_buf) cmd->hdr.command = cpu_to_le16(CMD_FWT_ACCESS);
memcpy(fwt_access, pdata_buf, sizeof(*fwt_access)); cmd->hdr.size = cpu_to_le16(sizeof(struct cmd_ds_fwt_access));
else cmd->hdr.result = 0;
memset(fwt_access, 0, sizeof(*fwt_access)); cmd->action = cpu_to_le16(cmd_action);
fwt_access->action = cpu_to_le16(cmd_action); ret = lbs_cmd_with_response(priv, CMD_FWT_ACCESS, cmd);
lbs_deb_leave(LBS_DEB_CMD); lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return 0; return 0;
} }
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <net/lib80211.h> #include <net/lib80211.h>
#include "host.h"
#ifdef CONFIG_LIBERTAS_MESH #ifdef CONFIG_LIBERTAS_MESH
...@@ -57,8 +58,9 @@ int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted); ...@@ -57,8 +58,9 @@ int lbs_mesh_bt_get_inverted(struct lbs_private *priv, bool *inverted);
int lbs_mesh_bt_set_inverted(struct lbs_private *priv, bool inverted); int lbs_mesh_bt_set_inverted(struct lbs_private *priv, bool inverted);
int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1); int lbs_mesh_bt_get_entry(struct lbs_private *priv, u32 id, u8 *addr1);
int lbs_cmd_fwt_access(struct cmd_ds_command *cmd, int lbs_cmd_fwt_access(struct lbs_private *priv, u16 cmd_action,
u16 cmd_action, void *pdata_buf); struct cmd_ds_fwt_access *cmd);
int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action, int lbs_mesh_access(struct lbs_private *priv, uint16_t cmd_action,
struct cmd_ds_mesh_access *cmd); struct cmd_ds_mesh_access *cmd);
int lbs_mesh_config_send(struct lbs_private *priv, int lbs_mesh_config_send(struct lbs_private *priv,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment