Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 111690
b: refs/heads/master
c: 39fcf7a
h: refs/heads/master
v: v3
  • Loading branch information
Dan Williams authored and John W. Linville committed Sep 15, 2008
1 parent db8bad2 commit 0ffbe5c
Show file tree
Hide file tree
Showing 10 changed files with 173 additions and 265 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 500c064d3a5f9c8aa604ef63a1346ab70eed443a
refs/heads/master: 39fcf7a315e098430e878a5c0c4d39561c93ebf6
6 changes: 1 addition & 5 deletions trunk/drivers/net/wireless/libertas/assoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -823,11 +823,7 @@ static int assoc_helper_mode(struct lbs_private *priv,
}

priv->mode = assoc_req->mode;
ret = lbs_prepare_and_send_command(priv,
CMD_802_11_SNMP_MIB,
0, CMD_OPTION_WAITFORRSP,
OID_802_11_INFRASTRUCTURE_MODE,
/* Shoot me now */ (void *) (size_t) assoc_req->mode);
ret = lbs_set_snmp_mib(priv, SNMP_MIB_OID_BSS_TYPE, assoc_req->mode);

done:
lbs_deb_leave_args(LBS_DEB_ASSOC, "ret %d", ret);
Expand Down
180 changes: 77 additions & 103 deletions trunk/drivers/net/wireless/libertas/cmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,124 +480,103 @@ int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
return ret;
}

static int lbs_cmd_802_11_snmp_mib(struct lbs_private *priv,
struct cmd_ds_command *cmd,
int cmd_action,
int cmd_oid, void *pdata_buf)
/**
* @brief Set an SNMP MIB value
*
* @param priv A pointer to struct lbs_private structure
* @param oid The OID to set in the firmware
* @param val Value to set the OID to
*
* @return 0 on success, error on failure
*/
int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val)
{
struct cmd_ds_802_11_snmp_mib *pSNMPMIB = &cmd->params.smib;
u8 ucTemp;
struct cmd_ds_802_11_snmp_mib cmd;
int ret;

lbs_deb_enter(LBS_DEB_CMD);

lbs_deb_cmd("SNMP_CMD: cmd_oid = 0x%x\n", cmd_oid);

cmd->command = cpu_to_le16(CMD_802_11_SNMP_MIB);
cmd->size = cpu_to_le16(sizeof(*pSNMPMIB) + S_DS_GEN);

switch (cmd_oid) {
case OID_802_11_INFRASTRUCTURE_MODE:
{
u8 mode = (u8) (size_t) pdata_buf;
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
pSNMPMIB->oid = cpu_to_le16((u16) DESIRED_BSSTYPE_I);
pSNMPMIB->bufsize = cpu_to_le16(sizeof(u8));
if (mode == IW_MODE_ADHOC) {
ucTemp = SNMP_MIB_VALUE_ADHOC;
} else {
/* Infra and Auto modes */
ucTemp = SNMP_MIB_VALUE_INFRA;
}

memmove(pSNMPMIB->value, &ucTemp, sizeof(u8));
memset(&cmd, 0, sizeof (cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(CMD_ACT_SET);
cmd.oid = cpu_to_le16((u16) oid);

switch (oid) {
case SNMP_MIB_OID_BSS_TYPE:
cmd.bufsize = cpu_to_le16(sizeof(u8));
cmd.value[0] = (val == IW_MODE_ADHOC) ? 2 : 1;
break;
case SNMP_MIB_OID_11D_ENABLE:
case SNMP_MIB_OID_FRAG_THRESHOLD:
case SNMP_MIB_OID_RTS_THRESHOLD:
case SNMP_MIB_OID_SHORT_RETRY_LIMIT:
case SNMP_MIB_OID_LONG_RETRY_LIMIT:
cmd.bufsize = cpu_to_le16(sizeof(u16));
*((__le16 *)(&cmd.value)) = cpu_to_le16(val);
break;
default:
lbs_deb_cmd("SNMP_CMD: (set) unhandled OID 0x%x\n", oid);
ret = -EINVAL;
goto out;
}

case OID_802_11D_ENABLE:
{
u32 ulTemp;

pSNMPMIB->oid = cpu_to_le16((u16) DOT11D_I);

if (cmd_action == CMD_ACT_SET) {
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
ulTemp = *(u32 *)pdata_buf;
*((__le16 *)(pSNMPMIB->value)) =
cpu_to_le16((u16) ulTemp);
}
break;
}

case OID_802_11_FRAGMENTATION_THRESHOLD:
{
u32 ulTemp;

pSNMPMIB->oid = cpu_to_le16((u16) FRAGTHRESH_I);
lbs_deb_cmd("SNMP_CMD: (set) oid 0x%x, oid size 0x%x, value 0x%x\n",
le16_to_cpu(cmd.oid), le16_to_cpu(cmd.bufsize), val);

if (cmd_action == CMD_ACT_GET) {
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET);
} else if (cmd_action == CMD_ACT_SET) {
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
ulTemp = *((u32 *) pdata_buf);
*((__le16 *)(pSNMPMIB->value)) =
cpu_to_le16((u16) ulTemp);
ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd);

}

break;
}
out:
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}

case OID_802_11_RTS_THRESHOLD:
{
/**
* @brief Get an SNMP MIB value
*
* @param priv A pointer to struct lbs_private structure
* @param oid The OID to retrieve from the firmware
* @param out_val Location for the returned value
*
* @return 0 on success, error on failure
*/
int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val)
{
struct cmd_ds_802_11_snmp_mib cmd;
int ret;

u32 ulTemp;
pSNMPMIB->oid = cpu_to_le16(RTSTHRESH_I);
lbs_deb_enter(LBS_DEB_CMD);

if (cmd_action == CMD_ACT_GET) {
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET);
} else if (cmd_action == CMD_ACT_SET) {
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
ulTemp = *((u32 *)pdata_buf);
*(__le16 *)(pSNMPMIB->value) =
cpu_to_le16((u16) ulTemp);
memset(&cmd, 0, sizeof (cmd));
cmd.hdr.size = cpu_to_le16(sizeof(cmd));
cmd.action = cpu_to_le16(CMD_ACT_GET);
cmd.oid = cpu_to_le16(oid);

}
break;
}
case OID_802_11_TX_RETRYCOUNT:
pSNMPMIB->oid = cpu_to_le16((u16) SHORT_RETRYLIM_I);

if (cmd_action == CMD_ACT_GET) {
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_GET);
} else if (cmd_action == CMD_ACT_SET) {
pSNMPMIB->querytype = cpu_to_le16(CMD_ACT_SET);
pSNMPMIB->bufsize = cpu_to_le16(sizeof(u16));
*((__le16 *)(pSNMPMIB->value)) =
cpu_to_le16((u16) priv->txretrycount);
}
ret = lbs_cmd_with_response(priv, CMD_802_11_SNMP_MIB, &cmd);
if (ret)
goto out;

switch (le16_to_cpu(cmd.bufsize)) {
case sizeof(u8):
if (oid == SNMP_MIB_OID_BSS_TYPE) {
if (cmd.value[0] == 2)
*out_val = IW_MODE_ADHOC;
else
*out_val = IW_MODE_INFRA;
} else
*out_val = cmd.value[0];
break;
case sizeof(u16):
*out_val = le16_to_cpu(*((__le16 *)(&cmd.value)));
break;
default:
lbs_deb_cmd("SNMP_CMD: (get) unhandled OID 0x%x size %d\n",
oid, le16_to_cpu(cmd.bufsize));
break;
}

lbs_deb_cmd(
"SNMP_CMD: command=0x%x, size=0x%x, seqnum=0x%x, result=0x%x\n",
le16_to_cpu(cmd->command), le16_to_cpu(cmd->size),
le16_to_cpu(cmd->seqnum), le16_to_cpu(cmd->result));

lbs_deb_cmd(
"SNMP_CMD: action 0x%x, oid 0x%x, oidsize 0x%x, value 0x%x\n",
le16_to_cpu(pSNMPMIB->querytype), le16_to_cpu(pSNMPMIB->oid),
le16_to_cpu(pSNMPMIB->bufsize),
le16_to_cpu(*(__le16 *) pSNMPMIB->value));

lbs_deb_leave(LBS_DEB_CMD);
return 0;
out:
lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
return ret;
}

/**
Expand Down Expand Up @@ -1409,11 +1388,6 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
ret = lbs_cmd_80211_authenticate(priv, cmdptr, pdata_buf);
break;

case CMD_802_11_SNMP_MIB:
ret = lbs_cmd_802_11_snmp_mib(priv, cmdptr,
cmd_action, cmd_oid, pdata_buf);
break;

case CMD_MAC_REG_ACCESS:
case CMD_BBP_REG_ACCESS:
case CMD_RF_REG_ACCESS:
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/net/wireless/libertas/cmd.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ int lbs_set_tx_power(struct lbs_private *priv, s16 dbm);

int lbs_set_radio(struct lbs_private *priv, u8 preamble, u8 radio_on);

int lbs_set_snmp_mib(struct lbs_private *priv, u32 oid, u16 val);

int lbs_get_snmp_mib(struct lbs_private *priv, u32 oid, u16 *out_val);

#endif /* _LBS_CMD_H */
46 changes: 0 additions & 46 deletions trunk/drivers/net/wireless/libertas/cmdresp.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,48 +146,6 @@ static int lbs_ret_reg_access(struct lbs_private *priv,
return ret;
}

static int lbs_ret_802_11_snmp_mib(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
struct cmd_ds_802_11_snmp_mib *smib = &resp->params.smib;
u16 oid = le16_to_cpu(smib->oid);
u16 querytype = le16_to_cpu(smib->querytype);

lbs_deb_enter(LBS_DEB_CMD);

lbs_deb_cmd("SNMP_RESP: oid 0x%x, querytype 0x%x\n", oid,
querytype);
lbs_deb_cmd("SNMP_RESP: Buf size %d\n", le16_to_cpu(smib->bufsize));

if (querytype == CMD_ACT_GET) {
switch (oid) {
case FRAGTHRESH_I:
priv->fragthsd =
le16_to_cpu(*((__le16 *)(smib->value)));
lbs_deb_cmd("SNMP_RESP: frag threshold %u\n",
priv->fragthsd);
break;
case RTSTHRESH_I:
priv->rtsthsd =
le16_to_cpu(*((__le16 *)(smib->value)));
lbs_deb_cmd("SNMP_RESP: rts threshold %u\n",
priv->rtsthsd);
break;
case SHORT_RETRYLIM_I:
priv->txretrycount =
le16_to_cpu(*((__le16 *)(smib->value)));
lbs_deb_cmd("SNMP_RESP: tx retry count %u\n",
priv->rtsthsd);
break;
default:
break;
}
}

lbs_deb_enter(LBS_DEB_CMD);
return 0;
}

static int lbs_ret_802_11_rssi(struct lbs_private *priv,
struct cmd_ds_command *resp)
{
Expand Down Expand Up @@ -258,10 +216,6 @@ static inline int handle_cmd_response(struct lbs_private *priv,
ret = lbs_ret_80211_associate(priv, resp);
break;

case CMD_RET(CMD_802_11_SNMP_MIB):
ret = lbs_ret_802_11_snmp_mib(priv, resp);
break;

case CMD_RET(CMD_802_11_SET_AFC):
case CMD_RET(CMD_802_11_GET_AFC):
spin_lock_irqsave(&priv->driver_lock, flags);
Expand Down
27 changes: 0 additions & 27 deletions trunk/drivers/net/wireless/libertas/defs.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,27 +352,6 @@ enum mv_ms_type {
MVMS_EVENT
};

/** SNMP_MIB_INDEX_e */
enum SNMP_MIB_INDEX_e {
DESIRED_BSSTYPE_I = 0,
OP_RATESET_I,
BCNPERIOD_I,
DTIMPERIOD_I,
ASSOCRSP_TIMEOUT_I,
RTSTHRESH_I,
SHORT_RETRYLIM_I,
LONG_RETRYLIM_I,
FRAGTHRESH_I,
DOT11D_I,
DOT11H_I,
MANUFID_I,
PRODID_I,
MANUF_OUI_I,
MANUF_NAME_I,
MANUF_PRODNAME_I,
MANUF_PRODVER_I,
};

/** KEY_TYPE_ID */
enum KEY_TYPE_ID {
KEY_TYPE_ID_WEP = 0,
Expand All @@ -387,12 +366,6 @@ enum KEY_INFO_WPA {
KEY_INFO_WPA_ENABLED = 0x04
};

/** SNMP_MIB_VALUE_e */
enum SNMP_MIB_VALUE_e {
SNMP_MIB_VALUE_INFRA = 1,
SNMP_MIB_VALUE_ADHOC
};

/* Default values for fwt commands. */
#define FWT_DEFAULT_METRIC 0
#define FWT_DEFAULT_DIR 1
Expand Down
3 changes: 0 additions & 3 deletions trunk/drivers/net/wireless/libertas/dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,6 @@ struct lbs_private {
uint16_t enablehwauto;
uint16_t ratebitmap;

u32 fragthsd;
u32 rtsthsd;

u8 txretrycount;

/** Tx-related variables (for single packet tx) */
Expand Down
24 changes: 13 additions & 11 deletions trunk/drivers/net/wireless/libertas/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@
#define DEFAULT_AD_HOC_CHANNEL 6
#define DEFAULT_AD_HOC_CHANNEL_A 36

/** IEEE 802.11 oids */
#define OID_802_11_SSID 0x00008002
#define OID_802_11_INFRASTRUCTURE_MODE 0x00008008
#define OID_802_11_FRAGMENTATION_THRESHOLD 0x00008009
#define OID_802_11_RTS_THRESHOLD 0x0000800A
#define OID_802_11_TX_ANTENNA_SELECTED 0x0000800D
#define OID_802_11_SUPPORTED_RATES 0x0000800E
#define OID_802_11_STATISTICS 0x00008012
#define OID_802_11_TX_RETRYCOUNT 0x0000801D
#define OID_802_11D_ENABLE 0x00008020

#define CMD_OPTION_WAITFORRSP 0x0002

/** Host command IDs */
Expand Down Expand Up @@ -191,6 +180,19 @@
#define CMD_WAKE_METHOD_COMMAND_INT 0x0001
#define CMD_WAKE_METHOD_GPIO 0x0002

/* Object IDs for CMD_802_11_SNMP_MIB */
#define SNMP_MIB_OID_BSS_TYPE 0x0000
#define SNMP_MIB_OID_OP_RATE_SET 0x0001
#define SNMP_MIB_OID_BEACON_PERIOD 0x0002 /* Reserved on v9+ */
#define SNMP_MIB_OID_DTIM_PERIOD 0x0003 /* Reserved on v9+ */
#define SNMP_MIB_OID_ASSOC_TIMEOUT 0x0004 /* Reserved on v9+ */
#define SNMP_MIB_OID_RTS_THRESHOLD 0x0005
#define SNMP_MIB_OID_SHORT_RETRY_LIMIT 0x0006
#define SNMP_MIB_OID_LONG_RETRY_LIMIT 0x0007
#define SNMP_MIB_OID_FRAG_THRESHOLD 0x0008
#define SNMP_MIB_OID_11D_ENABLE 0x0009
#define SNMP_MIB_OID_11H_ENABLE 0x000A

/* Define action or option for CMD_BT_ACCESS */
enum cmd_bt_access_opts {
/* The bt commands start at 5 instead of 1 because the old dft commands
Expand Down
Loading

0 comments on commit 0ffbe5c

Please sign in to comment.