Re: [PATCH v2 2/3] Packet sniffer core framework

From: Daniel Borkmann
Date: Wed Feb 18 2015 - 11:25:40 EST

On 02/17/2015 03:03 PM, Stathis Voukelatos wrote:
The framework registers each backend sniffer channel as a netdev,
which can be accessed from user space through a raw packet socket.
Packets received from user space are treated as a command string
configuration. Each match event from the backend driver will
generate a packet with the matching bytes plus an optional
timestamp, if configured by the command string.

Signed-off-by: Stathis Voukelatos <stathis.voukelatos@xxxxxxxxxx>
drivers/net/Kconfig | 2 +
drivers/net/Makefile | 2 +
drivers/net/pkt-sniffer/Kconfig | 8 +
drivers/net/pkt-sniffer/Makefile | 3 +
drivers/net/pkt-sniffer/core/module.c | 37 +++++
drivers/net/pkt-sniffer/core/netdev.c | 254 ++++++++++++++++++++++++++++++++
drivers/net/pkt-sniffer/core/snf_core.h | 60 ++++++++
include/uapi/linux/pkt_sniffer.h | 33 +++++
9 files changed, 405 insertions(+)
create mode 100644 drivers/net/pkt-sniffer/Kconfig
create mode 100644 drivers/net/pkt-sniffer/Makefile
create mode 100644 drivers/net/pkt-sniffer/core/module.c
create mode 100644 drivers/net/pkt-sniffer/core/netdev.c
create mode 100644 drivers/net/pkt-sniffer/core/snf_core.h
create mode 100644 include/uapi/linux/pkt_sniffer.h

index aaa039d..7d882de 100644
@@ -5754,6 +5754,12 @@ M: Sasha Levin <sasha.levin@xxxxxxxxxx>
S: Maintained
F: tools/lib/lockdep/

+M: Stathis Voukelatos <stathis.voukelatos@xxxxxxxxxx>
+S: Maintained
+F: drivers/net/pkt-sniffer/
+F: Documentation/devicetree/bindings/net/linn-ether-packet-sniffer.txt

This whole framework really looks like only tailored to your specific
driver, I have no idea who else should reuse that?! So, I don't think
putting this under drivers/net/pkt-sniffer/ is a good idea.

Also it looks slightly confusing as if I understand you correctly, your
module's purpose is to pass down some "packet pattern" to the hardware
and match that in order to get a precise timestamp in return?

Might perhaps be better to have everything vendor-specific under something
like drivers/net/ethernet/linn/ and have the framework squashed into the
driver itself (if parts cannot be generalized in net/packet/).

It would be good if you can also avoid the extra uapi export. Perhaps
it's possible to reuse at least some of the existing timestamping
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at