Skip to content
Eddie Kohler edited this page Oct 18, 2017 · 1 revision

ToDevice Element Documentation

NAME

ToDevice — Click element; sends packets to network device (Linux kernel)

SYNOPSIS

ToDevice(DEVNAME [, BURST, KEYWORDS])

Ports: 1 input, no outputs
Processing: pull
Drivers: linuxmodule

DESCRIPTION

This manual page describes the Linux kernel module version of the ToDevice element. For the user-level element, read the ToDevice.u manual page.

Pulls packets from its single input and sends them out the Linux network interface named DEVNAME. DEVNAME may also be an Ethernet address, in which case ToDevice searches for a device with that address.

Sends up to BURST packets each time it is scheduled. By default, BURST is 16. For good performance, you should set BURST to be 8 times the number of elements that could generate packets for this device.

Packets must have a link header. For Ethernet, ToDevice makes sure every packet is at least 60 bytes long (but see NO_PAD).

Keyword arguments are:

  • BURST — Unsigned integer. Same as the BURST argument.
  • QUIET — Boolean. If true, then suppress device up/down messages. Default is false.
  • QUEUE — Integer. The transmit queue to send to. Default is 0.
  • ALLOW_NONEXISTENT — Allow nonexistent devices. If true, and no device named DEVNAME exists when the router is initialized, then ToDevice will report a warning (rather than an error). Later, while the router is running, if a device named DEVNAME appears, ToDevice will seamlessly begin sending packets to it. Default is false.
  • NO_PAD — Boolean. If true, don't force packets to be at least 60 bytes (the minimum Ethernet packet size). This is useful because some 802.11 cards can send shorter Ethernet format packets. Defaults false.
  • UP_CALL — Write handler. If supplied, this handler is called when the device or link comes up.
  • DOWN_CALL — Write handler. If supplied, this handler is called when the device or link goes down.

NOTES

The Linux networking code may also send packets out the device. If the device is in polling mode, Click will try to ensure that Linux eventually sends its packets. Linux may cause the device to be busy when a ToDevice wants to send a packet. Click is not clever enough to re-queue such packets, and discards them.

In Linux 2.2, whether or not the device is running in polling mode, ToDevice depends on the device driver's send operation for synchronization (e.g. tulip send operation uses a bit lock). In Linux 2.4, we use the device's "xmit_lock" to synchronize.

Packets sent via ToDevice will not be received by any packet sniffers on the machine. Use Tee and ToHostSniffers to send packets to sniffers explicitly.

ELEMENT HANDLERS

  • count (read-only) — Returns the number of packets ToDevice has pulled.
  • calls (read-only) — Returns a summary of ToDevice statistics.
  • drops (read-only) — Returns the number of packets ToDevice has dropped. ToDevice will drop packets because they are too short for the device, or because the device explicitly rejected them.
  • reset_counts (write-only) — Resets counters to zero when written.

SEE ALSO

FromDevice, PollDevice, FromHost, ToHost, ToDevice.u, Tee, ToHostSniffers

Generated by click-elem2man from ../../elements/linuxmodule/todevice.hh:4 on 2017/10/17.

Clone this wiki locally