Skip to contentSkip to conversation

: SIR Wrapper partial rewrite

PATCH New Jean Tourrilhes 1 participant 1 message Jan 9, 2003 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : SIR Wrapper partial rewrite

ir254_new_wrapper-3.diff :
------------------------
o [FEATURE] Properly inline in wrapper Tx path
o [FEATURE] Rewrite/simplify/optimise wrapper Rx path Lower CPU overhead *and* kernel image size
o [FEATURE] Add ZeroCopy in wrapper Rx path for drivers that support it I'll update drivers later on...

include/net/irda/wrapper.h renamed from include/net/irda/wrapper.d7.h +0 -2
diff -u -p linux/include/net/irda/wrapper.d7.h linux/include/net/irda/wrapper.h
@@ -52,8 +52,6 @@ enum {
 
 /* Proto definitions */
 int async_wrap_skb(struct sk_buff *skb, __u8 *tx_buff, int buffsize);
-void async_bump(struct net_device *dev, struct net_device_stats *stats,
-		__u8 *buf, int len);
 void async_unwrap_char(struct net_device *dev, struct net_device_stats *stats,
 		       iobuff_t *buf, __u8 byte);
 
include/net/irda/irda_device.h renamed from include/net/irda/irda_device.d7.h +24 -3
diff -u -p linux/include/net/irda/irda_device.d7.h linux/include/net/irda/irda_device.h
@@ -173,12 +173,33 @@ typedef struct {
 
 	__u8 *head;	      /* start of buffer */
 	__u8 *data;	      /* start of data in buffer */
-	__u8 *tail;           /* end of data in buffer */
 
-	int len;	      /* length of data */
-	int truesize;	      /* total size of buffer */
+	int len;	      /* current length of data */
+	int truesize;	      /* total allocated size of buffer */
 	__u16 fcs;
+
+	struct sk_buff *skb;	/* ZeroCopy Rx in async_unwrap_char() */
 } iobuff_t;
+
+/* Maximum SIR frame (skb) that we expect to receive *unwrapped*.
+ * Max LAP MTU (I field) is 2048 bytes max (IrLAP 1.1, chapt 6.6.5, p40).
+ * Max LAP header is 2 bytes (for now).
+ * Max CRC is 2 bytes at SIR, 4 bytes at FIR. 
+ * Need 1 byte for skb_reserve() to align IP header for IrLAN.
+ * Add a few extra bytes just to be safe (buffer is power of two anyway)
+ * Jean II */
+#define IRDA_SKB_MAX_MTU	2064
+/* Maximum SIR frame that we expect to send, wrapped (i.e. with XBOFS
+ * and escaped characters on top of above). */
+#define IRDA_SIR_MAX_FRAME	4269
+
+/* The SIR unwrapper async_unwrap_char() will use a Rx-copy-break mechanism
+ * when using the optional ZeroCopy Rx, where only small frames are memcpy
+ * to a smaller skb to save memory. This is the thresold under which copy
+ * will happen (and over which it won't happen).
+ * Some FIR drivers may use this #define as well...
+ * This is the same value as various Ethernet drivers. - Jean II */
+#define IRDA_RX_COPY_THRESHOLD  256
 
 /* Function prototypes */
 int  irda_device_init(void);
net/irda/irsyms.c renamed from net/irda/irsyms.d7.c +1 -0
diff -u -p linux/net/irda/irsyms.d7.c linux/net/irda/irsyms.c
@@ -165,6 +165,7 @@ EXPORT_SYMBOL(irda_task_delete);
 EXPORT_SYMBOL(async_wrap_skb);
 EXPORT_SYMBOL(async_unwrap_char);
 EXPORT_SYMBOL(irda_calc_crc16);
+EXPORT_SYMBOL(irda_crc16_table);
 EXPORT_SYMBOL(irda_start_timer);
 EXPORT_SYMBOL(setup_dma);
 EXPORT_SYMBOL(infrared_mode);
net/irda/wrapper.c renamed from net/irda/wrapper.d7.c +276 -166

552 lines not on this page · raw message