aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/mon/usb_mon.h
diff options
context:
space:
mode:
authorPete Zaitcev <zaitcev@redhat.com>2006-12-31 01:43:10 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2007-02-07 18:44:34 -0500
commit6f23ee1fefdc1f80bd8a3ab04a1c41ab2dec14c9 (patch)
tree36a5241c29333580de3e3c75e2c62edc1cdf583c /drivers/usb/mon/usb_mon.h
parenta8ef36bc0a5fe973bddaa54a5a07cda29e04a602 (diff)
USB: add binary API to usbmon
This patch adds a new, "binary" API in addition to the old, text API usbmon had before. The new API allows for less CPU use, and it allows to capture all data from a packet where old API only captured 32 bytes at most. There are some limitations and conditions to this, e.g. in case someone constructs a URB with 1GB of data, it's not likely to be captured, because even the huge buffers of the new reader are finite. Nonetheless, I expect this new capability to capture all data for all real life scenarios. The downside is, a special user mode application is required where cat(1) worked before. I have sample code at http://people.redhat.com/zaitcev/linux/ and Paolo Abeni is working on patching libpcap. This patch was initially written by Paolo and later I tweaked it, and we had a little back-and-forth. So this is a jointly authored patch, but I am submitting this I am responsible for the bugs. Signed-off-by: Paolo Abeni <paolo.abeni@email.it> Signed-off-by: Pete Zaitcev <zaitcev@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/mon/usb_mon.h')
-rw-r--r--drivers/usb/mon/usb_mon.h30
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/usb/mon/usb_mon.h b/drivers/usb/mon/usb_mon.h
index ab9d02d5df77..4f949ce8a7f3 100644
--- a/drivers/usb/mon/usb_mon.h
+++ b/drivers/usb/mon/usb_mon.h
@@ -17,9 +17,11 @@
17struct mon_bus { 17struct mon_bus {
18 struct list_head bus_link; 18 struct list_head bus_link;
19 spinlock_t lock; 19 spinlock_t lock;
20 struct usb_bus *u_bus;
21
22 int text_inited;
20 struct dentry *dent_s; /* Debugging file */ 23 struct dentry *dent_s; /* Debugging file */
21 struct dentry *dent_t; /* Text interface file */ 24 struct dentry *dent_t; /* Text interface file */
22 struct usb_bus *u_bus;
23 int uses_dma; 25 int uses_dma;
24 26
25 /* Ref */ 27 /* Ref */
@@ -48,13 +50,35 @@ struct mon_reader {
48void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r); 50void mon_reader_add(struct mon_bus *mbus, struct mon_reader *r);
49void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r); 51void mon_reader_del(struct mon_bus *mbus, struct mon_reader *r);
50 52
53struct mon_bus *mon_bus_lookup(unsigned int num);
54
55int /*bool*/ mon_text_add(struct mon_bus *mbus, const struct usb_bus *ubus);
56void mon_text_del(struct mon_bus *mbus);
57// void mon_bin_add(struct mon_bus *);
58
59int __init mon_text_init(void);
60void __exit mon_text_exit(void);
61int __init mon_bin_init(void);
62void __exit mon_bin_exit(void);
63
51/* 64/*
52 */ 65 * DMA interface.
66 *
67 * XXX The vectored side needs a serious re-thinking. Abstracting vectors,
68 * like in Paolo's original patch, produces a double pkmap. We need an idea.
69*/
53extern char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len); 70extern char mon_dmapeek(unsigned char *dst, dma_addr_t dma_addr, int len);
54 71
72struct mon_reader_bin;
73extern void mon_dmapeek_vec(const struct mon_reader_bin *rp,
74 unsigned int offset, dma_addr_t dma_addr, unsigned int len);
75extern unsigned int mon_copy_to_buff(const struct mon_reader_bin *rp,
76 unsigned int offset, const unsigned char *from, unsigned int len);
77
78/*
79 */
55extern struct mutex mon_lock; 80extern struct mutex mon_lock;
56 81
57extern const struct file_operations mon_fops_text;
58extern const struct file_operations mon_fops_stat; 82extern const struct file_operations mon_fops_stat;
59 83
60#endif /* __USB_MON_H */ 84#endif /* __USB_MON_H */