From: Dan Williams <dcbw@redhat.com>
To: Masakazu Mokuno <mokuno@sm.sony.co.jp>
Cc: linux-wireless@vger.kernel.org, geoffrey.levand@am.sony.com,
Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Subject: Re: [PATCH 3/3] PS3: gelic: Add support for ESSID scan
Date: Fri, 30 May 2008 13:51:44 -0400 [thread overview]
Message-ID: <1212169904.8178.27.camel@localhost.localdomain> (raw)
In-Reply-To: <20080530162420.473C.40F06B3A@sm.sony.co.jp>
On Fri, 2008-05-30 at 16:27 +0900, Masakazu Mokuno wrote:
> This adds the support for ESSID scanning
You'll want to:
range->scan_capa = IW_SCAN_CAPA_ESSID;
in your SIOCGIWRANGE handler too.
Dan
> Signed-off-by: Masakazu Mokuno <mokuno@sm.sony.co.jp>
> ---
> drivers/net/ps3_gelic_wireless.c | 62 ++++++++++++++++++++++++++++++++++-----
> 1 file changed, 55 insertions(+), 7 deletions(-)
>
> --- a/drivers/net/ps3_gelic_wireless.c
> +++ b/drivers/net/ps3_gelic_wireless.c
> @@ -45,7 +45,8 @@
> #include "ps3_gelic_wireless.h"
>
>
> -static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan);
> +static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan,
> + u8 *essid, size_t essid_len);
> static int gelic_wl_try_associate(struct net_device *netdev);
>
> /*
> @@ -105,6 +106,7 @@ static const struct eurus_cmd_arg_info c
> [GELIC_EURUS_CMD_GET_WEP_CFG] = { .post_arg = 1},
> [GELIC_EURUS_CMD_GET_WPA_CFG] = { .post_arg = 1},
> [GELIC_EURUS_CMD_GET_RSSI_CFG] = { .post_arg = 1},
> + [GELIC_EURUS_CMD_START_SCAN] = { .pre_arg = 1},
> [GELIC_EURUS_CMD_GET_SCAN] = { .post_arg = 1},
> };
>
> @@ -163,7 +165,9 @@ static void gelic_eurus_sync_cmd_worker(
> card = port_to_card(wl_port(wl));
>
> if (cmd_info[cmd->cmd].pre_arg) {
> - arg1 = ps3_mm_phys_to_lpar(__pa(cmd->buffer));
> + arg1 = (cmd->buffer) ?
> + ps3_mm_phys_to_lpar(__pa(cmd->buffer)) :
> + 0;
> arg2 = cmd->buf_size;
> } else {
> arg1 = 0;
> @@ -370,8 +374,18 @@ static int gelic_wl_set_scan(struct net_
> union iwreq_data *wrqu, char *extra)
> {
> struct gelic_wl_info *wl = port_wl(netdev_priv(netdev));
> -
> - return gelic_wl_start_scan(wl, 1);
> + struct iw_scan_req *req;
> + u8 *essid = NULL;
> + size_t essid_len = 0;
> +
> + if (wrqu->data.length == sizeof(struct iw_scan_req) &&
> + wrqu->data.flags & IW_SCAN_THIS_ESSID) {
> + req = (struct iw_scan_req*)extra;
> + essid = req->essid;
> + essid_len = req->essid_len;
> + pr_debug("%s: ESSID scan =%s\n", __func__, essid);
> + }
> + return gelic_wl_start_scan(wl, 1, essid, essid_len);
> }
>
> #define OUI_LEN 3
> @@ -1554,10 +1568,13 @@ static struct iw_statistics *gelic_wl_ge
> /*
> * scanning helpers
> */
> -static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan)
> +static int gelic_wl_start_scan(struct gelic_wl_info *wl, int always_scan,
> + u8 *essid, size_t essid_len)
> {
> struct gelic_eurus_cmd *cmd;
> int ret = 0;
> + void *buf = NULL;
> + size_t len;
>
> pr_debug("%s: <- always=%d\n", __func__, always_scan);
> if (mutex_lock_interruptible(&wl->scan_lock))
> @@ -1580,12 +1597,27 @@ static int gelic_wl_start_scan(struct ge
> complete(&wl->scan_done);
> goto out;
> }
> +
> + /* ESSID scan ? */
> + if (essid_len && essid) {
> + buf = (void *)__get_free_page(GFP_KERNEL);
> + if (!buf) {
> + ret = -ENOMEM;
> + goto out;
> + }
> + len = IW_ESSID_MAX_SIZE; /* hypervisor always requires 32 */
> + memset(buf, 0, len);
> + memcpy(buf, essid, essid_len);
> + pr_debug("%s: essid scan='%s'\n", __func__, (char *)buf);
> + } else
> + len = 0;
> +
> /*
> * issue start scan request
> */
> wl->scan_stat = GELIC_WL_SCAN_STAT_SCANNING;
> cmd = gelic_eurus_sync_cmd(wl, GELIC_EURUS_CMD_START_SCAN,
> - NULL, 0);
> + buf, len);
> if (!cmd || cmd->status || cmd->cmd_status) {
> wl->scan_stat = GELIC_WL_SCAN_STAT_INIT;
> complete(&wl->scan_done);
> @@ -1594,6 +1626,7 @@ static int gelic_wl_start_scan(struct ge
> }
> kfree(cmd);
> out:
> + free_page((unsigned long)buf);
> mutex_unlock(&wl->scan_lock);
> pr_debug("%s: ->\n", __func__);
> return ret;
> @@ -2281,6 +2314,9 @@ static void gelic_wl_assoc_worker(struct
>
> struct gelic_wl_scan_info *best_bss;
> int ret;
> + unsigned long irqflag;
> + u8 *essid;
> + size_t essid_len;
>
> wl = container_of(work, struct gelic_wl_info, assoc_work.work);
>
> @@ -2289,7 +2325,19 @@ static void gelic_wl_assoc_worker(struct
> if (wl->assoc_stat != GELIC_WL_ASSOC_STAT_DISCONN)
> goto out;
>
> - ret = gelic_wl_start_scan(wl, 0);
> + spin_lock_irqsave(&wl->lock, irqflag);
> + if (test_bit(GELIC_WL_STAT_ESSID_SET, &wl->stat)) {
> + pr_debug("%s: assoc ESSID configured %s\n", __func__,
> + wl->essid);
> + essid = wl->essid;
> + essid_len = wl->essid_len;
> + } else {
> + essid = NULL;
> + essid_len = 0;
> + }
> + spin_unlock_irqrestore(&wl->lock, irqflag);
> +
> + ret = gelic_wl_start_scan(wl, 0, essid, essid_len);
> if (ret == -ERESTARTSYS) {
> pr_debug("%s: scan start failed association\n", __func__);
> schedule_delayed_work(&wl->assoc_work, HZ/10); /*FIXME*/
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-05-30 17:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-30 7:17 [PATCH 0/3] PS3: gelic: gelic updates Masakazu Mokuno
2008-05-30 7:27 ` [PATCH 1/3] PS3: gelic: Allocate the bounce buffer dynamically Masakazu Mokuno
2008-05-30 7:27 ` [PATCH 2/3] PS3: gelic: Kill the static bounce buffer Masakazu Mokuno
2008-05-30 7:27 ` [PATCH 3/3] PS3: gelic: Add support for ESSID scan Masakazu Mokuno
2008-05-30 17:51 ` Dan Williams [this message]
2008-06-02 3:42 ` Masakazu Mokuno
2008-06-02 3:49 ` [PATCH 3/3 v2] " Masakazu Mokuno
2008-06-02 13:40 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1212169904.8178.27.camel@localhost.localdomain \
--to=dcbw@redhat.com \
--cc=Geert.Uytterhoeven@sonycom.com \
--cc=geoffrey.levand@am.sony.com \
--cc=linux-wireless@vger.kernel.org \
--cc=mokuno@sm.sony.co.jp \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox