aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-06-16 03:38:31 -0400
committerGuido Guenther <agx@sigxcpu.org>2007-06-16 13:42:57 +0200
commit50f4afa032dca9bab401284d5b87c149cae6a5c5 (patch)
treec7b19d044434f33e4fe05f361fd1172a816bf118
parent494b39d0c20ab65cd2269ad54b5d09ecc4a24468 (diff)
[PATCH] Add full support for "auto" preamble
Don't assume that there are just two settings, "long" and "short". Provide textual description in the output of "iwpriv get_preamble" in the same format as in ipw2100 and ipw2200. Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r--at76_usb.c19
-rw-r--r--at76_usb.h7
2 files changed, 13 insertions, 13 deletions
diff --git a/at76_usb.c b/at76_usb.c
index 8c28534..abdaf50 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -184,6 +184,8 @@ static const long channel_frequency[] = {
2447, 2452, 2457, 2462, 2467, 2472, 2484
};
+static const char *const preambles[] = { "long", "short", "auto" };
+
#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
/* Firmware download */
@@ -1829,7 +1831,7 @@ static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
capa = bss->capa;
if (priv->wep_enabled)
capa |= WLAN_CAPABILITY_PRIVACY;
- if (priv->preamble_type == PREAMBLE_TYPE_SHORT)
+ if (priv->preamble_type != PREAMBLE_TYPE_LONG)
capa |= WLAN_CAPABILITY_SHORT_PREAMBLE;
req->capability = cpu_to_le16(capa);
@@ -1909,7 +1911,7 @@ static int at76_reassoc_req(struct at76_priv *priv, struct bss_info *curr_bss,
capa = new_bss->capa;
if (priv->wep_enabled)
capa |= WLAN_CAPABILITY_PRIVACY;
- if (priv->preamble_type == PREAMBLE_TYPE_SHORT)
+ if (priv->preamble_type != PREAMBLE_TYPE_LONG)
capa |= WLAN_CAPABILITY_SHORT_PREAMBLE;
req->capability = cpu_to_le16(capa);
@@ -3337,9 +3339,7 @@ static int at76_iw_set_short_preamble(struct net_device *netdev,
at76_dbg(DBG_IOCTL, "%s: AT76_SET_SHORT_PREAMBLE, %d",
netdev->name, val);
- if (val < 0 || val > 2) {
- /* allow value of 2 - in the win98 driver it stands
- for "auto preamble" ...? */
+ if (val < PREAMBLE_TYPE_LONG || val > PREAMBLE_TYPE_AUTO) {
ret = -EINVAL;
} else {
priv->preamble_type = val;
@@ -3353,9 +3353,9 @@ static int at76_iw_get_short_preamble(struct net_device *netdev,
union iwreq_data *wrqu, char *extra)
{
struct at76_priv *priv = netdev_priv(netdev);
- int *param = (int *)extra;
- param[0] = priv->preamble_type;
+ snprintf(wrqu->name, sizeof(wrqu->name), "%s (%d)",
+ preambles[priv->preamble_type], priv->preamble_type);
return 0;
}
@@ -3616,7 +3616,7 @@ static const struct iw_priv_args at76_priv_args[] = {
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "set_preamble"},
{AT76_GET_SHORT_PREAMBLE,
- 0, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "get_preamble"},
+ 0, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | 10, "get_preamble"},
/* we must pass the new debug mask as a string, because iwpriv cannot
* parse hex numbers starting with 0x :-( */
@@ -4594,8 +4594,7 @@ static int at76_startup_device(struct at76_priv *priv)
priv->wep_key_id, priv->wep_keys_len[priv->wep_key_id]);
dbg("%s param: preamble %s rts %d retry %d frag %d "
"txrate %s auth_mode %d", priv->netdev->name,
- priv->preamble_type ==
- PREAMBLE_TYPE_SHORT ? "short" : "long", priv->rts_threshold,
+ preambles[priv->preamble_type], priv->rts_threshold,
priv->short_retry_limit, priv->frag_threshold,
priv->txrate == TX_RATE_1MBIT ? "1MBit" : priv->txrate ==
TX_RATE_2MBIT ? "2MBit" : priv->txrate ==
diff --git a/at76_usb.h b/at76_usb.h
index 532b2f8..63d0c23 100644
--- a/at76_usb.h
+++ b/at76_usb.h
@@ -28,7 +28,7 @@
#define DRIVER_VERSION "0.15dev"
/* our private ioctl's */
-/* preamble length (0 - long, 1 - short) */
+/* preamble length (0 - long, 1 - short, 2 - auto) */
#define AT76_SET_SHORT_PREAMBLE (SIOCIWFIRSTPRIV + 0)
#define AT76_GET_SHORT_PREAMBLE (SIOCIWFIRSTPRIV + 1)
/* which debug channels are enabled */
@@ -93,8 +93,9 @@
#define INFRASTRUCTURE_MODE 2
/* values for struct mib_local, field preamble_type */
-#define PREAMBLE_TYPE_SHORT 1
#define PREAMBLE_TYPE_LONG 0
+#define PREAMBLE_TYPE_SHORT 1
+#define PREAMBLE_TYPE_AUTO 2
/* values for tx_rate */
#define TX_RATE_1MBIT 0
@@ -513,7 +514,7 @@ struct at76_priv {
int radio_on;
int promisc;
- int preamble_type; /* 0 - long preamble, 1 - short preamble */
+ int preamble_type; /* 0 - long, 1 - short, 2 - auto */
int auth_mode; /* authentication type: 0 open, 1 shared key */
int txrate; /* 0,1,2,3 = 1,2,5.5,11 MBit, 4 is auto-fallback */
int frag_threshold; /* threshold for fragmentation of tx packets */