From: Jean Tourrilhes <jt@bougret.hpl.hp.com>
To: irda-users@lists.sourceforge.net,
Jeff Garzik <jgarzik@mandrakesoft.com>,
Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.5] : ir256_packet_type.diff
Date: Mon, 4 Nov 2002 17:55:50 -0800 [thread overview]
Message-ID: <20021105015550.GD8849@bougret.hpl.hp.com> (raw)
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__);
reply other threads:[~2002-11-05 1:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20021105015550.GD8849@bougret.hpl.hp.com \
--to=jt@bougret.hpl.hp.com \
--cc=irda-users@lists.sourceforge.net \
--cc=jgarzik@mandrakesoft.com \
--cc=jt@hpl.hp.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®