Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 May 2009 20:33:55 GMT
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 163118 for review
Message-ID:  <200905302033.n4UKXtvd011944@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=163118

Change 163118 by trasz@trasz_victim on 2009/05/30 20:33:29

	Fix misintegration.

Affected files ...

.. //depot/projects/soc2009/trasz_limits/sys/netgraph/NOTES#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ccatm/ng_ccatm.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ccatm/ng_ccatm_cust.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_atm.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_atm.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_ccatm.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_sscfu.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_sscop.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_uni.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ngatmbase.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ngatmbase.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscfu/ng_sscfu.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscfu/ng_sscfu_cust.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscop/ng_sscop.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscop/ng_sscop_cust.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/uni/ng_uni.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/uni/ng_uni_cust.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/common/ng_bluetooth.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/TODO#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/ng_h4.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/ng_h4_prse.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/ubt/ng_ubt_var.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/ubtbcmfw/ubtbcmfw.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/TODO#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_cmds.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_cmds.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_evnt.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_evnt.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_main.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_misc.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_misc.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_prse.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_ulpi.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_ulpi.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/hci/ng_hci_var.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_bluetooth.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_bt3c.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_btsocket.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_btsocket_hci_raw.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_btsocket_l2cap.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_btsocket_rfcomm.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_btsocket_sco.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_h4.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_hci.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_l2cap.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/include/ng_ubt.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/TODO#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_cmds.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_evnt.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_llpi.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_main.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_misc.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_prse.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_ulpi.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/l2cap/ng_l2cap_var.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/socket/TODO#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/socket/ng_btsocket.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap_raw.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/netflow/netflow.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/netflow/netflow.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/netflow/ng_netflow.c#3 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/netflow/ng_netflow.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/netgraph.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_UI.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_UI.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_async.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_async.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_atmllc.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_atmllc.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_base.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_bpf.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_bpf.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_bridge.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_bridge.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_car.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_car.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_cisco.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_cisco.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_deflate.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_deflate.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_device.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_device.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_echo.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_echo.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_eiface.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_eiface.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_etf.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_etf.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ether.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ether.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ether_echo.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ether_echo.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_fec.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_fec.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_frame_relay.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_frame_relay.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_gif.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_gif.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_gif_demux.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_gif_demux.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_hole.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_hole.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_hub.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_hub.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_iface.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_iface.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ip_input.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ip_input.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ipfw.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ipfw.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ksocket.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ksocket.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_l2tp.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_l2tp.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_lmi.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_lmi.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_message.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_mppc.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_mppc.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_nat.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_nat.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_one2many.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_one2many.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_parse.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_parse.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pipe.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pipe.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ppp.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_ppp.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pppoe.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pppoe.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pptpgre.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pptpgre.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pred1.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_pred1.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_rfc1490.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_rfc1490.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_sample.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_sample.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_socket.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_socket.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_socketvar.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_source.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_source.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_split.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_split.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_sppp.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_sppp.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tag.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tag.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tcpmss.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tcpmss.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tee.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tee.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tty.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_tty.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_vjc.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_vjc.h#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_vlan.c#2 integrate
.. //depot/projects/soc2009/trasz_limits/sys/netgraph/ng_vlan.h#2 integrate

Differences ...

==== //depot/projects/soc2009/trasz_limits/sys/netgraph/NOTES#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ccatm/ng_ccatm.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ccatm/ng_ccatm_cust.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_atm.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_atm.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_ccatm.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_sscfu.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_sscop.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ng_uni.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ngatmbase.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/ngatmbase.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscfu/ng_sscfu.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscfu/ng_sscfu_cust.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscop/ng_sscop.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/sscop/ng_sscop_cust.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/uni/ng_uni.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/atm/uni/ng_uni_cust.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/common/ng_bluetooth.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/TODO#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/ng_h4.c#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/ng_h4_prse.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/h4/ng_h4_var.h#2 (text+ko) ====


==== //depot/projects/soc2009/trasz_limits/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#2 (text+ko) ====

@@ -3,7 +3,7 @@
  */
 
 /*-
- * Copyright (c) 2001-2002 Maksim Yevmenkin <m_evmenkin@yahoo.com>
+ * Copyright (c) 2001-2009 Maksim Yevmenkin <m_evmenkin@yahoo.com>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,29 +27,89 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $Id: ng_ubt.c,v 1.22 2005/10/31 17:57:44 max Exp $
- * $FreeBSD: src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c,v 1.36 2008/10/03 22:40:42 emax Exp $
+ * $Id: ng_ubt.c,v 1.16 2003/10/10 19:15:06 max Exp $
+ * $FreeBSD: src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c,v 1.41 2009/05/29 18:46:57 thompsa Exp $
  */
 
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/conf.h>
-#include <sys/endian.h>
-#include <sys/filio.h>
-#include <sys/fcntl.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/kernel.h>
-#include <sys/module.h>
-#include <sys/poll.h>
-#include <sys/uio.h>
-#include <machine/bus.h>
+/*
+ * NOTE: ng_ubt2 driver has a split personality. On one side it is
+ * a USB device driver and on the other it is a Netgraph node. This
+ * driver will *NOT* create traditional /dev/ enties, only Netgraph 
+ * node.
+ *
+ * NOTE ON LOCKS USED: ng_ubt2 drives uses 2 locks (mutexes)
+ *
+ * 1) sc_if_mtx - lock for device's interface #0 and #1. This lock is used
+ *    by USB for any USB request going over device's interface #0 and #1,
+ *    i.e. interrupt, control, bulk and isoc. transfers.
+ * 
+ * 2) sc_ng_mtx - this lock is used to protect shared (between USB, Netgraph
+ *    and Taskqueue) data, such as outgoing mbuf queues, task flags and hook
+ *    pointer. This lock *SHOULD NOT* be grabbed for a long time. In fact,
+ *    think of it as a spin lock.
+ *
+ * NOTE ON LOCKING STRATEGY: ng_ubt2 driver operates in 3 different contexts.
+ *
+ * 1) USB context. This is where all the USB related stuff happens. All
+ *    callbacks run in this context. All callbacks are called (by USB) with
+ *    appropriate interface lock held. It is (generally) allowed to grab
+ *    any additional locks.
+ *
+ * 2) Netgraph context. This is where all the Netgraph related stuff happens.
+ *    Since we mark node as WRITER, the Netgraph node will be "locked" (from
+ *    Netgraph point of view). Any variable that is only modified from the
+ *    Netgraph context does not require any additonal locking. It is generally
+ *    *NOT* allowed to grab *ANY* additional locks. Whatever you do, *DO NOT*
+ *    grab any lock in the Netgraph context that could cause de-scheduling of
+ *    the Netgraph thread for significant amount of time. In fact, the only
+ *    lock that is allowed in the Netgraph context is the sc_ng_mtx lock.
+ *    Also make sure that any code that is called from the Netgraph context
+ *    follows the rule above.
+ *
+ * 3) Taskqueue context. This is where ubt_task runs. Since we are generally
+ *    NOT allowed to grab any lock that could cause de-scheduling in the
+ *    Netgraph context, and, USB requires us to grab interface lock before
+ *    doing things with transfers, it is safer to transition from the Netgraph
+ *    context to the Taskqueue context before we can call into USB subsystem.
+ *
+ * So, to put everything together, the rules are as follows.
+ *	It is OK to call from the USB context or the Taskqueue context into
+ * the Netgraph context (i.e. call NG_SEND_xxx functions). In other words
+ * it is allowed to call into the Netgraph context with locks held.
+ *	Is it *NOT* OK to call from the Netgraph context into the USB context,
+ * because USB requires us to grab interface locks, and, it is safer to
+ * avoid it. So, to make things safer we set task flags to indicate which
+ * actions we want to perform and schedule ubt_task which would run in the
+ * Taskqueue context.
+ *	Is is OK to call from the Taskqueue context into the USB context,
+ * and, ubt_task does just that (i.e. grabs appropriate interface locks
+ * before calling into USB).
+ *	Access to the outgoing queues, task flags and hook pointer is
+ * controlled by the sc_ng_mtx lock. It is an unavoidable evil. Again,
+ * sc_ng_mtx should really be a spin lock (and it is very likely to an
+ * equivalent of spin lock due to adaptive nature of FreeBSD mutexes).
+ *	All USB callbacks accept softc pointer as a private data. USB ensures
+ * that this pointer is valid.
+ */
 
+#include "usbdevs.h"
 #include <dev/usb/usb.h>
-#include <dev/usb/usbdi.h>
-#include <dev/usb/usbdi_util.h>
-#include <dev/usb/usbdivar.h>
+#include <dev/usb/usb_mfunc.h>
+#include <dev/usb/usb_error.h>
+
+#define	USB_DEBUG_VAR usb2_debug
+
+#include <dev/usb/usb_core.h>
+#include <dev/usb/usb_debug.h>
+#include <dev/usb/usb_parse.h>
+#include <dev/usb/usb_lookup.h>
+#include <dev/usb/usb_util.h>
+#include <dev/usb/usb_busdma.h>
+#include <dev/usb/usb_process.h>
+#include <dev/usb/usb_transfer.h>
+
+#include <sys/mbuf.h>
+#include <sys/taskqueue.h>
 
 #include <netgraph/ng_message.h>
 #include <netgraph/netgraph.h>
@@ -59,73 +119,17 @@
 #include <netgraph/bluetooth/include/ng_ubt.h>
 #include <netgraph/bluetooth/drivers/ubt/ng_ubt_var.h>
 
-#include "usbdevs.h"
+static int		ubt_modevent(module_t, int, void *);
+static device_probe_t	ubt_probe;
+static device_attach_t	ubt_attach;
+static device_detach_t	ubt_detach;
 
-/*
- * USB methods
- */
+static void		ubt_task_schedule(ubt_softc_p, int);
+static task_fn_t	ubt_task;
 
-static device_probe_t ubt_match;
-static device_attach_t ubt_attach;
-static device_detach_t ubt_detach;
+#define	ubt_xfer_start(sc, i)	usb2_transfer_start((sc)->sc_xfer[(i)])
 
-static device_method_t ubt_methods[] = {
-	/* Device interface */
-	DEVMETHOD(device_probe,		ubt_match),
-	DEVMETHOD(device_attach,	ubt_attach),
-	DEVMETHOD(device_detach,	ubt_detach),
-
-	{ 0, 0 }
-};
-
-static driver_t ubt_driver = {
-	"ubt",
-	ubt_methods,
-	sizeof(struct ubt_softc)
-};
-
-static devclass_t ubt_devclass;
-
-static int         ubt_modevent		  (module_t, int, void *);
-
-static usbd_status ubt_request_start      (ubt_softc_p);
-static void        ubt_request_complete   (usbd_xfer_handle, 
-					   usbd_private_handle, usbd_status);
-static void        ubt_request_complete2  (node_p, hook_p, void *, int);
-
-static usbd_status ubt_intr_start	  (ubt_softc_p);
-static void        ubt_intr_complete      (usbd_xfer_handle, 
-					   usbd_private_handle, usbd_status);
-static void        ubt_intr_complete2     (node_p, hook_p, void *, int); 
-
-static usbd_status ubt_bulk_in_start	  (ubt_softc_p);
-static void        ubt_bulk_in_complete   (usbd_xfer_handle, 
-					   usbd_private_handle, usbd_status);
-static void        ubt_bulk_in_complete2  (node_p, hook_p, void *, int);
-
-static usbd_status ubt_bulk_out_start     (ubt_softc_p);
-static void        ubt_bulk_out_complete  (usbd_xfer_handle, 
-					   usbd_private_handle, usbd_status);
-static void        ubt_bulk_out_complete2 (node_p, hook_p, void *, int); 
-
-static usbd_status ubt_isoc_in_start_one  (ubt_softc_p, int);
-static usbd_status ubt_isoc_in_start      (ubt_softc_p);
-static void        ubt_isoc_in_complete   (usbd_xfer_handle, 
-					   usbd_private_handle, usbd_status);
-static void        ubt_isoc_in_complete2  (node_p, hook_p, void *, int);
-
-static usbd_status ubt_isoc_out_start_one (ubt_softc_p, int);
-static usbd_status ubt_isoc_out_start     (ubt_softc_p);
-static void        ubt_isoc_out_complete  (usbd_xfer_handle, 
-					   usbd_private_handle, usbd_status);
-static void        ubt_isoc_out_complete2 (node_p, hook_p, void *, int);
-
-static void        ubt_reset              (ubt_softc_p);
-
-/*
- * Netgraph methods
- */
-
+/* Netgraph methods */
 static ng_constructor_t	ng_ubt_constructor;
 static ng_shutdown_t	ng_ubt_shutdown;
 static ng_newhook_t	ng_ubt_newhook;
@@ -141,7 +145,8 @@
 	{ "qlen",  &ng_parse_int32_type, },
 	{ NULL, }
 };
-static const struct ng_parse_type		ng_ubt_node_qlen_type = {
+static const struct ng_parse_type		ng_ubt_node_qlen_type =
+{
 	&ng_parse_struct_type,
 	&ng_ubt_node_qlen_type_fields
 };
@@ -157,61 +162,64 @@
 	{ "ierrors",    &ng_parse_uint32_type, },
 	{ NULL, }
 };
-static const struct ng_parse_type	ng_ubt_node_stat_type = {
+static const struct ng_parse_type		ng_ubt_node_stat_type =
+{
 	&ng_parse_struct_type,
 	&ng_ubt_node_stat_type_fields
 };
 
 /* Netgraph node command list */
-static const struct ng_cmdlist	ng_ubt_cmdlist[] = {
+static const struct ng_cmdlist			ng_ubt_cmdlist[] =
 {
-	NGM_UBT_COOKIE,
-	NGM_UBT_NODE_SET_DEBUG,
-	"set_debug",
-	&ng_parse_uint16_type,
-	NULL
-},
-{
-	NGM_UBT_COOKIE,
-	NGM_UBT_NODE_GET_DEBUG,
-	"get_debug",
-	NULL,
-	&ng_parse_uint16_type
-},
-{
-	NGM_UBT_COOKIE,
-	NGM_UBT_NODE_SET_QLEN,
-	"set_qlen",
-	&ng_ubt_node_qlen_type,
-	NULL
-},
-{
-	NGM_UBT_COOKIE,
-	NGM_UBT_NODE_GET_QLEN,
-	"get_qlen",
-	&ng_ubt_node_qlen_type,
-	&ng_ubt_node_qlen_type
-},
-{
-	NGM_UBT_COOKIE,
-	NGM_UBT_NODE_GET_STAT,
-	"get_stat",
-	NULL,
-	&ng_ubt_node_stat_type
-},
-{
-	NGM_UBT_COOKIE,
-	NGM_UBT_NODE_RESET_STAT,
-	"reset_stat",
-        NULL,
-	NULL
-},
-{ 0, }
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_SET_DEBUG,
+		"set_debug",
+		&ng_parse_uint16_type,
+		NULL
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_GET_DEBUG,
+		"get_debug",
+		NULL,
+		&ng_parse_uint16_type
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_SET_QLEN,
+		"set_qlen",
+		&ng_ubt_node_qlen_type,
+		NULL
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_GET_QLEN,
+		"get_qlen",
+		&ng_ubt_node_qlen_type,
+		&ng_ubt_node_qlen_type
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_GET_STAT,
+		"get_stat",
+		NULL,
+		&ng_ubt_node_stat_type
+	},
+	{
+		NGM_UBT_COOKIE,
+		NGM_UBT_NODE_RESET_STAT,
+		"reset_stat",
+		NULL,
+		NULL
+	},
+	{ 0, }
 };
 
 /* Netgraph node type */
-static struct ng_type	typestruct = {
-	.version =	NG_ABI_VERSION,
+static struct ng_type	typestruct =
+{
+	.version = 	NG_ABI_VERSION,
 	.name =		NG_UBT_NODE_TYPE,
 	.constructor =	ng_ubt_constructor,
 	.rcvmsg =	ng_ubt_rcvmsg,
@@ -220,192 +228,251 @@
 	.connect =	ng_ubt_connect,
 	.rcvdata =	ng_ubt_rcvdata,
 	.disconnect =	ng_ubt_disconnect,
-	.cmdlist =	ng_ubt_cmdlist	
+	.cmdlist =	ng_ubt_cmdlist
 };
 
-/*
- * Module
- */
-
-DRIVER_MODULE(ubt, uhub, ubt_driver, ubt_devclass, ubt_modevent, 0);
-MODULE_VERSION(ng_ubt, NG_BLUETOOTH_VERSION);
-MODULE_DEPEND(ng_ubt, netgraph, NG_ABI_VERSION, NG_ABI_VERSION, NG_ABI_VERSION);
-MODULE_DEPEND(ubt, usb, 1, 1, 1);
-
-
 /****************************************************************************
  ****************************************************************************
  **                              USB specific
  ****************************************************************************
  ****************************************************************************/
 
+/* USB methods */
+static usb_callback_t	ubt_ctrl_write_callback;
+static usb_callback_t	ubt_intr_read_callback;
+static usb_callback_t	ubt_bulk_read_callback;
+static usb_callback_t	ubt_bulk_write_callback;
+static usb_callback_t	ubt_isoc_read_callback;
+static usb_callback_t	ubt_isoc_write_callback;
+
+static int		ubt_fwd_mbuf_up(ubt_softc_p, struct mbuf **);
+static int		ubt_isoc_read_one_frame(struct usb_xfer *, int);
+
 /*
- * Load/Unload the driver module
+ * USB config
+ * 
+ * The following desribes usb transfers that could be submitted on USB device.
+ *
+ * Interface 0 on the USB device must present the following endpoints
+ *	1) Interrupt endpoint to receive HCI events
+ *	2) Bulk IN endpoint to receive ACL data
+ *	3) Bulk OUT endpoint to send ACL data
+ *
+ * Interface 1 on the USB device must present the following endpoints
+ *	1) Isochronous IN endpoint to receive SCO data
+ *	2) Isochronous OUT endpoint to send SCO data
  */
 
-static int
-ubt_modevent(module_t mod, int event, void *data)
+static const struct usb_config		ubt_config[UBT_N_TRANSFER] =
 {
-	int	error;
+	/*
+	 * Interface #0
+ 	 */
+
+	/* Outgoing bulk transfer - ACL packets */
+	[UBT_IF_0_BULK_DT_WR] = {
+		.type =		UE_BULK,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_OUT,
+		.if_index = 	0,
+		.bufsize =	UBT_BULK_WRITE_BUFFER_SIZE,
+		.flags =	{ .pipe_bof = 1, .force_short_xfer = 1, },
+		.callback =	&ubt_bulk_write_callback,
+	},
+	/* Incoming bulk transfer - ACL packets */
+	[UBT_IF_0_BULK_DT_RD] = {
+		.type =		UE_BULK,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	0,
+		.bufsize =	UBT_BULK_READ_BUFFER_SIZE,
+		.flags =	{ .pipe_bof = 1, .short_xfer_ok = 1, },
+		.callback =	&ubt_bulk_read_callback,
+	},
+	/* Incoming interrupt transfer - HCI events */
+	[UBT_IF_0_INTR_DT_RD] = {
+		.type =		UE_INTERRUPT,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	0,
+		.flags =	{ .pipe_bof = 1, .short_xfer_ok = 1, },
+		.bufsize =	UBT_INTR_BUFFER_SIZE,
+		.callback =	&ubt_intr_read_callback,
+	},
+	/* Outgoing control transfer - HCI commands */
+	[UBT_IF_0_CTRL_DT_WR] = {
+		.type =		UE_CONTROL,
+		.endpoint =	0x00,	/* control pipe */
+		.direction =	UE_DIR_ANY,
+		.if_index = 	0,
+		.bufsize =	UBT_CTRL_BUFFER_SIZE,
+		.callback =	&ubt_ctrl_write_callback,
+		.timeout =	5000,	/* 5 seconds */
+	},
+
+	/*
+	 * Interface #1
+ 	 */
+
+	/* Incoming isochronous transfer #1 - SCO packets */
+	[UBT_IF_1_ISOC_DT_RD1] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_read_callback,
+	},
+	/* Incoming isochronous transfer #2 - SCO packets */
+	[UBT_IF_1_ISOC_DT_RD2] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_IN,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_read_callback,
+	},
+	/* Outgoing isochronous transfer #1 - SCO packets */
+	[UBT_IF_1_ISOC_DT_WR1] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_OUT,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_write_callback,
+	},
+	/* Outgoing isochronous transfer #2 - SCO packets */
+	[UBT_IF_1_ISOC_DT_WR2] = {
+		.type =		UE_ISOCHRONOUS,
+		.endpoint =	UE_ADDR_ANY,
+		.direction =	UE_DIR_OUT,
+		.if_index = 	1,
+		.bufsize =	0,	/* use "wMaxPacketSize * frames" */
+		.frames =	UBT_ISOC_NFRAMES,
+		.flags =	{ .short_xfer_ok = 1, },
+		.callback =	&ubt_isoc_write_callback,
+	},
+};
 
-	switch (event) {
-	case MOD_LOAD:
-		error = ng_newtype(&typestruct);
-		if (error != 0)
-			printf(
-"%s: Could not register Netgraph node type, error=%d\n",
-				NG_UBT_NODE_TYPE, error);
-		else
-			error = usbd_driver_load(mod, event, data);
-		break;
+/*
+ * If for some reason device should not be attached then put
+ * VendorID/ProductID pair into the list below. The format is
+ * as follows:
+ *
+ *	{ USB_VPI(VENDOR_ID, PRODUCT_ID, 0) },
+ *
+ * where VENDOR_ID and PRODUCT_ID are hex numbers.
+ */
 
-	case MOD_UNLOAD:
-		error = ng_rmtype(&typestruct);
-		if (error == 0)
-			error = usbd_driver_load(mod, event, data);
-		break;
+static const struct usb_device_id ubt_ignore_devs[] = 
+{
+	/* AVM USB Bluetooth-Adapter BlueFritz! v1.0 */
+	{ USB_VPI(USB_VENDOR_AVM, 0x2200, 0) },
+};
 
-	default:
-		error = EOPNOTSUPP;
-		break;
-	}
+/* List of supported bluetooth devices */
+static const struct usb_device_id ubt_devs[] =
+{
+	/* Generic Bluetooth class devices */
+	{ USB_IFACE_CLASS(UDCLASS_WIRELESS),
+	  USB_IFACE_SUBCLASS(UDSUBCLASS_RF),
+	  USB_IFACE_PROTOCOL(UDPROTO_BLUETOOTH) },
 
-	return (error);
-} /* ubt_modevent */
+	/* AVM USB Bluetooth-Adapter BlueFritz! v2.0 */
+	{ USB_VPI(USB_VENDOR_AVM, 0x3800, 0) },
+};
 
 /*
- * Probe for a USB Bluetooth device
+ * Probe for a USB Bluetooth device.
+ * USB context.
  */
 
 static int
-ubt_match(device_t self)
+ubt_probe(device_t dev)
 {
-	/*
-	 * If for some reason device should not be attached then put
-	 * VendorID/ProductID pair into the list below. The format is
-	 * as follows:
-	 *
-	 *	{ VENDOR_ID, PRODUCT_ID },
-	 *
-	 * where VENDOR_ID and PRODUCT_ID are hex numbers.
-	 */
+	struct usb_attach_arg	*uaa = device_get_ivars(dev);
 
-	static struct usb_devno const	ubt_ignored_devices[] = {
-		{ USB_VENDOR_AVM, 0x2200 }, /* AVM USB Bluetooth-Adapter BlueFritz! v1.0 */
-		{ 0, 0 } /* This should be the last item in the list */
-	};
+	if (uaa->usb_mode != USB_MODE_HOST)
+		return (ENXIO);
 
-	/*
-	 * If device violates Bluetooth specification and has bDeviceClass,
-	 * bDeviceSubClass and bDeviceProtocol set to wrong values then you
-	 * could try to put VendorID/ProductID pair into the list below.
-	 * Adding VendorID/ProductID pair into this list forces ng_ubt(4)
-	 * to attach to the broken device.
-	 */
+	if (uaa->info.bIfaceIndex != 0)
+		return (ENXIO);
 
-	static struct usb_devno const	ubt_broken_devices[] = {
-		{ USB_VENDOR_AVM, 0x3800 }, /* AVM USB Bluetooth-Adapter BlueFritz! v2.0 */
-		{ 0, 0 } /* This should be the last item in the list */
-	};
+	if (uaa->use_generic == 0)
+		return (ENXIO);
 
-	struct usb_attach_arg *uaa = device_get_ivars(self);
-	usb_device_descriptor_t	*dd = usbd_get_device_descriptor(uaa->device);
+	if (usb2_lookup_id_by_uaa(ubt_ignore_devs,
+			sizeof(ubt_ignore_devs), uaa) == 0)
+		return (ENXIO);
 
-	if (uaa->iface == NULL ||
-	    usb_lookup(ubt_ignored_devices, uaa->vendor, uaa->product))
-		return (UMATCH_NONE);
-	
-	if (dd->bDeviceClass == UDCLASS_WIRELESS &&
-	    dd->bDeviceSubClass == UDSUBCLASS_RF &&
-	    dd->bDeviceProtocol == UDPROTO_BLUETOOTH)
-		return (UMATCH_DEVCLASS_DEVSUBCLASS);
-
-	if (usb_lookup(ubt_broken_devices, uaa->vendor, uaa->product))
-		return (UMATCH_VENDOR_PRODUCT);
-
-	return (UMATCH_NONE);
-} /* ubt_match */
+	return (usb2_lookup_id_by_uaa(ubt_devs, sizeof(ubt_devs), uaa));
+} /* ubt_probe */
 
 /*
- * Attach the device
+ * Attach the device.
+ * USB context.
  */
 
 static int
-ubt_attach(device_t self)
+ubt_attach(device_t dev)
 {
-	struct ubt_softc *sc = device_get_softc(self);
-	struct usb_attach_arg *uaa = device_get_ivars(self);
-	usb_config_descriptor_t		*cd = NULL;
-	usb_interface_descriptor_t	*id = NULL;
-	usb_endpoint_descriptor_t	*ed = NULL;
-	usbd_status			 error;
-	int				 i, ai, alt_no, isoc_in, isoc_out,
-					 isoc_isize, isoc_osize;
+	struct usb_attach_arg		*uaa = device_get_ivars(dev);
+	struct ubt_softc		*sc = device_get_softc(dev);
+	struct usb_endpoint_descriptor	*ed;
+	struct usb_interface_descriptor *id;
+	uint16_t			wMaxPacketSize;
+	uint8_t				alt_index, i, j;
+	uint8_t				iface_index[2] = { 0, 1 };
+
+	device_set_usb2_desc(dev);
 
-	/* Get USB device info */
-	sc->sc_dev = self;
-	sc->sc_udev = uaa->device;
+	sc->sc_dev = dev;
+	sc->sc_debug = NG_UBT_WARN_LEVEL;
 
 	/* 
-	 * Initialize device softc structure
+	 * Create Netgraph node
 	 */
 
-	/* State */
-	sc->sc_debug = NG_UBT_WARN_LEVEL;
-	sc->sc_flags = 0;
-	NG_UBT_STAT_RESET(sc->sc_stat);
+	if (ng_make_node_common(&typestruct, &sc->sc_node) != 0) {
+		UBT_ALERT(sc, "could not create Netgraph node\n");
+		return (ENXIO);
+	}
+
+	/* Name Netgraph node */
+	if (ng_name_node(sc->sc_node, device_get_nameunit(dev)) != 0) {
+		UBT_ALERT(sc, "could not name Netgraph node\n");
+		NG_NODE_UNREF(sc->sc_node);
+		return (ENXIO);
+	}
+	NG_NODE_SET_PRIVATE(sc->sc_node, sc);
+	NG_NODE_FORCE_WRITER(sc->sc_node);
 
-	/* Interfaces */
-	sc->sc_iface0 = sc->sc_iface1 = NULL;
+	/*
+	 * Initialize device softc structure
+	 */
 
-	/* Interrupt pipe */
-	sc->sc_intr_ep = -1;
-	sc->sc_intr_pipe = NULL;
-	sc->sc_intr_xfer = NULL;
-	sc->sc_intr_buffer = NULL;
+	/* initialize locks */
+	mtx_init(&sc->sc_ng_mtx, "ubt ng", NULL, MTX_DEF);
+	mtx_init(&sc->sc_if_mtx, "ubt if", NULL, MTX_DEF | MTX_RECURSE);
 
-	/* Control pipe */
-	sc->sc_ctrl_xfer = NULL;
-	sc->sc_ctrl_buffer = NULL;
+	/* initialize packet queues */
 	NG_BT_MBUFQ_INIT(&sc->sc_cmdq, UBT_DEFAULT_QLEN);
-
-	/* Bulk-in pipe */
-	sc->sc_bulk_in_ep = -1;
-	sc->sc_bulk_in_pipe = NULL;
-	sc->sc_bulk_in_xfer = NULL;
-	sc->sc_bulk_in_buffer = NULL;
-
-	/* Bulk-out pipe */
-	sc->sc_bulk_out_ep = -1;
-	sc->sc_bulk_out_pipe = NULL;
-	sc->sc_bulk_out_xfer = NULL;
-	sc->sc_bulk_out_buffer = NULL;
 	NG_BT_MBUFQ_INIT(&sc->sc_aclq, UBT_DEFAULT_QLEN);
-
-	/* Isoc-in pipe */
-	sc->sc_isoc_in_buffer = NULL;
-	sc->sc_isoc_in_ep = -1;
-	sc->sc_isoc_in_pipe = NULL;
-	bzero(&sc->sc_isoc_in, sizeof(sc->sc_isoc_in));
-
-	/* Isoc-out pipe */
-	sc->sc_isoc_out_ep = -1;
-	sc->sc_isoc_out_pipe = NULL;
-	bzero(&sc->sc_isoc_out, sizeof(sc->sc_isoc_out));
-
-	sc->sc_isoc_size = -1;
 	NG_BT_MBUFQ_INIT(&sc->sc_scoq, UBT_DEFAULT_QLEN);
 
-	/* Netgraph part */
-	sc->sc_node = NULL;
-	sc->sc_hook = NULL;
+	/* initialize glue task */
+	TASK_INIT(&sc->sc_task, 0, ubt_task, sc);
 
 	/*
-	 * XXX set configuration?
+	 * Configure Bluetooth USB device. Discover all required USB
+	 * interfaces and endpoints.
 	 *
-	 * Configure Bluetooth USB device. Discover all required USB interfaces
-	 * and endpoints.
-	 *
 	 * USB device must present two interfaces:
 	 * 1) Interface 0 that has 3 endpoints
 	 *	1) Interrupt endpoint to receive HCI events
@@ -416,1524 +483,804 @@
 	 *	1) Isochronous IN endpoint to receive SCO data
  	 *	2) Isochronous OUT endpoint to send SCO data
 	 *
-	 * Interface 1 (with isochronous endpoints) has several alternate 
+	 * Interface 1 (with isochronous endpoints) has several alternate
 	 * configurations with different packet size.
 	 */
 
 	/*
-	 * Interface 0
+	 * For interface #1 search alternate settings, and find
+	 * the descriptor with the largest wMaxPacketSize
 	 */
 
-	error = usbd_device2interface_handle(sc->sc_udev, 0, &sc->sc_iface0);
-	if (error || sc->sc_iface0 == NULL) {
-		printf("%s: Could not get interface 0 handle. %s (%d), " \
-			"handle=%p\n", device_get_nameunit(sc->sc_dev),
-			usbd_errstr(error), error, sc->sc_iface0);
-		goto bad;
-	}
+	wMaxPacketSize = 0;
+	alt_index = 0;
+	i = 0;
+	j = 0;
+	ed = NULL;
 
-	id = usbd_get_interface_descriptor(sc->sc_iface0);
-	if (id == NULL) {
-		printf("%s: Could not get interface 0 descriptor\n",
-			device_get_nameunit(sc->sc_dev));
-		goto bad;

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905302033.n4UKXtvd011944>