mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2.5] : ir256_packet_type.diff
@ 2002-11-05  1:55 Jean Tourrilhes
  0 siblings, 0 replies; only message in thread
From: Jean Tourrilhes @ 2002-11-05  1:55 UTC (permalink / raw)
  To: irda-users, Jeff Garzik, Linux kernel mailing list

ir256_packet_type.diff :
----------------------
		<Thanks to Martin Diehl>
	o [CORRECT] Handle non-linear and shared skbs
	o [CORRECT] Tell kernel we can handle multithreaded receive
		<Of course, this has been tested extensively on SMP>


diff -u -p linux/net/irda/irsyms.d5.c linux/net/irda/irsyms.c
--- linux/net/irda/irsyms.d5.c	Mon Nov  4 17:04:28 2002
+++ linux/net/irda/irsyms.c	Mon Nov  4 17:04:42 2002
@@ -180,13 +180,16 @@ EXPORT_SYMBOL(irtty_set_packet_mode);
 __u32 irda_debug = IRDA_DEBUG_LEVEL;
 #endif
 
+/* Packet type handler.
+ * Tell the kernel how IrDA packets should be handled.
+ */
 static struct packet_type irda_packet_type = 
 {
-	0,	/* MUTTER ntohs(ETH_P_IRDA),*/
-	NULL,
-	irlap_driver_rcv,
-	NULL,
-	NULL,
+	.type	= __constant_htons(ETH_P_IRDA),
+	.dev	= NULL,			/* Wildcard : All devices */
+	.func	= irlap_driver_rcv,	/* Packet type handler irlap_frame.c */
+	.data	= (void*) 1,		/* Understand shared skbs */
+	//.next	= NULL,
 };
 
 /*
@@ -267,7 +270,6 @@ int __init irda_init(void)
 	irsock_init();
 	
 	/* Add IrDA packet type (Start receiving packets) */
-	irda_packet_type.type = htons(ETH_P_IRDA);
         dev_add_pack(&irda_packet_type);
 
 	/* Notifier for Interface changes */
diff -u -p linux/net/irda/irlap_frame.d5.c linux/net/irda/irlap_frame.c
--- linux/net/irda/irlap_frame.d5.c	Mon Nov  4 17:04:35 2002
+++ linux/net/irda/irlap_frame.c	Mon Nov  4 17:04:42 2002
@@ -1280,6 +1280,20 @@ int irlap_driver_rcv(struct sk_buff *skb
 		return -1;
 	}
 
+	/* We are no longer an "old" protocol, so we need to handle
+	 * share and non linear skbs. This should never happen, so
+	 * we don't need to be clever about it. Jean II */
+	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) {
+		ERROR("%s: can't clone shared skb!\n", __FUNCTION__);
+		return -1;
+	}
+	if (skb_is_nonlinear(skb))
+		if (skb_linearize(skb, GFP_ATOMIC) != 0) {
+			ERROR("%s: can't linearize skb!\n", __FUNCTION__);
+			dev_kfree_skb(skb);
+			return -1;
+		}
+
 	/* Check if frame is large enough for parsing */
 	if (skb->len < 2) {
 		ERROR("%s: frame to short!\n", __FUNCTION__);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-11-05  1:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-11-05  1:55 [PATCH 2.5] : ir256_packet_type.diff Jean Tourrilhes

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

all inboxes | Powered by JetHome®