Skip to contentSkip to conversation

IRDA stack should call irda_get_skb_cb (tx_extra implementation)

PATCH In review Alex Villací­s Lasso 1 participant 1 message Nov 10, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/3 IRDA stack should call irda_get_skb_cb (tx_extra implementation)

A rewrite of the original patch by Samuel Ortiz, for the tx_extra implementation. Does away with irda_alloc_skb which is irrelevant for this implementation.

Based on a patch by Samuel Ortiz <[email protected]>

Signature · 1 line
perl -e '$x=2.4;print sprintf("%.0f + %.0f = %.0f\n",$x,$x,$x+$x);'
include/net/irda/irda_device.h +4 -4
diff -ur linux-2.6.28-rc3-git-orig/include/net/irda/irda_device.h linux-2.6.28-rc3-git/include/net/irda/irda_device.h
@@ -244,7 +244,7 @@
  */
 static inline __u16 irda_get_mtt(const struct sk_buff *skb)
 {
-	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb;
+	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->tx_extra;
 	return (cb->magic == LAP_MAGIC) ? cb->mtt : 10000;
 }
 
@@ -257,7 +257,7 @@
  */
 static inline __u32 irda_get_next_speed(const struct sk_buff *skb)
 {
-	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb;
+	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->tx_extra;
 	return (cb->magic == LAP_MAGIC) ? cb->next_speed : -1;
 }
 
@@ -270,7 +270,7 @@
  */
 static inline __u16 irda_get_xbofs(const struct sk_buff *skb)
 {
-	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb;
+	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->tx_extra;
 	return (cb->magic == LAP_MAGIC) ? cb->xbofs : 10;
 }
 
@@ -283,7 +283,7 @@
  */
 static inline __u16 irda_get_next_xbofs(const struct sk_buff *skb)
 {
-	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->cb;
+	const struct irda_skb_cb *cb = (const struct irda_skb_cb *) skb->tx_extra;
 	return (cb->magic == LAP_MAGIC) ? cb->next_xbofs : -1;
 }
 #endif /* IRDA_DEVICE_H */
net/irda/ircomm/ircomm_lmp.c +2 -2
diff -ur linux-2.6.28-rc3-git-orig/net/irda/ircomm/ircomm_lmp.c linux-2.6.28-rc3-git/net/irda/ircomm/ircomm_lmp.c
@@ -146,7 +146,7 @@
 
 	IRDA_ASSERT(skb != NULL, return;);
 
-	cb = (struct irda_skb_cb *) skb->cb;
+	cb = irda_get_skb_cb(skb);
 
 	IRDA_DEBUG(2, "%s()\n", __func__ );
 
@@ -187,7 +187,7 @@
 
 	IRDA_ASSERT(skb != NULL, return -1;);
 
-	cb = (struct irda_skb_cb *) skb->cb;
+	cb = irda_get_skb_cb(skb);
 
 	cb->line = self->line;
 
net/irda/irlap_frame.c +3 -1
diff -ur linux-2.6.28-rc3-git-orig/net/irda/irlap_frame.c linux-2.6.28-rc3-git/net/irda/irlap_frame.c
@@ -56,7 +56,9 @@
 static inline void irlap_insert_info(struct irlap_cb *self,
 				     struct sk_buff *skb)
 {
-	struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;
+	struct irda_skb_cb *cb;
+
+	cb = irda_get_skb_cb(skb);
 
 	/*
 	 * Insert MTT (min. turn time) and speed into skb, so that the
net/irda/wrapper.c +3 -1
diff -ur linux-2.6.28-rc3-git-orig/net/irda/wrapper.c linux-2.6.28-rc3-git/net/irda/wrapper.c
@@ -82,7 +82,7 @@
  */
 int async_wrap_skb(struct sk_buff *skb, __u8 *tx_buff, int buffsize)
 {
-	struct irda_skb_cb *cb = (struct irda_skb_cb *) skb->cb;
+	struct irda_skb_cb *cb;
 	int xbofs;
 	int i;
 	int n;
@@ -91,6 +91,8 @@
 		__u8 bytes[2];
 	} fcs;
 
+	cb = irda_get_skb_cb(skb);
+
 	/* Initialize variables */
 	fcs.value = INIT_FCS;
 	n = 0;