public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
* [Bluez-devel] L2CAP raw socket patch
@ 2004-02-10 11:49 Collin R. Mulliner
  2004-02-10 22:16 ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Collin R. Mulliner @ 2004-02-10 11:49 UTC (permalink / raw)
  To: bluez-devel

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

Hi List,

I have written a small patch for l2cap.c to improve the capabilities of
L2CAP raw sockets. Currently only very few responses travel back to a
RAW socket (which is very bad if you need to see command responses).
The patch is very simple - it just puts all responses on the
Sig-Channel to all open RAW sockets. The owner of the raw socket just
needs to select his packets and in normal operation there shouldn't be
much use of RAW sockets so I don't think this is a performance issue.

I have attached the patch file to this email, hope this is ok.


thanks ... Collin

-- 
Collin Mulliner <collin@betaversion.net>
BATAVERSiON Systems [www.betaversion.net]
Don't ask why! Ask why not!


[-- Attachment #2: bluez_l2cap_rawsocket.patch --]
[-- Type: application/octet-stream, Size: 864 bytes --]

--- orig/l2cap.c	2003-08-25 13:44:44.000000000 +0200
+++ l2cap.c	2004-02-09 14:35:13.000000000 +0100
@@ -1663,6 +1663,12 @@
 			break;
 		}
 
+		/*  
+		 *  for better low-level access
+		 *  put command to all raw sockets
+		 */
+		l2cap_raw_recv(conn, skb);
+
 		switch (cmd.code) {
 		case L2CAP_CONN_REQ:
 			err = l2cap_connect_req(conn, &cmd, data);
@@ -1688,21 +1694,10 @@
 			err = l2cap_disconnect_rsp(conn, &cmd, data);
 			break;
 
-		case L2CAP_COMMAND_REJ:
-			/* FIXME: We should process this */
-			l2cap_raw_recv(conn, skb);
-			break;
-
 		case L2CAP_ECHO_REQ:
 			l2cap_send_rsp(conn, cmd.ident, L2CAP_ECHO_RSP, cmd.len, data);
 			break;
 
-		case L2CAP_ECHO_RSP:
-		case L2CAP_INFO_REQ:
-		case L2CAP_INFO_RSP:
-			l2cap_raw_recv(conn, skb);
-			break;
-
 		default:
 			BT_ERR("Uknown signaling command 0x%2.2x", cmd.code);
 			err = -EINVAL;

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

* Re: [Bluez-devel] L2CAP raw socket patch
  2004-02-10 11:49 [Bluez-devel] L2CAP raw socket patch Collin R. Mulliner
@ 2004-02-10 22:16 ` Marcel Holtmann
       [not found]   ` <20040210232330.4cf4935d.collin@betaversion.net>
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2004-02-10 22:16 UTC (permalink / raw)
  To: Collin R. Mulliner; +Cc: bluez-devel

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

Hi Collin,

> I have written a small patch for l2cap.c to improve the capabilities of
> L2CAP raw sockets. Currently only very few responses travel back to a
> RAW socket (which is very bad if you need to see command responses).
> The patch is very simple - it just puts all responses on the
> Sig-Channel to all open RAW sockets. The owner of the raw socket just
> needs to select his packets and in normal operation there shouldn't be
> much use of RAW sockets so I don't think this is a performance issue.

do anyone have comments about this patch?

> I have attached the patch file to this email, hope this is ok.

BTW this patch is wrong, because we must keep the case statements.
Otherwise the kernel log will be filled with unneeded error messages.

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 707 bytes --]

diff -urN linux-2.6.2/net/bluetooth/l2cap.c linux-2.6.2-mh/net/bluetooth/l2cap.c
--- linux-2.6.2/net/bluetooth/l2cap.c	2004-02-04 04:44:04.000000000 +0100
+++ linux-2.6.2-mh/net/bluetooth/l2cap.c	2004-02-10 23:04:49.000000000 +0100
@@ -1643,6 +1643,8 @@
 			break;
 		}
 
+		l2cap_raw_recv(conn, skb);
+
 		switch (cmd.code) {
 		case L2CAP_CONN_REQ:
 			err = l2cap_connect_req(conn, &cmd, data);
@@ -1670,7 +1672,6 @@
 
 		case L2CAP_COMMAND_REJ:
 			/* FIXME: We should process this */
-			l2cap_raw_recv(conn, skb);
 			break;
 
 		case L2CAP_ECHO_REQ:
@@ -1680,7 +1681,6 @@
 		case L2CAP_ECHO_RSP:
 		case L2CAP_INFO_REQ:
 		case L2CAP_INFO_RSP:
-			l2cap_raw_recv(conn, skb);
 			break;
 
 		default:

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

* Re: [Bluez-devel] L2CAP raw socket patch
       [not found]   ` <20040210232330.4cf4935d.collin@betaversion.net>
@ 2004-02-10 22:32     ` Marcel Holtmann
  2004-02-10 23:07       ` Collin R. Mulliner
  0 siblings, 1 reply; 5+ messages in thread
From: Marcel Holtmann @ 2004-02-10 22:32 UTC (permalink / raw)
  To: Collin R. Mulliner; +Cc: BlueZ Mailing List

Hi Collin,

> > BTW this patch is wrong, because we must keep the case statements.
> > Otherwise the kernel log will be filled with unneeded error messages.
> 
> ups ... will make a new one and post it again.

I already attached it to my response ;)

Regards

Marcel




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] L2CAP raw socket patch
  2004-02-10 22:32     ` Marcel Holtmann
@ 2004-02-10 23:07       ` Collin R. Mulliner
  2004-02-22 15:31         ` Marcel Holtmann
  0 siblings, 1 reply; 5+ messages in thread
From: Collin R. Mulliner @ 2004-02-10 23:07 UTC (permalink / raw)
  To: bluez-devel

Hi All,

so what do you all think about the RAW socket patch, does it make sense
putting it into the official tree?


... Collin

-- 
Collin Mulliner <collin@betaversion.net>
BATAVERSiON Systems [www.betaversion.net]
Linux is something for Windows haters, BSD something for Unix lovers.


-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Bluez-devel mailing list
Bluez-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bluez-devel

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

* Re: [Bluez-devel] L2CAP raw socket patch
  2004-02-10 23:07       ` Collin R. Mulliner
@ 2004-02-22 15:31         ` Marcel Holtmann
  0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2004-02-22 15:31 UTC (permalink / raw)
  To: Collin R. Mulliner; +Cc: BlueZ Mailing List

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

Hi Collin,

> so what do you all think about the RAW socket patch, does it make sense
> putting it into the official tree?

the original code was even wrong. If a SKB contains two or more commands
or responses the SKB will be put more than once to the raw socket. I am
going to apply the attached patch and hope we don't get a performance
decrease.

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 836 bytes --]

===== net/bluetooth/l2cap.c 1.36 vs edited =====
--- 1.36/net/bluetooth/l2cap.c	Wed Jan 14 21:56:53 2004
+++ edited/net/bluetooth/l2cap.c	Sun Feb 22 16:22:51 2004
@@ -1629,6 +1629,8 @@
 	struct l2cap_cmd_hdr cmd;
 	int err = 0;
 
+	l2cap_raw_recv(conn, skb);
+
 	while (len >= L2CAP_CMD_HDR_SIZE) {
 		memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE);
 		data += L2CAP_CMD_HDR_SIZE;
@@ -1670,7 +1672,6 @@
 
 		case L2CAP_COMMAND_REJ:
 			/* FIXME: We should process this */
-			l2cap_raw_recv(conn, skb);
 			break;
 
 		case L2CAP_ECHO_REQ:
@@ -1680,11 +1681,10 @@
 		case L2CAP_ECHO_RSP:
 		case L2CAP_INFO_REQ:
 		case L2CAP_INFO_RSP:
-			l2cap_raw_recv(conn, skb);
 			break;
 
 		default:
-			BT_ERR("Uknown signaling command 0x%2.2x", cmd.code);
+			BT_ERR("Unknown signaling command 0x%2.2x", cmd.code);
 			err = -EINVAL;
 			break;
 		}

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

end of thread, other threads:[~2004-02-22 15:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-10 11:49 [Bluez-devel] L2CAP raw socket patch Collin R. Mulliner
2004-02-10 22:16 ` Marcel Holtmann
     [not found]   ` <20040210232330.4cf4935d.collin@betaversion.net>
2004-02-10 22:32     ` Marcel Holtmann
2004-02-10 23:07       ` Collin R. Mulliner
2004-02-22 15:31         ` Marcel Holtmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox