|
From: Fredrik S. <fre...@us...> - 2002-01-29 15:57:27
|
The following files were modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bluetooth.c 1.220 1.221=20=20=20=20=20=20=20=20=20=20=20
bnep.c 1.2 1.3=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Close BNEP sessions before shutting down stack.
The diff of the modified file(s):
--- bluetooth.c 2002/01/24 16:08:47 1.220
+++ bluetooth.c 2002/01/29 15:57:26 1.221
@@ -256,6 +256,7 @@
=20
#ifdef CONFIG_BLUETOOTH_PAN
void bnep_init(void);
+void bnep_shutdown(void);
u32 bnep_connect_req(u8 *bd_addr);
u32 bnep_test(u8 *p);
u32 bnep_set_multicast_filter(u8 *filter);
@@ -3065,6 +3066,10 @@
=20
#ifdef CONFIG_BLUETOOTH_USE_SECURITY_MANAGER
sec_client_shutdown(); /* Inform that stack is getting closed */
+#endif
+
+#ifdef CONFIG_BLUETOOTH_PAN
+ bnep_shutdown();
#endif
=20
rfcomm_close();
--- bnep.c 2002/01/29 09:00:37 1.2
+++ bnep.c 2002/01/29 15:57:26 1.3
@@ -111,6 +111,8 @@
#define PRINTIPPKT(data, len)
#endif
=20
+#define BNEP_INTERFACES 7
+
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
@@ -121,7 +123,7 @@
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
static u8 bd_addr[6] =3D { 0x00, 0x40, 0x8c, 0xcd, 0x00, 0x00 };
-struct net_device dev_bnep[7]; /* Got 7 Interfaces */
+struct net_device dev_bnep[BNEP_INTERFACES];
static protocol_layer this_layer;
=20
/****************** LOCAL FUNCTION DECLARATION SECTION *******************=
***/
@@ -163,9 +165,9 @@
int i, err;
struct net_device *d;
=20=09
- printk("BNEP driver v0.1 (c) 2001 Axis Communications AB\n");
+ printk("BNEP driver v0.1 (c) 2002 Axis Communications AB\n");
D_MISC("Init BNEP interfaces\n");
- for (i =3D 0; i < 7; i++) {
+ for (i =3D 0; i < BNEP_INTERFACES; i++) {
d =3D &dev_bnep[i];
d->init =3D bnep_init_interface;
err =3D dev_alloc_name(d, "bnep%d");
@@ -184,6 +186,68 @@
}
=20
/*=20
+ * Final init of the BNEP driver.
+ * Must be called after the Bluetooth driver has been completely initalize=
d.
+ * - Registers the BNEP layer with L2CAP.
+ * - Reads the BD address through HCI.
+ * - Sets the MAC address =3D the BD address for all BNEP interfaces.
+ */
+void
+bnep_init(void)
+{
+ int i, j;
+ char temp[8];
+=09
+ DSYS("Initializing BNEP\n");
+=09
+ /* Set the confirm and indication functions for the L2CAP-layer */
+ this_layer.con_ind =3D bnep_connect_ind;
+ this_layer.con_pnd =3D bnep_connect_pnd;
+ this_layer.conf_ind =3D bnep_config_ind;
+ this_layer.disc_ind =3D bnep_disconnect_ind;
+ this_layer.con_cfm =3D bnep_connect_cfm;
+ this_layer.conf_cfm =3D bnep_config_cfm;
+ this_layer.disc_cfm =3D bnep_disconnect_cfm;
+ this_layer.receive_data =3D bnep_receive_packet;
+=09
+ /* Register BNEP in the L2CAP layer. */
+ l2cap_register_upper(BNEP_LAYER, &this_layer);
+=09
+ /* Read BD address (converting to big endian) */
+ D_MISC("Read local BD addr\n");
+ hci_read_local_bd(bd_addr);
+ for (i =3D 0; i < 6; i++) {
+ temp[7-i] =3D bd_addr[i];
+ }
+=09
+ /* Set MAC address for all 7 interfaces. */
+ for (j =3D 0; j < BNEP_INTERFACES; j++) {
+ bnep_set_mac_address(&dev_bnep[j], &temp);
+ }
+
+ D_MISC("BNEP Initialized\n");
+}
+
+/*
+ * Shutdown all BNEP sessions.
+ */
+void
+bnep_shutdown(void)
+{
+ struct net_local *local;
+ int i;
+
+ DSYS("Shutting down BNEP\n");
+ for (i =3D 0; i < BNEP_INTERFACES; i++) {
+ local =3D dev_bnep[i].priv;
+ if (local->l2cap !=3D NULL) {
+ D_MISC("Disconnecting %s\n", dev_bnep[i].name);
+ l2ca_disconnect_req(local->l2cap);
+ }
+ }
+}
+
+/*=20
* Init routine for BNEP interfaces.
*/
static int __init
@@ -234,49 +298,6 @@
}
=20
/*=20
- * Final init of the BNEP driver.
- * Must be called after the Bluetooth driver has been completely initalize=
d.
- * - Registers the BNEP layer with L2CAP.
- * - Reads the BD address through HCI.
- * - Sets the MAC address =3D the BD address for all BNEP interfaces.
- */
-void
-bnep_init(void)
-{
- int i, j;
- char temp[8];
-=09
- DSYS("Initializing BNEP\n");
-=09
- /* Set the confirm and indication functions for the L2CAP-layer */
- this_layer.con_ind =3D bnep_connect_ind;
- this_layer.con_pnd =3D bnep_connect_pnd;
- this_layer.conf_ind =3D bnep_config_ind;
- this_layer.disc_ind =3D bnep_disconnect_ind;
- this_layer.con_cfm =3D bnep_connect_cfm;
- this_layer.conf_cfm =3D bnep_config_cfm;
- this_layer.disc_cfm =3D bnep_disconnect_cfm;
- this_layer.receive_data =3D bnep_receive_packet;
-=09
- /* Register BNEP in the L2CAP layer. */
- l2cap_register_upper(BNEP_LAYER, &this_layer);
-=09
- /* Read BD address (converting to big endian) */
- D_MISC("Read local BD addr\n");
- hci_read_local_bd(bd_addr);
- for (i =3D 0; i < 6; i++) {
- temp[7-i] =3D bd_addr[i];
- }
-=09
- /* Set MAC address for all 7 interfaces. */
- for (j =3D 0; j < 7; j++) {
- bnep_set_mac_address(&dev_bnep[j], &temp);
- }
-
- D_MISC("BNEP Initialized\n");
-}
-
-/*
* Open/initialize a BNEP interface. This is called (in the current kernel)
* sometime after booting when the 'ifconfig' program is run.
*
@@ -424,6 +445,7 @@
D_XMIT(__FUNCTION__": Multicast packet, dest =3D %02x:%02x:%02x:%02x:%02=
x:%02x\n",=20
eth->h_dest[0], eth->h_dest[1], eth->h_dest[2],
eth->h_dest[3], eth->h_dest[3], eth->h_dest[5]);
+ local->stats.multicast++;
=20=09=09
/* Step through filter range by filter range */
for (i =3D 0; (i < BNEP_MAX_MCAST_FILTER_RANGES) && (!send_packet); i++)=
{
@@ -559,7 +581,7 @@
strip 4 bytes when it comes from the LAN.=20
Found during UPF7 but can't reproduce it here.*/
#if 0
- for(i =3D 0 ; i < 7 ; i++) {
+ for(i =3D 0 ; i < BNEP_INTERFACES; i++) {
other =3D dev_bnep[i].priv;
if(other->state !=3D CONNECTED) {
continue;
@@ -1437,5 +1459,3 @@
=20=09
return 0;
}
-
-
|