linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Please pull libertas-2.6
@ 2007-06-06  3:55 Dan Williams
  2007-06-09 13:41 ` Dan Williams
  0 siblings, 1 reply; 13+ messages in thread
From: Dan Williams @ 2007-06-06  3:55 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

Hi,

Changes since you last pulled are mainly Christoph-inspired cleanups, a
few bug fixes, mesh scanning, and a few more mesh-specific knobs (though
most likely general to 802.11s implementations, not just the CozyBit
one).

Per the email thread with jgarzik from the last pull, everything from
libertas-2.6 'master' branch is currently targeted at _2.6.22_.

Thanks,
Dan

---

The following changes since commit fce1142de24730373ab0f922896f81e225e132d7:
  John W. Linville (1):
        Merge branch 'libertas'

are found in the git repository at:

  git://git.infradead.org/libertas-2.6

Dan Williams (24):
      libertas: actually remove version.h
      libertas: kill wlan_scan_process_results
      libertas: kill ieeetypes_capinfo bitfield, use ieee80211.h types
      libertas: rename WLAN_802_11_KEY to enc_key and clean up usage
      libertas: clean up indentation in libertas_association_worker
      libertas: clean up 802.11 IE post-scan handling
      libertas: rename private ioctl constants and clean up ioctl handling
      libertas: remove if_bootcmd.c
      libertas: fix mixed-case abuse in cmd_ds_802_11_scan
      libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_result
      libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_start
      libertas: re-uppercase command defines and other constants
      libertas: fix debug build breakage due to field rename
      libertas: remove thread.h and make kthread usage clearer
      libertas: new mesh control knobs
      libertas: bump version to 322.p1
      libertas: wlan_ -> libertas_ rename in ioctl.c
      libertas: fix more mixed-case abuse
      libertas: move generic firmware reset command to common code
      libertas: wlan_ -> libertas_ function prefix renames for main.c
      libertas: simplify and clean up data rate handling
      libertas: fix MESH_[GET/SET]_BCASTR ioctl, clean up ioctl subcmd handling
      libertas: actually send mesh frames to mesh netdev

Luis Carlos Cobo (1):
      libertas: specific mesh scan for mshX interface

Luis Carlos Cobo Rus (2):
      libertas: pull current channel from firmware on mesh autostart
      libertas: deauthenticate from AP in channel switch

 drivers/net/wireless/libertas/11d.c        |   22 +-
 drivers/net/wireless/libertas/Makefile     |    1 -
 drivers/net/wireless/libertas/README       |   65 ++++
 drivers/net/wireless/libertas/assoc.c      |   98 ++++---
 drivers/net/wireless/libertas/assoc.h      |    2 +
 drivers/net/wireless/libertas/cmd.c        |  338 ++++++++++----------
 drivers/net/wireless/libertas/cmdresp.c    |  173 +++++-----
 drivers/net/wireless/libertas/debugfs.c    |  130 ++++----
 drivers/net/wireless/libertas/decl.h       |    6 +-
 drivers/net/wireless/libertas/defs.h       |   66 ++---
 drivers/net/wireless/libertas/dev.h        |   35 +--
 drivers/net/wireless/libertas/ethtool.c    |    8 +-
 drivers/net/wireless/libertas/fw.c         |   43 ++--
 drivers/net/wireless/libertas/host.h       |  438 +++++++++++++-------------
 drivers/net/wireless/libertas/hostcmd.h    |   69 ++---
 drivers/net/wireless/libertas/if_bootcmd.c |   40 ---
 drivers/net/wireless/libertas/if_usb.c     |   58 ++--
 drivers/net/wireless/libertas/if_usb.h     |    1 -
 drivers/net/wireless/libertas/ioctl.c      |  478 +++++++++++++++-------------
 drivers/net/wireless/libertas/join.c       |  374 +++++++++++-----------
 drivers/net/wireless/libertas/join.h       |    2 +
 drivers/net/wireless/libertas/main.c       |  232 ++++++++------
 drivers/net/wireless/libertas/rx.c         |   14 +-
 drivers/net/wireless/libertas/scan.c       |  355 ++++++++-------------
 drivers/net/wireless/libertas/scan.h       |   10 +-
 drivers/net/wireless/libertas/thread.h     |   52 ---
 drivers/net/wireless/libertas/tx.c         |    2 +-
 drivers/net/wireless/libertas/types.h      |   65 +----
 drivers/net/wireless/libertas/version.h    |    1 -
 drivers/net/wireless/libertas/wext.c       |  428 ++++++++------------------
 drivers/net/wireless/libertas/wext.h       |   68 +++--
 33 files changed, 1731 insertions(+), 1975 deletions(-)
 delete mode 100644 drivers/net/wireless/libertas/if_bootcmd.c
 delete mode 100644 drivers/net/wireless/libertas/thread.h
 delete mode 100644 drivers/net/wireless/libertas/version.h



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-06  3:55 Please pull libertas-2.6 Dan Williams
@ 2007-06-09 13:41 ` Dan Williams
  2007-06-11 20:12   ` John W. Linville
  0 siblings, 1 reply; 13+ messages in thread
From: Dan Williams @ 2007-06-09 13:41 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

On Tue, 2007-06-05 at 23:55 -0400, Dan Williams wrote:
> Hi,
> 
> Changes since you last pulled are mainly Christoph-inspired cleanups, a
> few bug fixes, mesh scanning, and a few more mesh-specific knobs (though
> most likely general to 802.11s implementations, not just the CozyBit
> one).
> 
> Per the email thread with jgarzik from the last pull, everything from
> libertas-2.6 'master' branch is currently targeted at _2.6.22_.

Any comments here John?

Thanks,
Dan

> Thanks,
> Dan
> 
> ---
> 
> The following changes since commit fce1142de24730373ab0f922896f81e225e132d7:
>   John W. Linville (1):
>         Merge branch 'libertas'
> 
> are found in the git repository at:
> 
>   git://git.infradead.org/libertas-2.6
> 
> Dan Williams (24):
>       libertas: actually remove version.h
>       libertas: kill wlan_scan_process_results
>       libertas: kill ieeetypes_capinfo bitfield, use ieee80211.h types
>       libertas: rename WLAN_802_11_KEY to enc_key and clean up usage
>       libertas: clean up indentation in libertas_association_worker
>       libertas: clean up 802.11 IE post-scan handling
>       libertas: rename private ioctl constants and clean up ioctl handling
>       libertas: remove if_bootcmd.c
>       libertas: fix mixed-case abuse in cmd_ds_802_11_scan
>       libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_result
>       libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_start
>       libertas: re-uppercase command defines and other constants
>       libertas: fix debug build breakage due to field rename
>       libertas: remove thread.h and make kthread usage clearer
>       libertas: new mesh control knobs
>       libertas: bump version to 322.p1
>       libertas: wlan_ -> libertas_ rename in ioctl.c
>       libertas: fix more mixed-case abuse
>       libertas: move generic firmware reset command to common code
>       libertas: wlan_ -> libertas_ function prefix renames for main.c
>       libertas: simplify and clean up data rate handling
>       libertas: fix MESH_[GET/SET]_BCASTR ioctl, clean up ioctl subcmd handling
>       libertas: actually send mesh frames to mesh netdev
> 
> Luis Carlos Cobo (1):
>       libertas: specific mesh scan for mshX interface
> 
> Luis Carlos Cobo Rus (2):
>       libertas: pull current channel from firmware on mesh autostart
>       libertas: deauthenticate from AP in channel switch
> 
>  drivers/net/wireless/libertas/11d.c        |   22 +-
>  drivers/net/wireless/libertas/Makefile     |    1 -
>  drivers/net/wireless/libertas/README       |   65 ++++
>  drivers/net/wireless/libertas/assoc.c      |   98 ++++---
>  drivers/net/wireless/libertas/assoc.h      |    2 +
>  drivers/net/wireless/libertas/cmd.c        |  338 ++++++++++----------
>  drivers/net/wireless/libertas/cmdresp.c    |  173 +++++-----
>  drivers/net/wireless/libertas/debugfs.c    |  130 ++++----
>  drivers/net/wireless/libertas/decl.h       |    6 +-
>  drivers/net/wireless/libertas/defs.h       |   66 ++---
>  drivers/net/wireless/libertas/dev.h        |   35 +--
>  drivers/net/wireless/libertas/ethtool.c    |    8 +-
>  drivers/net/wireless/libertas/fw.c         |   43 ++--
>  drivers/net/wireless/libertas/host.h       |  438 +++++++++++++-------------
>  drivers/net/wireless/libertas/hostcmd.h    |   69 ++---
>  drivers/net/wireless/libertas/if_bootcmd.c |   40 ---
>  drivers/net/wireless/libertas/if_usb.c     |   58 ++--
>  drivers/net/wireless/libertas/if_usb.h     |    1 -
>  drivers/net/wireless/libertas/ioctl.c      |  478 +++++++++++++++-------------
>  drivers/net/wireless/libertas/join.c       |  374 +++++++++++-----------
>  drivers/net/wireless/libertas/join.h       |    2 +
>  drivers/net/wireless/libertas/main.c       |  232 ++++++++------
>  drivers/net/wireless/libertas/rx.c         |   14 +-
>  drivers/net/wireless/libertas/scan.c       |  355 ++++++++-------------
>  drivers/net/wireless/libertas/scan.h       |   10 +-
>  drivers/net/wireless/libertas/thread.h     |   52 ---
>  drivers/net/wireless/libertas/tx.c         |    2 +-
>  drivers/net/wireless/libertas/types.h      |   65 +----
>  drivers/net/wireless/libertas/version.h    |    1 -
>  drivers/net/wireless/libertas/wext.c       |  428 ++++++++------------------
>  drivers/net/wireless/libertas/wext.h       |   68 +++--
>  33 files changed, 1731 insertions(+), 1975 deletions(-)
>  delete mode 100644 drivers/net/wireless/libertas/if_bootcmd.c
>  delete mode 100644 drivers/net/wireless/libertas/thread.h
>  delete mode 100644 drivers/net/wireless/libertas/version.h
> 
> 
> -
> 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


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-09 13:41 ` Dan Williams
@ 2007-06-11 20:12   ` John W. Linville
  2007-06-11 21:31     ` Dan Williams
  0 siblings, 1 reply; 13+ messages in thread
From: John W. Linville @ 2007-06-11 20:12 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless

On Sat, Jun 09, 2007 at 09:41:35AM -0400, Dan Williams wrote:
> On Tue, 2007-06-05 at 23:55 -0400, Dan Williams wrote:
> > Hi,
> > 
> > Changes since you last pulled are mainly Christoph-inspired cleanups, a
> > few bug fixes, mesh scanning, and a few more mesh-specific knobs (though
> > most likely general to 802.11s implementations, not just the CozyBit
> > one).
> > 
> > Per the email thread with jgarzik from the last pull, everything from
> > libertas-2.6 'master' branch is currently targeted at _2.6.22_.
> 
> Any comments here John?

Sorry, last week was rather busy...

> > Dan Williams (24):
> >       libertas: actually remove version.h
> >       libertas: kill wlan_scan_process_results
> >       libertas: kill ieeetypes_capinfo bitfield, use ieee80211.h types
> >       libertas: rename WLAN_802_11_KEY to enc_key and clean up usage
> >       libertas: clean up indentation in libertas_association_worker
> >       libertas: clean up 802.11 IE post-scan handling
> >       libertas: rename private ioctl constants and clean up ioctl handling
> >       libertas: remove if_bootcmd.c
> >       libertas: fix mixed-case abuse in cmd_ds_802_11_scan
> >       libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_result
> >       libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_start
> >       libertas: re-uppercase command defines and other constants
> >       libertas: fix debug build breakage due to field rename
> >       libertas: remove thread.h and make kthread usage clearer
> >       libertas: new mesh control knobs
> >       libertas: bump version to 322.p1
> >       libertas: wlan_ -> libertas_ rename in ioctl.c
> >       libertas: fix more mixed-case abuse
> >       libertas: move generic firmware reset command to common code
> >       libertas: wlan_ -> libertas_ function prefix renames for main.c
> >       libertas: simplify and clean up data rate handling
> >       libertas: fix MESH_[GET/SET]_BCASTR ioctl, clean up ioctl subcmd handling
> >       libertas: actually send mesh frames to mesh netdev
> > 
> > Luis Carlos Cobo (1):
> >       libertas: specific mesh scan for mshX interface
> > 
> > Luis Carlos Cobo Rus (2):
> >       libertas: pull current channel from firmware on mesh autostart
> >       libertas: deauthenticate from AP in channel switch

Jeff had expressed a willingness to accept the previous batch
of libertas patches and pass them to Linus for 2.6.22.  However,
judging by the titles above this patch looks more like clean-ups and
new development.  Any objection to this batch being targeted at 2.6.23?

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-11 20:12   ` John W. Linville
@ 2007-06-11 21:31     ` Dan Williams
  2007-06-11 22:13       ` John W. Linville
  2007-06-12  6:43       ` Holger Schurig
  0 siblings, 2 replies; 13+ messages in thread
From: Dan Williams @ 2007-06-11 21:31 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

On Mon, 2007-06-11 at 16:12 -0400, John W. Linville wrote:
> On Sat, Jun 09, 2007 at 09:41:35AM -0400, Dan Williams wrote:
> > On Tue, 2007-06-05 at 23:55 -0400, Dan Williams wrote:
> > > Hi,
> > > 
> > > Changes since you last pulled are mainly Christoph-inspired cleanups, a
> > > few bug fixes, mesh scanning, and a few more mesh-specific knobs (though
> > > most likely general to 802.11s implementations, not just the CozyBit
> > > one).
> > > 
> > > Per the email thread with jgarzik from the last pull, everything from
> > > libertas-2.6 'master' branch is currently targeted at _2.6.22_.
> > 
> > Any comments here John?
> 
> Sorry, last week was rather busy...
> 
> > > Dan Williams (24):
> > >       libertas: actually remove version.h
> > >       libertas: kill wlan_scan_process_results
> > >       libertas: kill ieeetypes_capinfo bitfield, use ieee80211.h types
> > >       libertas: rename WLAN_802_11_KEY to enc_key and clean up usage
> > >       libertas: clean up indentation in libertas_association_worker
> > >       libertas: clean up 802.11 IE post-scan handling
> > >       libertas: rename private ioctl constants and clean up ioctl handling
> > >       libertas: remove if_bootcmd.c
> > >       libertas: fix mixed-case abuse in cmd_ds_802_11_scan
> > >       libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_result
> > >       libertas: fix mixed-case abuse in cmd_ds_802_11_ad_hoc_start
> > >       libertas: re-uppercase command defines and other constants
> > >       libertas: fix debug build breakage due to field rename
> > >       libertas: remove thread.h and make kthread usage clearer
> > >       libertas: new mesh control knobs
> > >       libertas: bump version to 322.p1
> > >       libertas: wlan_ -> libertas_ rename in ioctl.c
> > >       libertas: fix more mixed-case abuse
> > >       libertas: move generic firmware reset command to common code
> > >       libertas: wlan_ -> libertas_ function prefix renames for main.c
> > >       libertas: simplify and clean up data rate handling
> > >       libertas: fix MESH_[GET/SET]_BCASTR ioctl, clean up ioctl subcmd handling
> > >       libertas: actually send mesh frames to mesh netdev
> > > 
> > > Luis Carlos Cobo (1):
> > >       libertas: specific mesh scan for mshX interface
> > > 
> > > Luis Carlos Cobo Rus (2):
> > >       libertas: pull current channel from firmware on mesh autostart
> > >       libertas: deauthenticate from AP in channel switch
> 
> Jeff had expressed a willingness to accept the previous batch
> of libertas patches and pass them to Linus for 2.6.22.  However,
> judging by the titles above this patch looks more like clean-ups and
> new development.  Any objection to this batch being targeted at 2.6.23?

Some are pretty important (the 3 from Luis and the bottom 2 from me, and
the "anycast mask" patch from HEAD, for example).  I guess if Jeff
wouldn't mind accepting this set, I'd prefer to push them all for 2.6.22
and be be done with 2.6.22 except for bugfixes.  Otherwise I can give
you a list of commit IDs to cherry-pick or something like that.

Dan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-11 21:31     ` Dan Williams
@ 2007-06-11 22:13       ` John W. Linville
  2007-06-12  3:54         ` Dan Williams
  2007-06-12  6:43       ` Holger Schurig
  1 sibling, 1 reply; 13+ messages in thread
From: John W. Linville @ 2007-06-11 22:13 UTC (permalink / raw)
  To: Dan Williams; +Cc: linux-wireless

On Mon, Jun 11, 2007 at 05:31:51PM -0400, Dan Williams wrote:
> On Mon, 2007-06-11 at 16:12 -0400, John W. Linville wrote:

> > Jeff had expressed a willingness to accept the previous batch
> > of libertas patches and pass them to Linus for 2.6.22.  However,
> > judging by the titles above this patch looks more like clean-ups and
> > new development.  Any objection to this batch being targeted at 2.6.23?
> 
> Some are pretty important (the 3 from Luis and the bottom 2 from me, and
> the "anycast mask" patch from HEAD, for example).  I guess if Jeff
> wouldn't mind accepting this set, I'd prefer to push them all for 2.6.22
> and be be done with 2.6.22 except for bugfixes.  Otherwise I can give
> you a list of commit IDs to cherry-pick or something like that.

Best if you sent me a cherry-pick list, I think...

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-11 22:13       ` John W. Linville
@ 2007-06-12  3:54         ` Dan Williams
  0 siblings, 0 replies; 13+ messages in thread
From: Dan Williams @ 2007-06-12  3:54 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

[-- Attachment #1: Type: text/plain, Size: 1603 bytes --]

On Mon, 2007-06-11 at 18:13 -0400, John W. Linville wrote:
> On Mon, Jun 11, 2007 at 05:31:51PM -0400, Dan Williams wrote:
> > On Mon, 2007-06-11 at 16:12 -0400, John W. Linville wrote:
> 
> > > Jeff had expressed a willingness to accept the previous batch
> > > of libertas patches and pass them to Linus for 2.6.22.  However,
> > > judging by the titles above this patch looks more like clean-ups and
> > > new development.  Any objection to this batch being targeted at 2.6.23?
> > 
> > Some are pretty important (the 3 from Luis and the bottom 2 from me, and
> > the "anycast mask" patch from HEAD, for example).  I guess if Jeff
> > wouldn't mind accepting this set, I'd prefer to push them all for 2.6.22
> > and be be done with 2.6.22 except for bugfixes.  Otherwise I can give
> > you a list of commit IDs to cherry-pick or something like that.
> 
> Best if you sent me a cherry-pick list, I think...

6274aed3227aacb9527f394b8245381adafc1a04
bddb59e23e65a4cb11cfde88fee43d509b96b727
524ce9039aeb3dbe0a39badc3ae8218c81b5ab95
7ed8aab030afad1eda3ea7c844ecddd3ed528b2d

The last one will probably take a small bit of touch-up, but the top 3
apply as-is to the 'libertas' branch of wireless-2.6.  The last one just
needs some fixup to deal with my upper-casing of the mesh commands
before this commit, which wireless-2.6 doesn't have.  I attached my
cleanup of the last commit as a patch; I'm not entirely sure how git
will treat it when you cherry-pick it, but you can use the attached as a
quick guide if you like.  Ping me on devserv tomorrow or something if
you have any problems.

Thanks!
Dan


[-- Attachment #2: commit-d6a9720 --]
[-- Type: text/plain, Size: 3473 bytes --]

commit d6a97206e38af6f987bf9318f8511c6ae7bda9af
Author: Dan Williams <dcbw@redhat.com>
Date:   Mon Jun 11 23:38:23 2007 -0400

    Merge 7ed8aab030afad1eda3ea7c844ecddd3ed528b2d

diff --git a/drivers/net/wireless/libertas/host.h b/drivers/net/wireless/libertas/host.h
index cedf1db..7509cc1 100644
--- a/drivers/net/wireless/libertas/host.h
+++ b/drivers/net/wireless/libertas/host.h
@@ -310,8 +310,8 @@ enum cmd_mesh_access_opts {
 	cmd_act_mesh_get_ttl = 1,
 	cmd_act_mesh_set_ttl,
 	cmd_act_mesh_get_stats,
-	cmd_act_mesh_get_mpp,
-	cmd_act_mesh_set_mpp,
+	cmd_act_mesh_get_anycast,
+	cmd_act_mesh_set_anycast,
 };
 
 /** Card Event definition */
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 20ac7e1..623ab4b 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -178,45 +178,45 @@ u16 libertas_region_code_to_index[MRVDRV_MAX_REGION_CODE] =
  */
 
 /**
- * @brief Get function for sysfs attribute libertas_mpp
+ * @brief Get function for sysfs attribute anycast_mask
  */
-static ssize_t libertas_mpp_get(struct device * dev,
+static ssize_t libertas_anycast_get(struct device * dev,
 		struct device_attribute *attr, char * buf) {
 	struct cmd_ds_mesh_access mesh_access;
 
 	memset(&mesh_access, 0, sizeof(mesh_access));
 	libertas_prepare_and_send_command(to_net_dev(dev)->priv,
 			cmd_mesh_access,
-			cmd_act_mesh_get_mpp,
+			cmd_act_mesh_get_anycast,
 			cmd_option_waitforrsp, 0, (void *)&mesh_access);
 
-	return snprintf(buf, 3, "%d\n", le32_to_cpu(mesh_access.data[0]));
+	return snprintf(buf, 12, "0x%X\n", le32_to_cpu(mesh_access.data[0]));
 }
 
 /**
- * @brief Set function for sysfs attribute libertas_mpp
+ * @brief Set function for sysfs attribute anycast_mask
  */
-static ssize_t libertas_mpp_set(struct device * dev,
+static ssize_t libertas_anycast_set(struct device * dev,
 		struct device_attribute *attr, const char * buf, size_t count) {
 	struct cmd_ds_mesh_access mesh_access;
 	uint32_t datum;
 
 	memset(&mesh_access, 0, sizeof(mesh_access));
-	sscanf(buf, "%d", &datum);
+	sscanf(buf, "%x", &datum);
 	mesh_access.data[0] = cpu_to_le32(datum);
 
 	libertas_prepare_and_send_command((to_net_dev(dev))->priv,
 			cmd_mesh_access,
-			cmd_act_mesh_set_mpp,
+			cmd_act_mesh_set_anycast,
 			cmd_option_waitforrsp, 0, (void *)&mesh_access);
 	return strlen(buf);
 }
 
 /**
- * libertas_mpp attribute to be exported per mshX interface
- * through sysfs (/sys/class/net/mshX/libertas-mpp)
+ * anycast_mask attribute to be exported per mshX interface
+ * through sysfs (/sys/class/net/mshX/anycast_mask)
  */
-static DEVICE_ATTR(libertas_mpp, 0644, libertas_mpp_get, libertas_mpp_set );
+static DEVICE_ATTR(anycast_mask, 0644, libertas_anycast_get, libertas_anycast_set);
 
 /**
  *  @brief Check if the device can be open and wait if necessary.
@@ -939,7 +939,7 @@ int libertas_add_mesh(wlan_private *priv, struct device *dev)
 		goto err_free;
 	}
 
-	ret = device_create_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
+	ret = device_create_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
 	if (ret)
 		goto err_unregister;
 
@@ -1049,7 +1049,7 @@ void libertas_remove_mesh(wlan_private *priv)
 	netif_stop_queue(mesh_dev);
 	netif_carrier_off(priv->mesh_dev);
 
-	device_remove_file(&(mesh_dev->dev), &dev_attr_libertas_mpp);
+	device_remove_file(&(mesh_dev->dev), &dev_attr_anycast_mask);
 	unregister_netdev(mesh_dev);
 
 	priv->mesh_dev = NULL ;

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-11 21:31     ` Dan Williams
  2007-06-11 22:13       ` John W. Linville
@ 2007-06-12  6:43       ` Holger Schurig
  2007-06-12 11:59         ` Dan Williams
  1 sibling, 1 reply; 13+ messages in thread
From: Holger Schurig @ 2007-06-12  6:43 UTC (permalink / raw)
  To: linux-wireless, Dan Williams

> for bugfixes.  Otherwise I can give you a list of commit IDs
> to cherry-pick or something like that.

If we're going to cherry-pick, maybe you can look (and possible
integrate) my get-rid-of-fw.c-patch that is necessary for
Compact-Flash (and possibly SDIO based) 83xx cards?



>From 605d5440d0a2ff442d0506aa15d4d9f8ebe8e630 Mon Sep 17 00:00:00 2001
From: Holger Schurig <schurig@schurig.homelinux.net>
Date: Tue, 5 Jun 2007 22:37:04 +0200
Subject: [PATCH] [libertas] change firmware downlaod logic

Firmware download is quite different for different hardware. The
SDIO and CF cards have two flat files that need to be downloaded,
whereas the USB driver needs only one file, but with an internal
structure.

This patch moves the firmware downloading code from fw.c into if_usb.c. The
other code that used to be in fw.c has been moved to main.c.

Signed-off-by: Holger Schurig <h4233@mail.mn-solutions.de>

---
 drivers/net/wireless/libertas/Makefile |    2 +-
 drivers/net/wireless/libertas/decl.h   |    5 +-
 drivers/net/wireless/libertas/fw.c     |  346 --------------------------------
 drivers/net/wireless/libertas/if_usb.c |   78 +++++++-
 drivers/net/wireless/libertas/main.c   |  278 +++++++++++++++++++++++++-
 5 files changed, 354 insertions(+), 355 deletions(-)
 delete mode 100644 drivers/net/wireless/libertas/fw.c

diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile
index fdda0f0..4d120c3 100644
--- a/drivers/net/wireless/libertas/Makefile
+++ b/drivers/net/wireless/libertas/Makefile
@@ -1,4 +1,4 @@
-libertas-objs := main.o fw.o wext.o \
+libertas-objs := main.o wext.o \
 		rx.o tx.o cmd.o 	  \
 		cmdresp.o scan.o	  \
 		join.o 11d.o 		  \
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 129b021..113cfc1 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -75,14 +75,11 @@ void libertas_mac_event_disconnected(wlan_private * priv);
 
 void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
 
-/* fw.c */
-int libertas_init_fw(wlan_private * priv, char *fw_name);
-
 /* main.c */
 struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
 						             int *cfp_no);
 wlan_private *libertas_add_card(void *card, struct device *dmdev);
-int libertas_activate_card(wlan_private *priv, char *fw_name);
+int libertas_activate_card(wlan_private *priv);
 int libertas_remove_card(wlan_private *priv);
 int libertas_add_mesh(wlan_private *priv, struct device *dev);
 void libertas_remove_mesh(wlan_private *priv);
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
deleted file mode 100644
index 6c25987..0000000
--- a/drivers/net/wireless/libertas/fw.c
+++ /dev/null
@@ -1,346 +0,0 @@
-/**
-  * This file contains the initialization for FW and HW
-  */
-#include <linux/firmware.h>
-
-#include "host.h"
-#include "defs.h"
-#include "decl.h"
-#include "dev.h"
-#include "wext.h"
-#include "if_usb.h"
-
-/**
- *  @brief This function checks the validity of Boot2/FW image.
- *
- *  @param data              pointer to image
- *         len               image length
- *  @return     0 or -1
- */
-static int check_fwfile_format(u8 *data, u32 totlen)
-{
-	u32 bincmd, exit;
-	u32 blksize, offset, len;
-	int ret;
-
-	ret = 1;
-	exit = len = 0;
-
-	do {
-		struct fwheader *fwh = (void *)data;
-
-		bincmd = le32_to_cpu(fwh->dnldcmd);
-		blksize = le32_to_cpu(fwh->datalength);
-		switch (bincmd) {
-		case FW_HAS_DATA_TO_RECV:
-			offset = sizeof(struct fwheader) + blksize;
-			data += offset;
-			len += offset;
-			if (len >= totlen)
-				exit = 1;
-			break;
-		case FW_HAS_LAST_BLOCK:
-			exit = 1;
-			ret = 0;
-			break;
-		default:
-			exit = 1;
-			break;
-		}
-	} while (!exit);
-
-	if (ret)
-		lbs_pr_err("firmware file format check FAIL\n");
-	else
-		lbs_deb_fw("firmware file format check PASS\n");
-
-	return ret;
-}
-
-/**
- *  @brief This function downloads firmware image, gets
- *  HW spec from firmware and set basic parameters to
- *  firmware.
- *
- *  @param priv    A pointer to wlan_private structure
- *  @return 	   0 or -1
- */
-static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
-{
-	int ret = -1;
-	wlan_adapter *adapter = priv->adapter;
-
-	lbs_deb_enter(LBS_DEB_FW);
-
-	if ((ret = request_firmware(&priv->firmware, fw_name,
-				    priv->hotplug_device)) < 0) {
-		lbs_pr_err("request_firmware() failed with %#x\n", ret);
-		lbs_pr_err("firmware %s not found\n", fw_name);
-		goto done;
-	}
-
-	if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
-		release_firmware(priv->firmware);
-		goto done;
-	}
-
-	ret = priv->hw_prog_firmware(priv);
-
-	release_firmware(priv->firmware);
-
-	if (ret) {
-		lbs_deb_fw("bootloader in invalid state\n");
-		ret = -1;
-		goto done;
-	}
-
-	/*
-	 * Read MAC address from HW
-	 */
-	memset(adapter->current_addr, 0xff, ETH_ALEN);
-
-	ret = libertas_prepare_and_send_command(priv, CMD_GET_HW_SPEC,
-				    0, CMD_OPTION_WAITFORRSP, 0, NULL);
-
-	if (ret) {
-		ret = -1;
-		goto done;
-	}
-
-	libertas_set_mac_packet_filter(priv);
-
-	/* Get the supported Data rates */
-	ret = libertas_prepare_and_send_command(priv, CMD_802_11_DATA_RATE,
-				    CMD_ACT_GET_TX_RATE,
-				    CMD_OPTION_WAITFORRSP, 0, NULL);
-
-	if (ret) {
-		ret = -1;
-		goto done;
-	}
-
-	ret = 0;
-done:
-	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
-	return ret;
-}
-
-static int wlan_allocate_adapter(wlan_private * priv)
-{
-	size_t bufsize;
-	wlan_adapter *adapter = priv->adapter;
-
-	/* Allocate buffer to store the BSSID list */
-	bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
-	adapter->networks = kzalloc(bufsize, GFP_KERNEL);
-	if (!adapter->networks) {
-		lbs_pr_err("Out of memory allocating beacons\n");
-		libertas_free_adapter(priv);
-		return -ENOMEM;
-	}
-
-	/* Allocate the command buffers */
-	libertas_allocate_cmd_buffer(priv);
-
-	memset(&adapter->libertas_ps_confirm_sleep, 0, sizeof(struct PS_CMD_ConfirmSleep));
-	adapter->libertas_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum);
-	adapter->libertas_ps_confirm_sleep.command =
-	    cpu_to_le16(CMD_802_11_PS_MODE);
-	adapter->libertas_ps_confirm_sleep.size =
-	    cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep));
-	adapter->libertas_ps_confirm_sleep.result = 0;
-	adapter->libertas_ps_confirm_sleep.action =
-	    cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
-
-	return 0;
-}
-
-static void wlan_init_adapter(wlan_private * priv)
-{
-	wlan_adapter *adapter = priv->adapter;
-	int i;
-
-	adapter->scanprobes = 0;
-
-	adapter->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
-	adapter->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
-
-	/* ATIM params */
-	adapter->atimwindow = 0;
-
-	adapter->connect_status = LIBERTAS_DISCONNECTED;
-	memset(adapter->current_addr, 0xff, ETH_ALEN);
-
-	/* scan type */
-	adapter->scantype = CMD_SCAN_TYPE_ACTIVE;
-
-	/* scan mode */
-	adapter->scanmode = CMD_BSS_TYPE_ANY;
-
-	/* 802.11 specific */
-	adapter->secinfo.wep_enabled = 0;
-	for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]);
-	     i++)
-		memset(&adapter->wep_keys[i], 0, sizeof(struct enc_key));
-	adapter->wep_tx_keyidx = 0;
-	adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
-	adapter->mode = IW_MODE_INFRA;
-
-	adapter->pending_assoc_req = NULL;
-	adapter->in_progress_assoc_req = NULL;
-
-	/* Initialize scan result lists */
-	INIT_LIST_HEAD(&adapter->network_free_list);
-	INIT_LIST_HEAD(&adapter->network_list);
-	for (i = 0; i < MAX_NETWORK_COUNT; i++) {
-		list_add_tail(&adapter->networks[i].list,
-			      &adapter->network_free_list);
-	}
-
-	mutex_init(&adapter->lock);
-
-	adapter->prescan = 1;
-
-	memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
-	adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
-
-	/* PnP and power profile */
-	adapter->surpriseremoved = 0;
-
-	adapter->currentpacketfilter =
-	    CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
-
-	adapter->radioon = RADIO_ON;
-	adapter->txantenna = RF_ANTENNA_2;
-	adapter->rxantenna = RF_ANTENNA_AUTO;
-
-	adapter->auto_rate = 1;
-	adapter->cur_rate = 0;
-	adapter->adhoc_grate_enabled = 0;
-
-	adapter->beaconperiod = MRVDRV_BEACON_INTERVAL;
-
-	// set default capabilities
-	adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
-
-	adapter->psmode = WLAN802_11POWERMODECAM;
-	adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
-
-	adapter->listeninterval = MRVDRV_DEFAULT_LISTEN_INTERVAL;
-
-	adapter->psstate = PS_STATE_FULL_POWER;
-	adapter->needtowakeup = 0;
-	adapter->locallisteninterval = 0;	/* default value in firmware will be used */
-
-	adapter->intcounter = 0;
-
-	adapter->currenttxskb = NULL;
-	adapter->pkttxctrl = 0;
-
-	memset(&adapter->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*));
-	adapter->tx_queue_idx = 0;
-	spin_lock_init(&adapter->txqueue_lock);
-
-	return;
-}
-
-static void command_timer_fn(unsigned long data);
-
-int libertas_init_fw(wlan_private * priv, char *fw_name)
-{
-	int ret = -1;
-	wlan_adapter *adapter = priv->adapter;
-
-	lbs_deb_enter(LBS_DEB_FW);
-
-	/* Allocate adapter structure */
-	if ((ret = wlan_allocate_adapter(priv)) != 0)
-		goto done;
-
-	/* init adapter structure */
-	wlan_init_adapter(priv);
-
-	/* init timer etc. */
-	setup_timer(&adapter->command_timer, command_timer_fn,
-			(unsigned long)priv);
-
-	/* download fimrware etc. */
-	if ((ret = wlan_setup_station_hw(priv, fw_name)) != 0) {
-		del_timer_sync(&adapter->command_timer);
-		goto done;
-	}
-
-	/* init 802.11d */
-	libertas_init_11d(priv);
-
-	ret = 0;
-done:
-	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
-	return ret;
-}
-
-void libertas_free_adapter(wlan_private * priv)
-{
-	wlan_adapter *adapter = priv->adapter;
-
-	if (!adapter) {
-		lbs_deb_fw("why double free adapter?\n");
-		return;
-	}
-
-	lbs_deb_fw("free command buffer\n");
-	libertas_free_cmd_buffer(priv);
-
-	lbs_deb_fw("free command_timer\n");
-	del_timer(&adapter->command_timer);
-
-	lbs_deb_fw("free scan results table\n");
-	kfree(adapter->networks);
-	adapter->networks = NULL;
-
-	/* Free the adapter object itself */
-	lbs_deb_fw("free adapter\n");
-	kfree(adapter);
-	priv->adapter = NULL;
-}
-
-/**
- *  This function handles the timeout of command sending.
- *  It will re-send the same command again.
- */
-static void command_timer_fn(unsigned long data)
-{
-	wlan_private *priv = (wlan_private *)data;
-	wlan_adapter *adapter = priv->adapter;
-	struct cmd_ctrl_node *ptempnode;
-	struct cmd_ds_command *cmd;
-	unsigned long flags;
-
-	ptempnode = adapter->cur_cmd;
-	if (ptempnode == NULL) {
-		lbs_deb_fw("ptempnode empty\n");
-		return;
-	}
-
-	cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
-	if (!cmd) {
-		lbs_deb_fw("cmd is NULL\n");
-		return;
-	}
-
-	lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
-
-	if (!adapter->fw_ready)
-		return;
-
-	spin_lock_irqsave(&adapter->driver_lock, flags);
-	adapter->cur_cmd = NULL;
-	spin_unlock_irqrestore(&adapter->driver_lock, flags);
-
-	lbs_deb_fw("re-sending same command because of timeout\n");
-	libertas_queue_cmd(adapter, ptempnode, 0);
-
-	wake_up_interruptible(&priv->waitq);
-
-	return;
-}
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index e38fce7..ac1cfc2 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -216,7 +216,7 @@ static int if_usb_probe(struct usb_interface *intf,
 	priv->hw_get_int_status = if_usb_get_int_status;
 	priv->hw_read_event_cause = if_usb_read_event_cause;
 
-	if (libertas_activate_card(priv, libertas_fw_name))
+	if (libertas_activate_card(priv))
 		goto err_activate_card;
 
 	list_add_tail(&cardp->list, &usb_devices);
@@ -819,7 +819,7 @@ static int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
 }
 
 
-static int if_usb_prog_firmware(wlan_private * priv)
+static int if_usb_do_prog_firmware(wlan_private * priv)
 {
 	struct usb_card_rec *cardp = priv->card;
 	int i = 0;
@@ -903,6 +903,80 @@ done:
 	return ret;
 }
 
+/**
+ *  @brief This function checks the validity of Boot2/FW image.
+ *
+ *  @param data              pointer to image
+ *         len               image length
+ *  @return     0 or -1
+ */
+static int check_fwfile_format(u8 *data, u32 totlen)
+{
+	u32 bincmd, exit;
+	u32 blksize, offset, len;
+	int ret;
+
+	ret = 1;
+	exit = len = 0;
+
+	do {
+		struct fwheader *fwh = (void *)data;
+
+		bincmd = le32_to_cpu(fwh->dnldcmd);
+		blksize = le32_to_cpu(fwh->datalength);
+		switch (bincmd) {
+		case FW_HAS_DATA_TO_RECV:
+			offset = sizeof(struct fwheader) + blksize;
+			data += offset;
+			len += offset;
+			if (len >= totlen)
+				exit = 1;
+			break;
+		case FW_HAS_LAST_BLOCK:
+			exit = 1;
+			ret = 0;
+			break;
+		default:
+			exit = 1;
+			break;
+		}
+	} while (!exit);
+
+	if (ret)
+		lbs_pr_err("firmware file format check FAIL\n");
+	else
+		lbs_deb_fw("firmware file format check PASS\n");
+
+	return ret;
+}
+
+
+static int if_usb_prog_firmware(wlan_private *priv)
+{
+	int ret = -1;
+
+	lbs_deb_enter(LBS_DEB_FW);
+
+	if ((ret = request_firmware(&priv->firmware, libertas_fw_name,
+				    priv->hotplug_device)) < 0) {
+		lbs_pr_err("request_firmware() failed with %#x\n", ret);
+		lbs_pr_err("firmware %s not found\n", libertas_fw_name);
+		goto done;
+	}
+
+	if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
+		release_firmware(priv->firmware);
+		goto done;
+	}
+
+	ret = if_usb_do_prog_firmware(priv);
+
+	release_firmware(priv->firmware);
+done:
+	return ret;
+}
+
+
 #ifdef CONFIG_PM
 static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
 {
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 4760b01..3835979 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -792,6 +792,280 @@ static int libertas_thread(void *data)
 }
 
 /**
+ *  @brief This function downloads firmware image, gets
+ *  HW spec from firmware and set basic parameters to
+ *  firmware.
+ *
+ *  @param priv    A pointer to wlan_private structure
+ *  @return 	   0 or -1
+ */
+static int wlan_setup_station_hw(wlan_private * priv)
+{
+	int ret = -1;
+	wlan_adapter *adapter = priv->adapter;
+
+	lbs_deb_enter(LBS_DEB_FW);
+
+	ret = priv->hw_prog_firmware(priv);
+
+	if (ret) {
+		lbs_deb_fw("bootloader in invalid state\n");
+		ret = -1;
+		goto done;
+	}
+
+	/*
+	 * Read MAC address from HW
+	 */
+	memset(adapter->current_addr, 0xff, ETH_ALEN);
+
+	ret = libertas_prepare_and_send_command(priv, CMD_GET_HW_SPEC,
+				    0, CMD_OPTION_WAITFORRSP, 0, NULL);
+
+	if (ret) {
+		ret = -1;
+		goto done;
+	}
+
+	libertas_set_mac_packet_filter(priv);
+
+	/* Get the supported Data rates */
+	ret = libertas_prepare_and_send_command(priv, CMD_802_11_DATA_RATE,
+				    CMD_ACT_GET_TX_RATE,
+				    CMD_OPTION_WAITFORRSP, 0, NULL);
+
+	if (ret) {
+		ret = -1;
+		goto done;
+	}
+
+	ret = 0;
+done:
+	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
+	return ret;
+}
+
+static void command_timer_fn(unsigned long data);
+
+/**
+ *  This function handles the timeout of command sending.
+ *  It will re-send the same command again.
+ */
+static void command_timer_fn(unsigned long data)
+{
+	wlan_private *priv = (wlan_private *)data;
+	wlan_adapter *adapter = priv->adapter;
+	struct cmd_ctrl_node *ptempnode;
+	struct cmd_ds_command *cmd;
+	unsigned long flags;
+
+	ptempnode = adapter->cur_cmd;
+	if (ptempnode == NULL) {
+		lbs_deb_fw("ptempnode empty\n");
+		return;
+	}
+
+	cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
+	if (!cmd) {
+		lbs_deb_fw("cmd is NULL\n");
+		return;
+	}
+
+	lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
+
+	if (!adapter->fw_ready)
+		return;
+
+	spin_lock_irqsave(&adapter->driver_lock, flags);
+	adapter->cur_cmd = NULL;
+	spin_unlock_irqrestore(&adapter->driver_lock, flags);
+
+	lbs_deb_fw("re-sending same command because of timeout\n");
+	libertas_queue_cmd(adapter, ptempnode, 0);
+
+	wake_up_interruptible(&priv->waitq);
+
+	return;
+}
+
+static int wlan_allocate_adapter(wlan_private * priv)
+{
+	size_t bufsize;
+	wlan_adapter *adapter = priv->adapter;
+
+	/* Allocate buffer to store the BSSID list */
+	bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
+	adapter->networks = kzalloc(bufsize, GFP_KERNEL);
+	if (!adapter->networks) {
+		lbs_pr_err("Out of memory allocating beacons\n");
+		libertas_free_adapter(priv);
+		return -ENOMEM;
+	}
+
+	/* Allocate the command buffers */
+	libertas_allocate_cmd_buffer(priv);
+
+	memset(&adapter->libertas_ps_confirm_sleep, 0, sizeof(struct PS_CMD_ConfirmSleep));
+	adapter->libertas_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum);
+	adapter->libertas_ps_confirm_sleep.command =
+	    cpu_to_le16(CMD_802_11_PS_MODE);
+	adapter->libertas_ps_confirm_sleep.size =
+	    cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep));
+	adapter->libertas_ps_confirm_sleep.result = 0;
+	adapter->libertas_ps_confirm_sleep.action =
+	    cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
+
+	return 0;
+}
+
+static void wlan_init_adapter(wlan_private * priv)
+{
+	wlan_adapter *adapter = priv->adapter;
+	int i;
+
+	adapter->scanprobes = 0;
+
+	adapter->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
+	adapter->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
+
+	/* ATIM params */
+	adapter->atimwindow = 0;
+
+	adapter->connect_status = LIBERTAS_DISCONNECTED;
+	memset(adapter->current_addr, 0xff, ETH_ALEN);
+
+	/* scan type */
+	adapter->scantype = CMD_SCAN_TYPE_ACTIVE;
+
+	/* scan mode */
+	adapter->scanmode = CMD_BSS_TYPE_ANY;
+
+	/* 802.11 specific */
+	adapter->secinfo.wep_enabled = 0;
+	for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]);
+	     i++)
+		memset(&adapter->wep_keys[i], 0, sizeof(struct enc_key));
+	adapter->wep_tx_keyidx = 0;
+	adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
+	adapter->mode = IW_MODE_INFRA;
+
+	adapter->pending_assoc_req = NULL;
+	adapter->in_progress_assoc_req = NULL;
+
+	/* Initialize scan result lists */
+	INIT_LIST_HEAD(&adapter->network_free_list);
+	INIT_LIST_HEAD(&adapter->network_list);
+	for (i = 0; i < MAX_NETWORK_COUNT; i++) {
+		list_add_tail(&adapter->networks[i].list,
+			      &adapter->network_free_list);
+	}
+
+	mutex_init(&adapter->lock);
+
+	adapter->prescan = 1;
+
+	memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
+	adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
+
+	/* PnP and power profile */
+	adapter->surpriseremoved = 0;
+
+	adapter->currentpacketfilter =
+	    CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
+
+	adapter->radioon = RADIO_ON;
+	adapter->txantenna = RF_ANTENNA_2;
+	adapter->rxantenna = RF_ANTENNA_AUTO;
+
+	adapter->auto_rate = 1;
+	adapter->cur_rate = 0;
+	adapter->adhoc_grate_enabled = 0;
+
+	adapter->beaconperiod = MRVDRV_BEACON_INTERVAL;
+
+	// set default capabilities
+	adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
+
+	adapter->psmode = WLAN802_11POWERMODECAM;
+	adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
+
+	adapter->listeninterval = MRVDRV_DEFAULT_LISTEN_INTERVAL;
+
+	adapter->psstate = PS_STATE_FULL_POWER;
+	adapter->needtowakeup = 0;
+	adapter->locallisteninterval = 0;	/* default value in firmware will be used */
+
+	adapter->intcounter = 0;
+
+	adapter->currenttxskb = NULL;
+	adapter->pkttxctrl = 0;
+
+	memset(&adapter->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*));
+	adapter->tx_queue_idx = 0;
+	spin_lock_init(&adapter->txqueue_lock);
+
+	return;
+}
+
+void libertas_free_adapter(wlan_private * priv)
+{
+	wlan_adapter *adapter = priv->adapter;
+
+	if (!adapter) {
+		lbs_deb_fw("why double free adapter?\n");
+		return;
+	}
+
+	lbs_deb_fw("free command buffer\n");
+	libertas_free_cmd_buffer(priv);
+
+	lbs_deb_fw("free command_timer\n");
+	del_timer(&adapter->command_timer);
+
+	lbs_deb_fw("free scan results table\n");
+	kfree(adapter->networks);
+	adapter->networks = NULL;
+
+	/* Free the adapter object itself */
+	lbs_deb_fw("free adapter\n");
+	kfree(adapter);
+	priv->adapter = NULL;
+}
+
+int libertas_init_fw(wlan_private * priv)
+{
+	int ret = -1;
+	wlan_adapter *adapter = priv->adapter;
+
+	lbs_deb_enter(LBS_DEB_FW);
+
+	/* Allocate adapter structure */
+	if ((ret = wlan_allocate_adapter(priv)) != 0)
+		goto done;
+
+	/* init adapter structure */
+	wlan_init_adapter(priv);
+
+	/* init timer etc. */
+	setup_timer(&adapter->command_timer, command_timer_fn,
+			(unsigned long)priv);
+
+	/* download fimrware etc. */
+	if ((ret = wlan_setup_station_hw(priv)) != 0) {
+		del_timer_sync(&adapter->command_timer);
+		goto done;
+	}
+
+	/* init 802.11d */
+	libertas_init_11d(priv);
+
+	ret = 0;
+done:
+	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
+	return ret;
+}
+
+/**
  * @brief This function adds the card. it will probe the
  * card, allocate the wlan_priv and initialize the device.
  *
@@ -862,7 +1136,7 @@ done:
 }
 EXPORT_SYMBOL_GPL(libertas_add_card);
 
-int libertas_activate_card(wlan_private *priv, char *fw_name)
+int libertas_activate_card(wlan_private *priv)
 {
 	struct net_device *dev = priv->dev;
 	int ret = -1;
@@ -893,7 +1167,7 @@ int libertas_activate_card(wlan_private *priv, char *fw_name)
 	}
 
 	/* init FW and HW */
-	if (fw_name && libertas_init_fw(priv, fw_name)) {
+	if (libertas_init_fw(priv)) {
 		lbs_pr_err("firmware init failed\n");
 		goto err_registerdev;
 	}
-- 
1.5.2


_______________________________________________
libertas-dev mailing list
libertas-dev@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/libertas-dev




^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-12  6:43       ` Holger Schurig
@ 2007-06-12 11:59         ` Dan Williams
  2007-06-12 13:19           ` Holger Schurig
  0 siblings, 1 reply; 13+ messages in thread
From: Dan Williams @ 2007-06-12 11:59 UTC (permalink / raw)
  To: Holger Schurig; +Cc: linux-wireless

On Tue, 2007-06-12 at 08:43 +0200, Holger Schurig wrote:
> > for bugfixes.  Otherwise I can give you a list of commit IDs
> > to cherry-pick or something like that.
> 
> If we're going to cherry-pick, maybe you can look (and possible
> integrate) my get-rid-of-fw.c-patch that is necessary for
> Compact-Flash (and possibly SDIO based) 83xx cards?

Well; I'm going to commit that one really soon to libertas-2.6, but I
don't think it's 2.6.22 material mainly because there's no code for CF
cards in libertas-2.6 yet anyway...

Dan

> 
> 
> From 605d5440d0a2ff442d0506aa15d4d9f8ebe8e630 Mon Sep 17 00:00:00 2001
> From: Holger Schurig <schurig@schurig.homelinux.net>
> Date: Tue, 5 Jun 2007 22:37:04 +0200
> Subject: [PATCH] [libertas] change firmware downlaod logic
> 
> Firmware download is quite different for different hardware. The
> SDIO and CF cards have two flat files that need to be downloaded,
> whereas the USB driver needs only one file, but with an internal
> structure.
> 
> This patch moves the firmware downloading code from fw.c into if_usb.c. The
> other code that used to be in fw.c has been moved to main.c.
> 
> Signed-off-by: Holger Schurig <h4233@mail.mn-solutions.de>
> 
> ---
>  drivers/net/wireless/libertas/Makefile |    2 +-
>  drivers/net/wireless/libertas/decl.h   |    5 +-
>  drivers/net/wireless/libertas/fw.c     |  346 --------------------------------
>  drivers/net/wireless/libertas/if_usb.c |   78 +++++++-
>  drivers/net/wireless/libertas/main.c   |  278 +++++++++++++++++++++++++-
>  5 files changed, 354 insertions(+), 355 deletions(-)
>  delete mode 100644 drivers/net/wireless/libertas/fw.c
> 
> diff --git a/drivers/net/wireless/libertas/Makefile b/drivers/net/wireless/libertas/Makefile
> index fdda0f0..4d120c3 100644
> --- a/drivers/net/wireless/libertas/Makefile
> +++ b/drivers/net/wireless/libertas/Makefile
> @@ -1,4 +1,4 @@
> -libertas-objs := main.o fw.o wext.o \
> +libertas-objs := main.o wext.o \
>  		rx.o tx.o cmd.o 	  \
>  		cmdresp.o scan.o	  \
>  		join.o 11d.o 		  \
> diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
> index 129b021..113cfc1 100644
> --- a/drivers/net/wireless/libertas/decl.h
> +++ b/drivers/net/wireless/libertas/decl.h
> @@ -75,14 +75,11 @@ void libertas_mac_event_disconnected(wlan_private * priv);
>  
>  void libertas_send_iwevcustom_event(wlan_private * priv, s8 * str);
>  
> -/* fw.c */
> -int libertas_init_fw(wlan_private * priv, char *fw_name);
> -
>  /* main.c */
>  struct chan_freq_power *libertas_get_region_cfp_table(u8 region, u8 band,
>  						             int *cfp_no);
>  wlan_private *libertas_add_card(void *card, struct device *dmdev);
> -int libertas_activate_card(wlan_private *priv, char *fw_name);
> +int libertas_activate_card(wlan_private *priv);
>  int libertas_remove_card(wlan_private *priv);
>  int libertas_add_mesh(wlan_private *priv, struct device *dev);
>  void libertas_remove_mesh(wlan_private *priv);
> diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
> deleted file mode 100644
> index 6c25987..0000000
> --- a/drivers/net/wireless/libertas/fw.c
> +++ /dev/null
> @@ -1,346 +0,0 @@
> -/**
> -  * This file contains the initialization for FW and HW
> -  */
> -#include <linux/firmware.h>
> -
> -#include "host.h"
> -#include "defs.h"
> -#include "decl.h"
> -#include "dev.h"
> -#include "wext.h"
> -#include "if_usb.h"
> -
> -/**
> - *  @brief This function checks the validity of Boot2/FW image.
> - *
> - *  @param data              pointer to image
> - *         len               image length
> - *  @return     0 or -1
> - */
> -static int check_fwfile_format(u8 *data, u32 totlen)
> -{
> -	u32 bincmd, exit;
> -	u32 blksize, offset, len;
> -	int ret;
> -
> -	ret = 1;
> -	exit = len = 0;
> -
> -	do {
> -		struct fwheader *fwh = (void *)data;
> -
> -		bincmd = le32_to_cpu(fwh->dnldcmd);
> -		blksize = le32_to_cpu(fwh->datalength);
> -		switch (bincmd) {
> -		case FW_HAS_DATA_TO_RECV:
> -			offset = sizeof(struct fwheader) + blksize;
> -			data += offset;
> -			len += offset;
> -			if (len >= totlen)
> -				exit = 1;
> -			break;
> -		case FW_HAS_LAST_BLOCK:
> -			exit = 1;
> -			ret = 0;
> -			break;
> -		default:
> -			exit = 1;
> -			break;
> -		}
> -	} while (!exit);
> -
> -	if (ret)
> -		lbs_pr_err("firmware file format check FAIL\n");
> -	else
> -		lbs_deb_fw("firmware file format check PASS\n");
> -
> -	return ret;
> -}
> -
> -/**
> - *  @brief This function downloads firmware image, gets
> - *  HW spec from firmware and set basic parameters to
> - *  firmware.
> - *
> - *  @param priv    A pointer to wlan_private structure
> - *  @return 	   0 or -1
> - */
> -static int wlan_setup_station_hw(wlan_private * priv, char *fw_name)
> -{
> -	int ret = -1;
> -	wlan_adapter *adapter = priv->adapter;
> -
> -	lbs_deb_enter(LBS_DEB_FW);
> -
> -	if ((ret = request_firmware(&priv->firmware, fw_name,
> -				    priv->hotplug_device)) < 0) {
> -		lbs_pr_err("request_firmware() failed with %#x\n", ret);
> -		lbs_pr_err("firmware %s not found\n", fw_name);
> -		goto done;
> -	}
> -
> -	if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
> -		release_firmware(priv->firmware);
> -		goto done;
> -	}
> -
> -	ret = priv->hw_prog_firmware(priv);
> -
> -	release_firmware(priv->firmware);
> -
> -	if (ret) {
> -		lbs_deb_fw("bootloader in invalid state\n");
> -		ret = -1;
> -		goto done;
> -	}
> -
> -	/*
> -	 * Read MAC address from HW
> -	 */
> -	memset(adapter->current_addr, 0xff, ETH_ALEN);
> -
> -	ret = libertas_prepare_and_send_command(priv, CMD_GET_HW_SPEC,
> -				    0, CMD_OPTION_WAITFORRSP, 0, NULL);
> -
> -	if (ret) {
> -		ret = -1;
> -		goto done;
> -	}
> -
> -	libertas_set_mac_packet_filter(priv);
> -
> -	/* Get the supported Data rates */
> -	ret = libertas_prepare_and_send_command(priv, CMD_802_11_DATA_RATE,
> -				    CMD_ACT_GET_TX_RATE,
> -				    CMD_OPTION_WAITFORRSP, 0, NULL);
> -
> -	if (ret) {
> -		ret = -1;
> -		goto done;
> -	}
> -
> -	ret = 0;
> -done:
> -	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
> -	return ret;
> -}
> -
> -static int wlan_allocate_adapter(wlan_private * priv)
> -{
> -	size_t bufsize;
> -	wlan_adapter *adapter = priv->adapter;
> -
> -	/* Allocate buffer to store the BSSID list */
> -	bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
> -	adapter->networks = kzalloc(bufsize, GFP_KERNEL);
> -	if (!adapter->networks) {
> -		lbs_pr_err("Out of memory allocating beacons\n");
> -		libertas_free_adapter(priv);
> -		return -ENOMEM;
> -	}
> -
> -	/* Allocate the command buffers */
> -	libertas_allocate_cmd_buffer(priv);
> -
> -	memset(&adapter->libertas_ps_confirm_sleep, 0, sizeof(struct PS_CMD_ConfirmSleep));
> -	adapter->libertas_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum);
> -	adapter->libertas_ps_confirm_sleep.command =
> -	    cpu_to_le16(CMD_802_11_PS_MODE);
> -	adapter->libertas_ps_confirm_sleep.size =
> -	    cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep));
> -	adapter->libertas_ps_confirm_sleep.result = 0;
> -	adapter->libertas_ps_confirm_sleep.action =
> -	    cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
> -
> -	return 0;
> -}
> -
> -static void wlan_init_adapter(wlan_private * priv)
> -{
> -	wlan_adapter *adapter = priv->adapter;
> -	int i;
> -
> -	adapter->scanprobes = 0;
> -
> -	adapter->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
> -	adapter->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
> -
> -	/* ATIM params */
> -	adapter->atimwindow = 0;
> -
> -	adapter->connect_status = LIBERTAS_DISCONNECTED;
> -	memset(adapter->current_addr, 0xff, ETH_ALEN);
> -
> -	/* scan type */
> -	adapter->scantype = CMD_SCAN_TYPE_ACTIVE;
> -
> -	/* scan mode */
> -	adapter->scanmode = CMD_BSS_TYPE_ANY;
> -
> -	/* 802.11 specific */
> -	adapter->secinfo.wep_enabled = 0;
> -	for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]);
> -	     i++)
> -		memset(&adapter->wep_keys[i], 0, sizeof(struct enc_key));
> -	adapter->wep_tx_keyidx = 0;
> -	adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
> -	adapter->mode = IW_MODE_INFRA;
> -
> -	adapter->pending_assoc_req = NULL;
> -	adapter->in_progress_assoc_req = NULL;
> -
> -	/* Initialize scan result lists */
> -	INIT_LIST_HEAD(&adapter->network_free_list);
> -	INIT_LIST_HEAD(&adapter->network_list);
> -	for (i = 0; i < MAX_NETWORK_COUNT; i++) {
> -		list_add_tail(&adapter->networks[i].list,
> -			      &adapter->network_free_list);
> -	}
> -
> -	mutex_init(&adapter->lock);
> -
> -	adapter->prescan = 1;
> -
> -	memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
> -	adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
> -
> -	/* PnP and power profile */
> -	adapter->surpriseremoved = 0;
> -
> -	adapter->currentpacketfilter =
> -	    CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
> -
> -	adapter->radioon = RADIO_ON;
> -	adapter->txantenna = RF_ANTENNA_2;
> -	adapter->rxantenna = RF_ANTENNA_AUTO;
> -
> -	adapter->auto_rate = 1;
> -	adapter->cur_rate = 0;
> -	adapter->adhoc_grate_enabled = 0;
> -
> -	adapter->beaconperiod = MRVDRV_BEACON_INTERVAL;
> -
> -	// set default capabilities
> -	adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
> -
> -	adapter->psmode = WLAN802_11POWERMODECAM;
> -	adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
> -
> -	adapter->listeninterval = MRVDRV_DEFAULT_LISTEN_INTERVAL;
> -
> -	adapter->psstate = PS_STATE_FULL_POWER;
> -	adapter->needtowakeup = 0;
> -	adapter->locallisteninterval = 0;	/* default value in firmware will be used */
> -
> -	adapter->intcounter = 0;
> -
> -	adapter->currenttxskb = NULL;
> -	adapter->pkttxctrl = 0;
> -
> -	memset(&adapter->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*));
> -	adapter->tx_queue_idx = 0;
> -	spin_lock_init(&adapter->txqueue_lock);
> -
> -	return;
> -}
> -
> -static void command_timer_fn(unsigned long data);
> -
> -int libertas_init_fw(wlan_private * priv, char *fw_name)
> -{
> -	int ret = -1;
> -	wlan_adapter *adapter = priv->adapter;
> -
> -	lbs_deb_enter(LBS_DEB_FW);
> -
> -	/* Allocate adapter structure */
> -	if ((ret = wlan_allocate_adapter(priv)) != 0)
> -		goto done;
> -
> -	/* init adapter structure */
> -	wlan_init_adapter(priv);
> -
> -	/* init timer etc. */
> -	setup_timer(&adapter->command_timer, command_timer_fn,
> -			(unsigned long)priv);
> -
> -	/* download fimrware etc. */
> -	if ((ret = wlan_setup_station_hw(priv, fw_name)) != 0) {
> -		del_timer_sync(&adapter->command_timer);
> -		goto done;
> -	}
> -
> -	/* init 802.11d */
> -	libertas_init_11d(priv);
> -
> -	ret = 0;
> -done:
> -	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
> -	return ret;
> -}
> -
> -void libertas_free_adapter(wlan_private * priv)
> -{
> -	wlan_adapter *adapter = priv->adapter;
> -
> -	if (!adapter) {
> -		lbs_deb_fw("why double free adapter?\n");
> -		return;
> -	}
> -
> -	lbs_deb_fw("free command buffer\n");
> -	libertas_free_cmd_buffer(priv);
> -
> -	lbs_deb_fw("free command_timer\n");
> -	del_timer(&adapter->command_timer);
> -
> -	lbs_deb_fw("free scan results table\n");
> -	kfree(adapter->networks);
> -	adapter->networks = NULL;
> -
> -	/* Free the adapter object itself */
> -	lbs_deb_fw("free adapter\n");
> -	kfree(adapter);
> -	priv->adapter = NULL;
> -}
> -
> -/**
> - *  This function handles the timeout of command sending.
> - *  It will re-send the same command again.
> - */
> -static void command_timer_fn(unsigned long data)
> -{
> -	wlan_private *priv = (wlan_private *)data;
> -	wlan_adapter *adapter = priv->adapter;
> -	struct cmd_ctrl_node *ptempnode;
> -	struct cmd_ds_command *cmd;
> -	unsigned long flags;
> -
> -	ptempnode = adapter->cur_cmd;
> -	if (ptempnode == NULL) {
> -		lbs_deb_fw("ptempnode empty\n");
> -		return;
> -	}
> -
> -	cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
> -	if (!cmd) {
> -		lbs_deb_fw("cmd is NULL\n");
> -		return;
> -	}
> -
> -	lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
> -
> -	if (!adapter->fw_ready)
> -		return;
> -
> -	spin_lock_irqsave(&adapter->driver_lock, flags);
> -	adapter->cur_cmd = NULL;
> -	spin_unlock_irqrestore(&adapter->driver_lock, flags);
> -
> -	lbs_deb_fw("re-sending same command because of timeout\n");
> -	libertas_queue_cmd(adapter, ptempnode, 0);
> -
> -	wake_up_interruptible(&priv->waitq);
> -
> -	return;
> -}
> diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
> index e38fce7..ac1cfc2 100644
> --- a/drivers/net/wireless/libertas/if_usb.c
> +++ b/drivers/net/wireless/libertas/if_usb.c
> @@ -216,7 +216,7 @@ static int if_usb_probe(struct usb_interface *intf,
>  	priv->hw_get_int_status = if_usb_get_int_status;
>  	priv->hw_read_event_cause = if_usb_read_event_cause;
>  
> -	if (libertas_activate_card(priv, libertas_fw_name))
> +	if (libertas_activate_card(priv))
>  		goto err_activate_card;
>  
>  	list_add_tail(&cardp->list, &usb_devices);
> @@ -819,7 +819,7 @@ static int if_usb_issue_boot_command(wlan_private *priv, int ivalue)
>  }
>  
> 
> -static int if_usb_prog_firmware(wlan_private * priv)
> +static int if_usb_do_prog_firmware(wlan_private * priv)
>  {
>  	struct usb_card_rec *cardp = priv->card;
>  	int i = 0;
> @@ -903,6 +903,80 @@ done:
>  	return ret;
>  }
>  
> +/**
> + *  @brief This function checks the validity of Boot2/FW image.
> + *
> + *  @param data              pointer to image
> + *         len               image length
> + *  @return     0 or -1
> + */
> +static int check_fwfile_format(u8 *data, u32 totlen)
> +{
> +	u32 bincmd, exit;
> +	u32 blksize, offset, len;
> +	int ret;
> +
> +	ret = 1;
> +	exit = len = 0;
> +
> +	do {
> +		struct fwheader *fwh = (void *)data;
> +
> +		bincmd = le32_to_cpu(fwh->dnldcmd);
> +		blksize = le32_to_cpu(fwh->datalength);
> +		switch (bincmd) {
> +		case FW_HAS_DATA_TO_RECV:
> +			offset = sizeof(struct fwheader) + blksize;
> +			data += offset;
> +			len += offset;
> +			if (len >= totlen)
> +				exit = 1;
> +			break;
> +		case FW_HAS_LAST_BLOCK:
> +			exit = 1;
> +			ret = 0;
> +			break;
> +		default:
> +			exit = 1;
> +			break;
> +		}
> +	} while (!exit);
> +
> +	if (ret)
> +		lbs_pr_err("firmware file format check FAIL\n");
> +	else
> +		lbs_deb_fw("firmware file format check PASS\n");
> +
> +	return ret;
> +}
> +
> +
> +static int if_usb_prog_firmware(wlan_private *priv)
> +{
> +	int ret = -1;
> +
> +	lbs_deb_enter(LBS_DEB_FW);
> +
> +	if ((ret = request_firmware(&priv->firmware, libertas_fw_name,
> +				    priv->hotplug_device)) < 0) {
> +		lbs_pr_err("request_firmware() failed with %#x\n", ret);
> +		lbs_pr_err("firmware %s not found\n", libertas_fw_name);
> +		goto done;
> +	}
> +
> +	if (check_fwfile_format(priv->firmware->data, priv->firmware->size)) {
> +		release_firmware(priv->firmware);
> +		goto done;
> +	}
> +
> +	ret = if_usb_do_prog_firmware(priv);
> +
> +	release_firmware(priv->firmware);
> +done:
> +	return ret;
> +}
> +
> +
>  #ifdef CONFIG_PM
>  static int if_usb_suspend(struct usb_interface *intf, pm_message_t message)
>  {
> diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
> index 4760b01..3835979 100644
> --- a/drivers/net/wireless/libertas/main.c
> +++ b/drivers/net/wireless/libertas/main.c
> @@ -792,6 +792,280 @@ static int libertas_thread(void *data)
>  }
>  
>  /**
> + *  @brief This function downloads firmware image, gets
> + *  HW spec from firmware and set basic parameters to
> + *  firmware.
> + *
> + *  @param priv    A pointer to wlan_private structure
> + *  @return 	   0 or -1
> + */
> +static int wlan_setup_station_hw(wlan_private * priv)
> +{
> +	int ret = -1;
> +	wlan_adapter *adapter = priv->adapter;
> +
> +	lbs_deb_enter(LBS_DEB_FW);
> +
> +	ret = priv->hw_prog_firmware(priv);
> +
> +	if (ret) {
> +		lbs_deb_fw("bootloader in invalid state\n");
> +		ret = -1;
> +		goto done;
> +	}
> +
> +	/*
> +	 * Read MAC address from HW
> +	 */
> +	memset(adapter->current_addr, 0xff, ETH_ALEN);
> +
> +	ret = libertas_prepare_and_send_command(priv, CMD_GET_HW_SPEC,
> +				    0, CMD_OPTION_WAITFORRSP, 0, NULL);
> +
> +	if (ret) {
> +		ret = -1;
> +		goto done;
> +	}
> +
> +	libertas_set_mac_packet_filter(priv);
> +
> +	/* Get the supported Data rates */
> +	ret = libertas_prepare_and_send_command(priv, CMD_802_11_DATA_RATE,
> +				    CMD_ACT_GET_TX_RATE,
> +				    CMD_OPTION_WAITFORRSP, 0, NULL);
> +
> +	if (ret) {
> +		ret = -1;
> +		goto done;
> +	}
> +
> +	ret = 0;
> +done:
> +	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
> +	return ret;
> +}
> +
> +static void command_timer_fn(unsigned long data);
> +
> +/**
> + *  This function handles the timeout of command sending.
> + *  It will re-send the same command again.
> + */
> +static void command_timer_fn(unsigned long data)
> +{
> +	wlan_private *priv = (wlan_private *)data;
> +	wlan_adapter *adapter = priv->adapter;
> +	struct cmd_ctrl_node *ptempnode;
> +	struct cmd_ds_command *cmd;
> +	unsigned long flags;
> +
> +	ptempnode = adapter->cur_cmd;
> +	if (ptempnode == NULL) {
> +		lbs_deb_fw("ptempnode empty\n");
> +		return;
> +	}
> +
> +	cmd = (struct cmd_ds_command *)ptempnode->bufvirtualaddr;
> +	if (!cmd) {
> +		lbs_deb_fw("cmd is NULL\n");
> +		return;
> +	}
> +
> +	lbs_deb_fw("command_timer_fn fired, cmd %x\n", cmd->command);
> +
> +	if (!adapter->fw_ready)
> +		return;
> +
> +	spin_lock_irqsave(&adapter->driver_lock, flags);
> +	adapter->cur_cmd = NULL;
> +	spin_unlock_irqrestore(&adapter->driver_lock, flags);
> +
> +	lbs_deb_fw("re-sending same command because of timeout\n");
> +	libertas_queue_cmd(adapter, ptempnode, 0);
> +
> +	wake_up_interruptible(&priv->waitq);
> +
> +	return;
> +}
> +
> +static int wlan_allocate_adapter(wlan_private * priv)
> +{
> +	size_t bufsize;
> +	wlan_adapter *adapter = priv->adapter;
> +
> +	/* Allocate buffer to store the BSSID list */
> +	bufsize = MAX_NETWORK_COUNT * sizeof(struct bss_descriptor);
> +	adapter->networks = kzalloc(bufsize, GFP_KERNEL);
> +	if (!adapter->networks) {
> +		lbs_pr_err("Out of memory allocating beacons\n");
> +		libertas_free_adapter(priv);
> +		return -ENOMEM;
> +	}
> +
> +	/* Allocate the command buffers */
> +	libertas_allocate_cmd_buffer(priv);
> +
> +	memset(&adapter->libertas_ps_confirm_sleep, 0, sizeof(struct PS_CMD_ConfirmSleep));
> +	adapter->libertas_ps_confirm_sleep.seqnum = cpu_to_le16(++adapter->seqnum);
> +	adapter->libertas_ps_confirm_sleep.command =
> +	    cpu_to_le16(CMD_802_11_PS_MODE);
> +	adapter->libertas_ps_confirm_sleep.size =
> +	    cpu_to_le16(sizeof(struct PS_CMD_ConfirmSleep));
> +	adapter->libertas_ps_confirm_sleep.result = 0;
> +	adapter->libertas_ps_confirm_sleep.action =
> +	    cpu_to_le16(CMD_SUBCMD_SLEEP_CONFIRMED);
> +
> +	return 0;
> +}
> +
> +static void wlan_init_adapter(wlan_private * priv)
> +{
> +	wlan_adapter *adapter = priv->adapter;
> +	int i;
> +
> +	adapter->scanprobes = 0;
> +
> +	adapter->bcn_avg_factor = DEFAULT_BCN_AVG_FACTOR;
> +	adapter->data_avg_factor = DEFAULT_DATA_AVG_FACTOR;
> +
> +	/* ATIM params */
> +	adapter->atimwindow = 0;
> +
> +	adapter->connect_status = LIBERTAS_DISCONNECTED;
> +	memset(adapter->current_addr, 0xff, ETH_ALEN);
> +
> +	/* scan type */
> +	adapter->scantype = CMD_SCAN_TYPE_ACTIVE;
> +
> +	/* scan mode */
> +	adapter->scanmode = CMD_BSS_TYPE_ANY;
> +
> +	/* 802.11 specific */
> +	adapter->secinfo.wep_enabled = 0;
> +	for (i = 0; i < sizeof(adapter->wep_keys) / sizeof(adapter->wep_keys[0]);
> +	     i++)
> +		memset(&adapter->wep_keys[i], 0, sizeof(struct enc_key));
> +	adapter->wep_tx_keyidx = 0;
> +	adapter->secinfo.auth_mode = IW_AUTH_ALG_OPEN_SYSTEM;
> +	adapter->mode = IW_MODE_INFRA;
> +
> +	adapter->pending_assoc_req = NULL;
> +	adapter->in_progress_assoc_req = NULL;
> +
> +	/* Initialize scan result lists */
> +	INIT_LIST_HEAD(&adapter->network_free_list);
> +	INIT_LIST_HEAD(&adapter->network_list);
> +	for (i = 0; i < MAX_NETWORK_COUNT; i++) {
> +		list_add_tail(&adapter->networks[i].list,
> +			      &adapter->network_free_list);
> +	}
> +
> +	mutex_init(&adapter->lock);
> +
> +	adapter->prescan = 1;
> +
> +	memset(&adapter->curbssparams, 0, sizeof(adapter->curbssparams));
> +	adapter->curbssparams.channel = DEFAULT_AD_HOC_CHANNEL;
> +
> +	/* PnP and power profile */
> +	adapter->surpriseremoved = 0;
> +
> +	adapter->currentpacketfilter =
> +	    CMD_ACT_MAC_RX_ON | CMD_ACT_MAC_TX_ON;
> +
> +	adapter->radioon = RADIO_ON;
> +	adapter->txantenna = RF_ANTENNA_2;
> +	adapter->rxantenna = RF_ANTENNA_AUTO;
> +
> +	adapter->auto_rate = 1;
> +	adapter->cur_rate = 0;
> +	adapter->adhoc_grate_enabled = 0;
> +
> +	adapter->beaconperiod = MRVDRV_BEACON_INTERVAL;
> +
> +	// set default capabilities
> +	adapter->capability = WLAN_CAPABILITY_SHORT_PREAMBLE;
> +
> +	adapter->psmode = WLAN802_11POWERMODECAM;
> +	adapter->multipledtim = MRVDRV_DEFAULT_MULTIPLE_DTIM;
> +
> +	adapter->listeninterval = MRVDRV_DEFAULT_LISTEN_INTERVAL;
> +
> +	adapter->psstate = PS_STATE_FULL_POWER;
> +	adapter->needtowakeup = 0;
> +	adapter->locallisteninterval = 0;	/* default value in firmware will be used */
> +
> +	adapter->intcounter = 0;
> +
> +	adapter->currenttxskb = NULL;
> +	adapter->pkttxctrl = 0;
> +
> +	memset(&adapter->tx_queue_ps, 0, NR_TX_QUEUE*sizeof(struct sk_buff*));
> +	adapter->tx_queue_idx = 0;
> +	spin_lock_init(&adapter->txqueue_lock);
> +
> +	return;
> +}
> +
> +void libertas_free_adapter(wlan_private * priv)
> +{
> +	wlan_adapter *adapter = priv->adapter;
> +
> +	if (!adapter) {
> +		lbs_deb_fw("why double free adapter?\n");
> +		return;
> +	}
> +
> +	lbs_deb_fw("free command buffer\n");
> +	libertas_free_cmd_buffer(priv);
> +
> +	lbs_deb_fw("free command_timer\n");
> +	del_timer(&adapter->command_timer);
> +
> +	lbs_deb_fw("free scan results table\n");
> +	kfree(adapter->networks);
> +	adapter->networks = NULL;
> +
> +	/* Free the adapter object itself */
> +	lbs_deb_fw("free adapter\n");
> +	kfree(adapter);
> +	priv->adapter = NULL;
> +}
> +
> +int libertas_init_fw(wlan_private * priv)
> +{
> +	int ret = -1;
> +	wlan_adapter *adapter = priv->adapter;
> +
> +	lbs_deb_enter(LBS_DEB_FW);
> +
> +	/* Allocate adapter structure */
> +	if ((ret = wlan_allocate_adapter(priv)) != 0)
> +		goto done;
> +
> +	/* init adapter structure */
> +	wlan_init_adapter(priv);
> +
> +	/* init timer etc. */
> +	setup_timer(&adapter->command_timer, command_timer_fn,
> +			(unsigned long)priv);
> +
> +	/* download fimrware etc. */
> +	if ((ret = wlan_setup_station_hw(priv)) != 0) {
> +		del_timer_sync(&adapter->command_timer);
> +		goto done;
> +	}
> +
> +	/* init 802.11d */
> +	libertas_init_11d(priv);
> +
> +	ret = 0;
> +done:
> +	lbs_deb_leave_args(LBS_DEB_FW, "ret %d", ret);
> +	return ret;
> +}
> +
> +/**
>   * @brief This function adds the card. it will probe the
>   * card, allocate the wlan_priv and initialize the device.
>   *
> @@ -862,7 +1136,7 @@ done:
>  }
>  EXPORT_SYMBOL_GPL(libertas_add_card);
>  
> -int libertas_activate_card(wlan_private *priv, char *fw_name)
> +int libertas_activate_card(wlan_private *priv)
>  {
>  	struct net_device *dev = priv->dev;
>  	int ret = -1;
> @@ -893,7 +1167,7 @@ int libertas_activate_card(wlan_private *priv, char *fw_name)
>  	}
>  
>  	/* init FW and HW */
> -	if (fw_name && libertas_init_fw(priv, fw_name)) {
> +	if (libertas_init_fw(priv)) {
>  		lbs_pr_err("firmware init failed\n");
>  		goto err_registerdev;
>  	}


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-12 11:59         ` Dan Williams
@ 2007-06-12 13:19           ` Holger Schurig
  2007-06-12 14:05             ` John W. Linville
  0 siblings, 1 reply; 13+ messages in thread
From: Holger Schurig @ 2007-06-12 13:19 UTC (permalink / raw)
  To: Dan Williams, linux-wireless

> Well; I'm going to commit that one really soon to
> libertas-2.6, but I don't think it's 2.6.22 material mainly
> because there's no code for CF cards in libertas-2.6 yet
> anyway...

Right, it's not 2.6.22 material. That's why I asked for inclusion 
in libertas-2.6 once I heard that you & Linville are 
cherry-picking bugfixes.


But I hope to be far enought so that the driver (marked 
EXPERIMENTAL) works so that I can submit it to 2.6.23.

I just fear that the merge-window for 2.6.23 opens too early for 
me :-)



BTW, my posted patch introduces one sparse-warning (forgot to 
declare a function "static"). However, sparse also found another 
variable (in join.c). So I can send you an updated version of my 
remove-fw patch to fix my own sparse warning ...  or another 
patch that fixes both warnings.

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-12 13:19           ` Holger Schurig
@ 2007-06-12 14:05             ` John W. Linville
  2007-06-12 15:15               ` Holger Schurig
  0 siblings, 1 reply; 13+ messages in thread
From: John W. Linville @ 2007-06-12 14:05 UTC (permalink / raw)
  To: Holger Schurig; +Cc: Dan Williams, linux-wireless

On Tue, Jun 12, 2007 at 03:19:09PM +0200, Holger Schurig wrote:
> > Well; I'm going to commit that one really soon to
> > libertas-2.6, but I don't think it's 2.6.22 material mainly
> > because there's no code for CF cards in libertas-2.6 yet
> > anyway...
> 
> Right, it's not 2.6.22 material. That's why I asked for inclusion 
> in libertas-2.6 once I heard that you & Linville are 
> cherry-picking bugfixes.
> 
> 
> But I hope to be far enought so that the driver (marked 
> EXPERIMENTAL) works so that I can submit it to 2.6.23.
> 
> I just fear that the merge-window for 2.6.23 opens too early for 
> me :-)

FWIW, waiting for the merge window is generally frowned upon.  If at
all possible you should submit patches now or ASAP so that Jeff and
I have a reasonable chance to review them and they can make their
way into -mm for some testing BEFORE the merge window opens.

Hth!

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-12 14:05             ` John W. Linville
@ 2007-06-12 15:15               ` Holger Schurig
  2007-06-12 15:26                 ` Dan Williams
  2007-06-12 15:40                 ` John W. Linville
  0 siblings, 2 replies; 13+ messages in thread
From: Holger Schurig @ 2007-06-12 15:15 UTC (permalink / raw)
  To: linux-wireless; +Cc: John W. Linville, Dan Williams

> FWIW, waiting for the merge window is generally frowned upon. 
> If at all possible you should submit patches now or ASAP so
> that Jeff and I have a reasonable chance to review them and
> they can make their way into -mm for some testing BEFORE the
> merge window opens.

Yeah, but I'm still very much unfinished. It can:

* detect the card
* setup the IO window
* setup the ISR
* download helper firmware
* download real firmware
* react to some (not ALL!) interrupts

But, for example, it can not:

* send commands to the device (I'm close, but
  not yet there)
* receive results from the device (dito)
* receive data from the device (hey, even skb's
  are new to me)
* send data to the device

So, in short: the driver isn't yet usable in any way. And so I 
doubt you would want to see my current skeleton :-)



I referred to the merge window because I doubt that I'll get my 
code early enought into a submitable form -- and if I can't it 
submit to YOU before the merge window closes, then you can't put 
it upstream either. And so it might be that the libertas_cs code 
will end up in 2.6.24, not 2.6.23. And Dan even mentioned 
2.6.22, which is out-of-the-question, because a new driver is 
hardly a fix.

So, my plan is to submit the driver (or the patchset for the 
driver) to either libertas-dev or wireless-dev as soon as I get 
my first association to an AP via it. We can than think if the 
driver should be added to some GIT tree. From then on I'll start 
sending incremental patches.

Do you think that makes sense?

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-12 15:15               ` Holger Schurig
@ 2007-06-12 15:26                 ` Dan Williams
  2007-06-12 15:40                 ` John W. Linville
  1 sibling, 0 replies; 13+ messages in thread
From: Dan Williams @ 2007-06-12 15:26 UTC (permalink / raw)
  To: Holger Schurig; +Cc: linux-wireless, John W. Linville

On Tue, 2007-06-12 at 17:15 +0200, Holger Schurig wrote:
> > FWIW, waiting for the merge window is generally frowned upon. 
> > If at all possible you should submit patches now or ASAP so
> > that Jeff and I have a reasonable chance to review them and
> > they can make their way into -mm for some testing BEFORE the
> > merge window opens.
> 
> Yeah, but I'm still very much unfinished. It can:
> 
> * detect the card
> * setup the IO window
> * setup the ISR
> * download helper firmware
> * download real firmware
> * react to some (not ALL!) interrupts
> 
> But, for example, it can not:
> 
> * send commands to the device (I'm close, but
>   not yet there)
> * receive results from the device (dito)
> * receive data from the device (hey, even skb's
>   are new to me)
> * send data to the device
> 
> So, in short: the driver isn't yet usable in any way. And so I 
> doubt you would want to see my current skeleton :-)
> 
> 
> 
> I referred to the merge window because I doubt that I'll get my 
> code early enought into a submitable form -- and if I can't it 
> submit to YOU before the merge window closes, then you can't put 
> it upstream either. And so it might be that the libertas_cs code 
> will end up in 2.6.24, not 2.6.23. And Dan even mentioned 
> 2.6.22, which is out-of-the-question, because a new driver is 
> hardly a fix.
> 
> So, my plan is to submit the driver (or the patchset for the 
> driver) to either libertas-dev or wireless-dev as soon as I get 
> my first association to an AP via it. We can than think if the 
> driver should be added to some GIT tree. From then on I'll start 
> sending incremental patches.
> 
> Do you think that makes sense?

Yeah; either put it in a git tree and send a pull request to
libertas-dev, or mail patches to the libertas list.

Dan



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: Please pull libertas-2.6
  2007-06-12 15:15               ` Holger Schurig
  2007-06-12 15:26                 ` Dan Williams
@ 2007-06-12 15:40                 ` John W. Linville
  1 sibling, 0 replies; 13+ messages in thread
From: John W. Linville @ 2007-06-12 15:40 UTC (permalink / raw)
  To: Holger Schurig; +Cc: linux-wireless, Dan Williams

On Tue, Jun 12, 2007 at 05:15:33PM +0200, Holger Schurig wrote:

> So, my plan is to submit the driver (or the patchset for the 
> driver) to either libertas-dev or wireless-dev as soon as I get 
> my first association to an AP via it. We can than think if the 
> driver should be added to some GIT tree. From then on I'll start 
> sending incremental patches.
> 
> Do you think that makes sense?

Sounds great to me... :-)

John
-- 
John W. Linville
linville@tuxdriver.com

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2007-06-12 15:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-06  3:55 Please pull libertas-2.6 Dan Williams
2007-06-09 13:41 ` Dan Williams
2007-06-11 20:12   ` John W. Linville
2007-06-11 21:31     ` Dan Williams
2007-06-11 22:13       ` John W. Linville
2007-06-12  3:54         ` Dan Williams
2007-06-12  6:43       ` Holger Schurig
2007-06-12 11:59         ` Dan Williams
2007-06-12 13:19           ` Holger Schurig
2007-06-12 14:05             ` John W. Linville
2007-06-12 15:15               ` Holger Schurig
2007-06-12 15:26                 ` Dan Williams
2007-06-12 15:40                 ` John W. Linville

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).