Commit b4093065 authored by Jean Tourrilhes's avatar Jean Tourrilhes Committed by Jeff Garzik

IrDA update 3/3:

		<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>
parent 5b88eb50
...@@ -1280,6 +1280,20 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, ...@@ -1280,6 +1280,20 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev,
return -1; 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 */ /* Check if frame is large enough for parsing */
if (skb->len < 2) { if (skb->len < 2) {
ERROR("%s: frame to short!\n", __FUNCTION__); ERROR("%s: frame to short!\n", __FUNCTION__);
......
...@@ -180,13 +180,16 @@ EXPORT_SYMBOL(irtty_set_packet_mode); ...@@ -180,13 +180,16 @@ EXPORT_SYMBOL(irtty_set_packet_mode);
__u32 irda_debug = IRDA_DEBUG_LEVEL; __u32 irda_debug = IRDA_DEBUG_LEVEL;
#endif #endif
/* Packet type handler.
* Tell the kernel how IrDA packets should be handled.
*/
static struct packet_type irda_packet_type = static struct packet_type irda_packet_type =
{ {
0, /* MUTTER ntohs(ETH_P_IRDA),*/ .type = __constant_htons(ETH_P_IRDA),
NULL, .dev = NULL, /* Wildcard : All devices */
irlap_driver_rcv, .func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */
NULL, .data = (void*) 1, /* Understand shared skbs */
NULL, //.next = NULL,
}; };
/* /*
...@@ -267,7 +270,6 @@ int __init irda_init(void) ...@@ -267,7 +270,6 @@ int __init irda_init(void)
irsock_init(); irsock_init();
/* Add IrDA packet type (Start receiving packets) */ /* Add IrDA packet type (Start receiving packets) */
irda_packet_type.type = htons(ETH_P_IRDA);
dev_add_pack(&irda_packet_type); dev_add_pack(&irda_packet_type);
/* Notifier for Interface changes */ /* Notifier for Interface changes */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment