OSDN Git Service

Update release for LDP 3.67
[linuxjm/LDP_man-pages.git] / release / man7 / packet.7
index 1a8d711..8cdd527 100644 (file)
@@ -20,7 +20,7 @@
 .\" Updated 2001-02-13, Kentaro Shirakata <argrath@ub32.org>
 .\" Updated 2005-02-21, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\"
-.TH PACKET 7 2014\-02\-26 Linux "Linux Programmer's Manual"
+.TH PACKET 7 2014\-04\-28 Linux "Linux Programmer's Manual"
 .SH 名前
 packet \- デバイスレベルのパケットインターフェース
 .SH 書式
@@ -187,26 +187,41 @@ struct tpacket_auxdata {
 元のファンアウトアルゴリズムが backlog ソケットを選択していれば、 パケットは次の利用可能なソケットにロールオーバーされる。
 .TP 
 \fBPACKET_LOSS\fP (\fBPACKET_TX_RING\fP で使用)
-有効にすると、転送エラーの場合にパケットをエラーなしに黙って破棄せず、 ステータスを \fBTP_STATUS_WRONG_FORMAT\fP
-にセットして返る。
+When a malformed packet is encountered on a transmit ring, the default is to
+reset its \fItp_status\fP to \fBTP_STATUS_WRONG_FORMAT\fP and abort the
+transmission immediately.  The malformed packet blocks itself and
+subsequently enqueued packets from being sent.  The format error must be
+fixed, the associated \fItp_status\fP reset to \fBTP_STATUS_SEND_REQUEST\fP, and
+the transmission process restarted via \fBsend\fP(2).  However, if
+\fBPACKET_LOSS\fP is set, any malformed packet will be skipped, its
+\fItp_status\fP reset to \fBTP_STATUS_AVAILABLE\fP, and the transmission process
+continued.
 .TP 
 \fBPACKET_RESERVE\fP (\fBPACKET_RX_RING\fP で使用)
 デフォルトでは、パケット受信リングはメタデータ構造体とアライメント用のパディングの直後にパケットを書き込む。
 この整数オプションを設定すると、パケットの前に追加で領域が予約される。
 .TP 
 \fBPACKET_RX_RING\fP
-非同期でのパケット受信用のメモリマップされたリングバッファを作成する。 パケットソケットはアプリケーションのアドレス空間に連続する領域を確保し、
-そこにパケットスロットの配列を構成し、 (最大 \fItp_snaplen\fP 個の) パケットを順にスロットにコピーする。 各パケットの前には
-\fItpacket_auxdata\fP に似たメタデータ構造体が置かれる。
-プロトコルフィールドには、データの、メタデータヘッダーの先頭からのオフセットが入る。 \fItp_net\fP にはネットワーク層へのオフセットが格納される。
-パケットソケットが \fBSOCK_DGRAM\fP 型の場合、 \fItp_mac\fP も同じである。 \fBSOCK_RAW\fP 型の場合、 \fItp_net\fP
-にはリンク層のフレームへのオフセットが入る。 パケットソケットとアプリケーションは \fItp_status\fP フィールドを通してリングの先頭
-(head) と末尾 (tail) の情報を受け渡す。 パケットソケットはすべてのスロットをステータス \fBTP_STATUS_KERNEL\fP
-で所有しており、 スロットにデータが入ると、パケットソケットはそのスロットのステータスをアプリケーションに所有権を渡す状態に変更する。
-通常の動作では、新しいステータスは \fBTP_STATUS_USER\fP であり、これは正しく受信されたパケットが格納されたことを示している。
-アプリケーションがパケットの処理を終えると、アプリケーションはそのスロットのステータスを \fBTP_STATUS_KERNEL\fP
-に設定し、そのスロットの所有権をソケットに返す。 パケットソケットは、複数バージョンのパケットリングを実装している。 実装の詳細は Linux
-カーネルソースツリーの \fIDocumentation/networking/packet_mmap.txt\fP で説明されている。
+Create a memory\-mapped ring buffer for asynchronous packet reception.  The
+packet socket reserves a contiguous region of application address space,
+lays it out into an array of packet slots and copies packets (up to
+\fItp_snaplen\fP)  into subsequent slots.  Each packet is preceded by a
+metadata structure similar to \fItpacket_auxdata\fP.  The protocol fields
+encode the offset to the data from the start of the metadata header.
+\fItp_net\fP stores the offset to the network layer.  If the packet socket is
+of type \fBSOCK_DGRAM\fP, then \fItp_mac\fP is the same.  If it is of type
+\fBSOCK_RAW\fP, then that field stores the offset to the link\-layer frame.
+Packet socket and application communicate the head and tail of the ring
+through the \fItp_status\fP field.  The packet socket owns all slots with
+\fItp_status\fP equal to \fBTP_STATUS_KERNEL\fP.  After filling a slot, it changes
+the status of the slot to transfer ownership to the application.  During
+normal operation, the new \fItp_status\fP value has at least the
+\fBTP_STATUS_USER\fP bit set to signal that a received packet has been stored.
+When the application has finished processing a packet, it transfers
+ownership of the slot back to the socket by setting \fItp_status\fP equal to
+\fBTP_STATUS_KERNEL\fP.  Packet sockets implement multiple variants of the
+packet ring.  The implementation details are described in
+\fIDocumentation/networking/packet_mmap.txt\fP in the Linux kernel source tree.
 .TP 
 \fBPACKET_STATISTICS\fP
 パケットソケットの統計情報を次の構造体形式で取得する。
@@ -232,13 +247,16 @@ struct tpacket_stats {
 .TP 
 \fBPACKET_TX_RING\fP (Linux 2.6.31 以降)
 .\" commit 69e3c75f4d541a6eb151b3ef91f34033cb3ad6e1
-パケット送信用のメモリマップされたリングバッファを作成する。 このオプションは \fBPACKET_RX_RING\fP と同様で、同じ引き数を取る。
-アプリケーションはステータスが \fBTP_STATUS_AVAILABLE\fP のスロットにパケットを書き込み、
-\fBTP_STATUS_SEND_REQUEST\fP にステータスを変更することでそのパケットが送信できるようにする。
-パケットの送信準備ができたら、アプリケーションは続けて \fBsend\fP(2) 系のシステムコールを呼び出す。 システムコールの引き数 \fIbuf\fP と
-\fIlen\fP は無視される。 \fBsendto\fP(2) や \fBsendmsg\fP(2) を使ってアドレスが渡された場合、
-ソケットのデフォルト値ではなくそのアドレスが使用される。 送信に成功すると、ソケットはそのスロットを \fBTP_STATUS_AVAILABLE\fP
-に戻す。 エラーの場合、 \fBPACKET_LOSS\fP がセットされていなければエラーなしでパケットは廃棄される。
+Create a memory\-mapped ring buffer for packet transmission.  This option is
+similar to \fBPACKET_RX_RING\fP and takes the same arguments.  The application
+writes packets into slots with \fItp_status\fP equal to \fBTP_STATUS_AVAILABLE\fP
+and schedules them for transmission by changing \fItp_status\fP to
+\fBTP_STATUS_SEND_REQUEST\fP.  When packets are ready to be transmitted, the
+application calls \fBsend\fP(2)  or a variant thereof.  The \fIbuf\fP and \fIlen\fP
+fields of this call are ignored.  If an address is passed using \fBsendto\fP(2)
+or \fBsendmsg\fP(2), then that overrides the socket default.  On successful
+transmission, the socket resets \fItp_status\fP to \fBTP_STATUS_AVAILABLE\fP.  It
+immediately aborts the transmission on error unless \fBPACKET_LOSS\fP is set.
 .TP 
 \fBPACKET_VERSION\fP (\fBPACKET_RX_RING\fP で使用; Linux 2.6.27 以降)
 .\" commit bbd6ef87c544d88c30e4b762b1b61ef267a7d279
@@ -377,7 +395,12 @@ IEEE 802.2/803.3 の LLC の扱い方は、バグと考えても良いだろう
 に関しては RFC\ 1700 を参照。
 
 物理層のプロトコルに関する記述は \fI<linux/if_ether.h>\fP インクルードファイルにある。
+
+The Linux kernel source tree.  \fI/Documentation/networking/filter.txt\fP
+describes how to apply Berkeley Packet Filters to packet sockets.
+\fI/tools/testing/selftests/net/psock_tpacket.c\fP contains example source code
+for all available versions of \fBPACKET_RX_RING\fP and \fBPACKET_TX_RING\fP.
 .SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.65 の一部
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.67 の一部
 である。プロジェクトの説明とバグ報告に関する情報は
 http://www.kernel.org/doc/man\-pages/ に書かれている。