Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
JP7427464B2 - Communication devices, communication methods and programs - Google Patents
[go: Go Back, main page]

JP7427464B2 - Communication devices, communication methods and programs - Google Patents

Communication devices, communication methods and programs Download PDF

Info

Publication number
JP7427464B2
JP7427464B2 JP2020022229A JP2020022229A JP7427464B2 JP 7427464 B2 JP7427464 B2 JP 7427464B2 JP 2020022229 A JP2020022229 A JP 2020022229A JP 2020022229 A JP2020022229 A JP 2020022229A JP 7427464 B2 JP7427464 B2 JP 7427464B2
Authority
JP
Japan
Prior art keywords
buffer
packet
transmission
release
communication
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
JP2020022229A
Other languages
Japanese (ja)
Other versions
JP2021129201A (en
Inventor
暁央 木下
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Canon Inc
Original Assignee
Canon Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Canon Inc filed Critical Canon Inc
Priority to JP2020022229A priority Critical patent/JP7427464B2/en
Publication of JP2021129201A publication Critical patent/JP2021129201A/en
Application granted granted Critical
Publication of JP7427464B2 publication Critical patent/JP7427464B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Communication Control (AREA)

Description

本発明は、通信装置、通信方法およびプログラムに関する。 The present invention relates to a communication device, a communication method, and a program.

TCP/IP(Transmission Control Protocol/Internet Protocol)のプロトコル処理では、CPU(Central Processing Unit)の処理軽減および通信の高速化が求められている。このような要求に対応するため、ハードウェアであるパケット生成オフローダを用いてパケットを生成する技術が採用されることがある。この技術では、パケット生成オフローダは、指定されたユーザデータをソケットAPI(Application Programming Interface)のコール毎にネットワークバッファへ転送する処理とチェックサム計算を同時に行う。そして、事前に計算したチェックサム値を用いてMSS(Maximum Segment Size)以下のデータサイズを1つずつCPU処理でパケット化する。 BACKGROUND ART In TCP/IP (Transmission Control Protocol/Internet Protocol) protocol processing, there is a need to reduce processing by a CPU (Central Processing Unit) and speed up communication. In order to meet such demands, a technique for generating packets using a packet generation offloader, which is hardware, is sometimes adopted. In this technology, the packet generation offloader simultaneously performs a process of transferring specified user data to a network buffer and a checksum calculation for each call of a socket API (Application Programming Interface). Then, data sizes smaller than MSS (Maximum Segment Size) are packetized one by one by CPU processing using the checksum value calculated in advance.

また、送信データのセグメントをチャンク化する処理と、チャンク化したセグメントをIPパケット化する処理をパケット生成オフローダが実行する技術が用いられている。この技術は、TSO(TCP Segmentation Offload)機能により実現されている。TSO機能は、NIC(Network Interface Card)などのパケット生成オフローダで実施されることが一般的である。TSO機能を用いることで、アプリケーションデータをMSS単位の送信ではなく、MSSよりも大きいデータ単位でパケット生成オフローダに送信要求を行い、MSS単位でチャンク化させてネットワークに連続送信することが可能となる。 Further, a technique is used in which a packet generation offloader executes processing of chunking segments of transmission data and processing of converting the chunked segments into IP packets. This technology is realized by a TSO (TCP Segmentation Offload) function. The TSO function is generally implemented by a packet generation offloader such as a NIC (Network Interface Card). By using the TSO function, instead of sending application data in MSS units, it is possible to send a transmission request to the packet generation offloader in data units larger than MSS, chunk it in MSS units, and continuously transmit it to the network. .

CPUの高スペック化またはパケット生成オフローダの使用により、通信インタフェース(以下、ネットワークI/Fと言う)の送信処理よりもパケット生成処理が高速になることがある。この場合、ソケットAPIにおいて送信されたデータが全て送信できない現象または送信エラーが発生し、アプリケーションは、ソケットAPIを定期的にコールし、送信可能かどうかを確認する必要がある。 By increasing the specs of the CPU or using a packet generation offloader, the packet generation process may become faster than the transmission process of the communication interface (hereinafter referred to as network I/F). In this case, a phenomenon occurs in which all the data transmitted using the socket API cannot be transmitted or a transmission error occurs, and the application needs to periodically call the socket API to check whether data can be transmitted.

特許文献1には、送信バッファおよびバス制御部を有する通信アダプタが開示されている。バス制御部は、バッファ管理部から送信バッファが引き渡されたことを確認した後、ATMからデータの送信が要求されると、送信バッファを使用してこれに送信データを格納する。 Patent Document 1 discloses a communication adapter having a transmission buffer and a bus control section. After confirming that the transmission buffer has been handed over from the buffer management section, the bus control section uses the transmission buffer to store the transmission data when data transmission is requested from the ATM.

特開平6-342410号公報Japanese Patent Application Publication No. 6-342410

しかしながら、ソケットAPIを定期的にコールし、送信可能かどうかを確認する場合、プロトコルスタックおよびネットワークI/Fが送信可能な状態になっても、確認の時間間隔が経過しないと、送信可能な状態を検知できない。このため、パケットの送信効率が低下するおそれがある。 However, if you periodically call the socket API to check whether it is possible to send, even if the protocol stack and network I/F become ready to send, the state will not be ready for sending until the confirmation time interval has elapsed. cannot be detected. For this reason, there is a possibility that the packet transmission efficiency will decrease.

また、特許文献1に開示された技術では、バス制御部は、送信バッファが引き渡されたことを確認した後、ATMからデータ送信が要求されると、送信データを送信バッファに格納し、送信データがネットワークに送出される。このため、特許文献1に開示された技術では、送信バッファが引き渡された場合においても、ATMからデータ送信が要求されないと、送信データがネットワークに送出されない。従って、ATMからのデータ送信の要求タイミングによっては、送信効率が低下するおそれがある。 Furthermore, in the technology disclosed in Patent Document 1, when data transmission is requested from the ATM after confirming that the transmission buffer has been handed over, the bus control unit stores the transmission data in the transmission buffer, and stores the transmission data in the transmission buffer. is sent to the network. Therefore, in the technology disclosed in Patent Document 1, even if the transmission buffer is handed over, the transmission data is not sent to the network unless the ATM requests data transmission. Therefore, depending on the timing of the request for data transmission from the ATM, there is a possibility that the transmission efficiency will decrease.

本発明は、上述の課題を鑑み、パケットの送信効率を向上させることを目的とする。 In view of the above problems, the present invention aims to improve packet transmission efficiency.

本発明の1つの態様による通信装置は、送信データを含むパケットをバッファに格納する格納手段と、前記格納手段に格納された前記パケットを送信する送信手段と、前記送信手段によって前記パケットが送信された場合に、前記パケットの格納に用いられた前記バッファを解放する解放手段と、前記解放手段によって前記バッファが解放された場合に、前記バッファの解放を通知する通知手段と、を備える。 A communication device according to one aspect of the present invention includes a storage means for storing a packet including transmission data in a buffer, a transmission means for transmitting the packet stored in the storage means, and a transmission means for transmitting the packet by the transmission means. and a notification means for notifying the release of the buffer when the buffer is released by the release means.

本発明によれば、パケットの送信効率を向上させることができる。 According to the present invention, packet transmission efficiency can be improved.

実施形態1に係る通信装置のハードウェア構成例を示すブロック図。1 is a block diagram showing an example of a hardware configuration of a communication device according to a first embodiment; FIG. 実施形態1に係る通信装置の機能的な構成例を示すブロック図。1 is a block diagram showing an example of a functional configuration of a communication device according to a first embodiment. FIG. 実施形態1に係る通信装置のデータ送信処理を示すフローチャート。5 is a flowchart showing data transmission processing of the communication device according to the first embodiment. 実施形態1に係る通信装置のデータ送信完了処理を示すフローチャート。7 is a flowchart showing data transmission completion processing of the communication device according to the first embodiment. 実施形態2に係る通信装置のデータ送信処理を示すフローチャート。7 is a flowchart showing data transmission processing of the communication device according to the second embodiment.

以下、添付図面を参照して本発明の実施形態を詳細に説明する。なお、以下の実施形態は本発明を限定するものではなく、また、実施形態で説明されている特徴の組み合わせの全てが本発明の解決手段に必須のものとは限らない。実施形態の構成は、本発明が適用される装置の仕様や各種条件(使用条件、使用環境等)によって適宜修正または変更され得る。本発明の技術的範囲は、特許請求の範囲によって確定されるのであって、以下の個別の実施形態によって限定されない。 Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. Note that the following embodiments do not limit the present invention, and not all combinations of features described in the embodiments are essential to the solution of the present invention. The configuration of the embodiment may be modified or changed as appropriate depending on the specifications of the device to which the present invention is applied and various conditions (conditions of use, environment of use, etc.). The technical scope of the present invention is determined by the claims, and is not limited by the following individual embodiments.

<実施形態1>
図1は、実施形態1に係る通信装置のハードウェア構成例を示すブロック図である。
図1に示す通信装置1の各機能モジュールのうち、ソフトウェアにより実現される機能については、各機能モジュールの機能を提供するためのプログラムがROM(Read Only Memory)等のメモリに記憶される。そして、そのプログラムをRAM(Random Access Memory)に読み出してCPUが実行することにより実現される。ハードウェアにより実現される機能については、例えば、所定のコンパイラを用いることで、各機能モジュールの機能を実現するためのプログラムからFPGA上に自動的に専用回路を生成すればよい。FPGAとは、Field Programmable Gate Arrayの略である。また、FPGAと同様にしてGate Array回路を形成し、ハードウェアとして実現するようにしてもよい。また、ASIC(Application Specific Integrated Circuit)により実現するようにしてもよい。なお、図1に示した機能ブロックの構成は一例であり、複数の機能ブロックが1つの機能ブロックを構成するようにしてもよいし、いずれかの機能ブロックが複数の機能を行うブロックに分かれてもよい。
<Embodiment 1>
FIG. 1 is a block diagram showing an example of the hardware configuration of a communication device according to the first embodiment.
Among the functional modules of the communication device 1 shown in FIG. 1, for functions realized by software, a program for providing the functions of each functional module is stored in a memory such as a ROM (Read Only Memory). The program is then read out to RAM (Random Access Memory) and executed by the CPU. As for the functions to be realized by hardware, for example, a predetermined compiler may be used to automatically generate a dedicated circuit on the FPGA from a program for realizing the functions of each functional module. FPGA is an abbreviation for Field Programmable Gate Array. Further, a Gate Array circuit may be formed in the same manner as an FPGA and realized as hardware. Alternatively, it may be realized by an ASIC (Application Specific Integrated Circuit). Note that the configuration of the functional blocks shown in FIG. 1 is an example, and multiple functional blocks may constitute one functional block, or any functional block may be divided into blocks that perform multiple functions. Good too.

図1において、通信装置1は、ネットワーク2を介して通信相手装置3に接続されている。通信装置1は、ネットワーク2を介して通信相手装置3と通信可能である。通信装置1は、例えば、通信機能を備えるパーソナルコンピュータ、タブレット端末、スマートフォン、カメラ、プリンタまたはプロジェクタープロジェクトなどであってもよいが、これらに限定されない。 In FIG. 1 , a communication device 1 is connected to a communication partner device 3 via a network 2 . The communication device 1 is capable of communicating with a communication partner device 3 via the network 2 . The communication device 1 may be, for example, a personal computer with a communication function, a tablet terminal, a smartphone, a camera, a printer, or a projector project, but is not limited thereto.

本実施形態では、通信装置1は、通信プロトコルとしてTCP/IPを使用する例を説明する。TCP/IPのプロトコル処理では、通信装置1は、送信データのパケット化および再送処理のために、ネットワークバッファ(送信バッファ)を用いる。通信装置1は、TCP/IPパケットの送信処理において、ソケットAPI send()によって指定された送信データ(ユーザデータ)を送信バッファに転送し、最大伝送単位MTUでチャンク化する。MTUは、Maximum Transmission Unitの略である。そして、通信装置1は、チャンク化されたデータと擬似ヘッダのチェックサムを計算し、TCPヘッダとIPヘッダが追加されたTCP/IPパケットを生成する。伝送経路がイーサネット(登録商標)の場合、通信装置1は、これらヘッダに加えて、イーサネットヘッダが付加されたイーサネットフレームを生成し、ネットワーク2を介して通信相手装置3に送信する。 In this embodiment, an example will be described in which the communication device 1 uses TCP/IP as the communication protocol. In TCP/IP protocol processing, the communication device 1 uses a network buffer (transmission buffer) for packetization and retransmission processing of transmission data. In the TCP/IP packet transmission process, the communication device 1 transfers the transmission data (user data) specified by the socket API send( ) to the transmission buffer, and chunks it in the maximum transmission unit MTU. MTU is an abbreviation for Maximum Transmission Unit. Then, the communication device 1 calculates a checksum of the chunked data and the pseudo header, and generates a TCP/IP packet to which a TCP header and an IP header are added. When the transmission path is Ethernet (registered trademark), the communication device 1 generates an Ethernet frame to which an Ethernet header is added in addition to these headers, and transmits it to the communication partner device 3 via the network 2.

また、パケット通信において、通信の信頼性を保証するため、送信側から送信されたパケットを受信した受信側がACK(Acknowledgement)と呼ばれる確認応答を用いる通信方式が利用されている。例えば、TCP/IPでは、送信側は、送信データをセグメントにチャンク化してパケット化して送信し、受信側は、セグメントをオクテット単位にシーケンス番号で管理し、受け取ったセグメントのシーケンス番号をACKとして応答する。 Furthermore, in packet communication, in order to guarantee the reliability of communication, a communication system is used in which a receiving side that receives a packet transmitted from a transmitting side uses an acknowledgment called an ACK (Acknowledgment). For example, in TCP/IP, the sending side chunks transmission data into segments, packetizes them, and transmits them, and the receiving side manages segments in octet units using sequence numbers, and responds with the sequence number of the received segment as an ACK. do.

このとき、TCP/IPのプロトコル処理では、送信側のパケット送信の度に受信側がACKを送信することによる通信速度の低下を回避するために、所定のウィンドウサイズを利用するウィンドウ制御が行われる。TCP/IPのウィンドウ制御では、受信側は、受信バッファの残りサイズをウィンドウサイズに設定したACKを送信し、送信側は、ウィンドウサイズになるまでACKを待つことなく送信データを送信することができる。さらに、TCP/IPのウィンドウ制御では、通信速度をより向上させるために、スライディングウィンドウが用いられる。スライディングウィンドウでは、受信側は、パケットを受信する度にACKを送信し、送信側は、最初のACKを受信するとウィンドウをスライドさせて、ACKを待つことなくウィンドウサイズ分のデータを連続的に送信することが可能となる。 At this time, in the TCP/IP protocol processing, window control is performed using a predetermined window size in order to avoid a decrease in communication speed due to the receiving side transmitting an ACK every time the transmitting side sends a packet. In TCP/IP window control, the receiving side sends an ACK with the window size set to the remaining size of the receive buffer, and the sending side can send data without waiting for an ACK until the window size is reached. . Furthermore, in TCP/IP window control, a sliding window is used to further improve communication speed. In a sliding window, the receiver sends an ACK every time it receives a packet, and the sender slides the window when it receives the first ACK and continuously sends the window size of data without waiting for an ACK. It becomes possible to do so.

通信装置1は、RAM(Random Access Memory)101、CPU102、ROM(Read Only Memory)103、記録媒体105および通信部113を備える。また、通信装置1は、バッファ管理部106、データ転送部107、フレーム生成部108、パケット生成部109、チェックサム計算部110、タイマ管理部104、バッファ解放通知部111および通知設定部112を備える。 The communication device 1 includes a RAM (Random Access Memory) 101, a CPU 102, a ROM (Read Only Memory) 103, a recording medium 105, and a communication section 113. The communication device 1 also includes a buffer management section 106, a data transfer section 107, a frame generation section 108, a packet generation section 109, a checksum calculation section 110, a timer management section 104, a buffer release notification section 111, and a notification setting section 112. .

RAM101は、各種データを保存したり、ワークメモリ(ワークエリア)として使用される。RAM101は、送受信データを格納して管理するためのメモリ領域101aを有する。メモリ領域101aには、送信データを含むパケットを格納するパケット格納用バッファ101bが割り当てられる。
CPU102は、RAM101をワークメモリとして、ROM103または記録媒体105に格納された各種プログラムを実行することにより、通信装置1の各機能を動作させる。CPU102は、シングルコアプロセッサであってもよいし、マルチコアプロセッサであってもよい。
ROM103は、CPU102により実行される各種プログラム等を記憶する。
記録媒体105は、ハードディスクまたはSSD(Solid State Drive)などのプログラム格納部である。
The RAM 101 stores various data and is used as a work memory (work area). The RAM 101 has a memory area 101a for storing and managing transmitted and received data. A packet storage buffer 101b for storing packets containing transmission data is allocated to the memory area 101a.
The CPU 102 operates each function of the communication device 1 by executing various programs stored in the ROM 103 or the recording medium 105 using the RAM 101 as a work memory. CPU 102 may be a single-core processor or a multi-core processor.
The ROM 103 stores various programs executed by the CPU 102.
The recording medium 105 is a program storage unit such as a hard disk or an SSD (Solid State Drive).

通信部113は、MAC(Media Access Control)モジュール113aとPHY(Physical Layer)モジュール113bを備え、イーサネット(商標登録)などのネットワーク2を介して通信相手装置3との通信を行う。通信装置1のデータの送受信では、CPU102によりネットワークドライバが実行され、この実行に応じてMACモジュール113aが制御される。なお、本実施形態では、通信部113は、イーサネット(登録商標)を介して通信を行う場合を例にとるが、Wi-Fiなどの無線LAN(Local Area Network)などのIP通信可能な媒体を介して通信を行うことも可能である。 The communication unit 113 includes a MAC (Media Access Control) module 113a and a PHY (Physical Layer) module 113b, and communicates with the communication partner device 3 via a network 2 such as Ethernet (registered trademark). When data is transmitted and received by the communication device 1, the network driver is executed by the CPU 102, and the MAC module 113a is controlled in accordance with this execution. Note that in this embodiment, the communication unit 113 communicates via Ethernet (registered trademark); It is also possible to communicate via.

バッファ管理部106は、ヘッダまたはパケットを格納するバッファと関連付けた管理情報の取得を行う。
データ転送部107は、RAM101に記憶されているデータを、DMA(Direct Memory Access)にてフレーム生成部108およびパケット生成部109に転送する。データ転送部107は、例えば、DMAを行うDMAコントローラである。なお、データ転送部107は、必ずしもDMA転送でデータを転送する必要はなく、データを転送する際にCPU102により制御されてもよい。
The buffer management unit 106 acquires management information associated with a buffer that stores a header or a packet.
Data transfer section 107 transfers data stored in RAM 101 to frame generation section 108 and packet generation section 109 using DMA (Direct Memory Access). The data transfer unit 107 is, for example, a DMA controller that performs DMA. Note that the data transfer unit 107 does not necessarily need to transfer data by DMA transfer, and may be controlled by the CPU 102 when transferring data.

フレーム生成部108は、送信する送信データのサイズを決定し、決定したサイズの送信データと、送信データに対するヘッダ情報を生成するためのヘッダ情報生成処理を行う。
パケット生成部109は、フレーム生成部108により決定されたサイズの送信データと、ヘッダ情報に基づいて、送信データのセグメント化およびヘッダの生成を行い、当該セグメントとヘッダからパケットを生成する。
チェックサム計算部110は、RAM101に記憶されているデータに対してチェックサムを計算する。
Frame generation section 108 determines the size of transmission data to be transmitted, and performs header information generation processing to generate transmission data of the determined size and header information for the transmission data.
The packet generation unit 109 segments the transmission data and generates a header based on the transmission data of the size determined by the frame generation unit 108 and the header information, and generates a packet from the segments and headers.
The checksum calculation unit 110 calculates a checksum for data stored in the RAM 101.

バッファ解放通知部111は、通信部113によるパケットの送信が完了した後、パケットの格納に用いられたパケット格納用バッファ101bの解放を通知する。例えば、ネットワークドライバの制御によって通信部113がネットワーク2へパケットの送信を完了した後、ネットワークドライバが、そのパケットの格納に用いられたパケット格納用バッファ101bを解放したものとする。このとき、バッファ解放通知部111は、ネットワークドライバによるパケット格納用バッファ101bの解放をCPU102に通知する。 After the communication unit 113 completes transmission of the packet, the buffer release notification unit 111 notifies the release of the packet storage buffer 101b used for storing the packet. For example, assume that after the communication unit 113 completes sending a packet to the network 2 under the control of the network driver, the network driver releases the packet storage buffer 101b used to store the packet. At this time, the buffer release notification unit 111 notifies the CPU 102 of the release of the packet storage buffer 101b by the network driver.

タイマ管理部104は、パケット送信に関して必要な所定時間を管理する。
通知設定部112は、バッッファ解放通知部120にパケット格納用バッファ101bの解放を通知させるか否かを設定する。通知設定部112は、送信アプリケーションで通知の有効と無効を切り替えることができる。例えば、ソケットAPIが正常に返り値を返している場合には、通知設定部112は、通知を無効に設定し、バッファ解放を通知しない。一方、ソケットAPIが全ての送信データを送信できていないかまたは送信エラーが発生している場合には、通知設定部112は、通知を有効に設定し、バッファ解放を通知する。また、ソケットAPIが全ての送信データが送信できる状態に復帰した場合には、通知設定部112は、通知を無効に設定し、バッファ解放を通知しない。
通知設定部112は、プロトコルに基づいて通知の有効と無効を切り替えるようにしてもよい。例えば、TCP/IPのプロトコル処理において、再送のためのパケットを送信バッファに格納できた場合には、送信バッファからパケットを再送できるため通知を無効に設定し、バッファ解放を通知しない。
なお、以下に説明するパケットは、IP通信上で送受信されるデータの単位である。パケットの組み立て方法については、任意の方法を用いることができ、説明を省略する。
The timer management unit 104 manages the predetermined time required for packet transmission.
The notification setting unit 112 sets whether or not to cause the buffer release notification unit 120 to notify the release of the packet storage buffer 101b. The notification setting unit 112 can enable and disable notifications using a sending application. For example, if the socket API is returning a return value normally, the notification setting unit 112 sets the notification to invalid and does not notify that the buffer is released. On the other hand, if the socket API has not been able to transmit all the transmission data or a transmission error has occurred, the notification setting unit 112 sets the notification to valid and notifies the buffer release. Furthermore, when the socket API returns to a state in which all transmission data can be transmitted, the notification setting unit 112 sets the notification to be invalid and does not notify that the buffer is released.
The notification setting unit 112 may switch between valid and invalid notifications based on the protocol. For example, in TCP/IP protocol processing, if a packet for retransmission can be stored in a transmission buffer, the notification is set to invalid and notification of buffer release is not notified because the packet can be retransmitted from the transmission buffer.
Note that the packet described below is a unit of data transmitted and received over IP communication. Any method can be used to assemble the packets, and the description thereof will be omitted.

図2は、実施形態1に係る通信装置の機能的な構成例を示すブロック図である。
図2において、通信装置1は、アプリケーション21、プロトコルスタック22、パケット生成部23、通信I/F制御部24、通信I/F25および通知部26を備える。プロトコルスタック22は、ネットワークバッファ管理部221、セグメント処理部225、通信プロトコル処理部226、コネクション管理部222、ウィンドウ制御部223および輻輳制御部224を備える。パケット生成部23は、パケット生成完了通知部231、データ転送部232、ヘッダ生成部233およびパケット生成部234を備える。通知部26は、バッファ解放通知部261および通知設定部262を備える。
FIG. 2 is a block diagram showing an example of the functional configuration of the communication device according to the first embodiment.
In FIG. 2, the communication device 1 includes an application 21, a protocol stack 22, a packet generation section 23, a communication I/F control section 24, a communication I/F 25, and a notification section 26. The protocol stack 22 includes a network buffer management section 221, a segment processing section 225, a communication protocol processing section 226, a connection management section 222, a window control section 223, and a congestion control section 224. The packet generation unit 23 includes a packet generation completion notification unit 231, a data transfer unit 232, a header generation unit 233, and a packet generation unit 234. The notification unit 26 includes a buffer release notification unit 261 and a notification setting unit 262.

アプリケーション21は、ユーザアプリケーションである。アプリケーション21により、任意のサイズの送信対象のアプリケーションデータが送信データとしてプロトコルスタック22に入力される。 Application 21 is a user application. The application 21 inputs application data of an arbitrary size to be transmitted to the protocol stack 22 as transmission data.

プロトコルスタック22は、アプリケーション21から入力された送信データ(RAM101のメモリ領域101aに割り当てられている送信バッファ(不図示))を、ネットワークバッファ管理部221により管理する。ネットワークバッファ管理部221は、図1のバッファ管理部106に対応している。ネットワークバッファ管理部221は、RAM101のメモリ領域101aに割り当てられるバッファにヘッダまたはパケットを格納する。また、ネットワークバッファ管理部221は、メモリ領域101aに格納されている送信データのサイズを管理する。 The protocol stack 22 uses the network buffer management unit 221 to manage transmission data input from the application 21 (transmission buffer (not shown) allocated to the memory area 101a of the RAM 101). The network buffer management unit 221 corresponds to the buffer management unit 106 in FIG. The network buffer management unit 221 stores headers or packets in a buffer allocated to the memory area 101a of the RAM 101. Further, the network buffer management unit 221 manages the size of transmission data stored in the memory area 101a.

コネクション管理部222は、通信装置1の通信コネクションを管理する。例えば、コネクション管理部222は、アプリケーション21に対する通信コネクションにおけるMSS等のコネクション情報を管理する。
ウィンドウ制御部223は、通信I/F制御部24を介して受信した確認応答から、TCPコネクションの送信ウィンドウサイズを取得し、管理する。
The connection management unit 222 manages communication connections of the communication device 1. For example, the connection management unit 222 manages connection information such as MSS in a communication connection to the application 21.
The window control unit 223 acquires the transmission window size of the TCP connection from the confirmation response received via the communication I/F control unit 24 and manages it.

輻輳制御部224は、TCPコネクションにおける輻輳制御を管理する。例えば、輻輳制御部224は、アプリケーション21に対する通信コネクションにおける輻輳ウィンドウ(輻輳ウィンドウサイズ)を管理する。
セグメント処理部225は、ネットワークバッファ管理部221により管理される。セグメント処理部225は、送信データのサイズ、MSS、送信ウィンドウサイズ、輻輳ウィンドウサイズ等に基づいて、送信データのサイズを決定する。このとき、送信データのサイズは、送信バッファに格納され、MSSは、コネクション管理部222で管理され、送信ウィンドウサイズは、ウィンドウ制御部223で管理され、輻輳ウィンドウサイズは、輻輳制御部224で管理される。
通信プロトコル処理部226は、TCPセグメントのTCPヘッダ、UDPヘッダおよびIPヘッダの生成と、それに伴うチェックサム計算等の処理を行い、パケットを生成する。
The congestion control unit 224 manages congestion control in TCP connections. For example, the congestion control unit 224 manages a congestion window (congestion window size) in a communication connection to the application 21.
The segment processing unit 225 is managed by the network buffer management unit 221. The segment processing unit 225 determines the size of the transmission data based on the size of the transmission data, MSS, transmission window size, congestion window size, etc. At this time, the size of the transmission data is stored in the transmission buffer, the MSS is managed by the connection management section 222, the transmission window size is managed by the window control section 223, and the congestion window size is managed by the congestion control section 224. be done.
The communication protocol processing unit 226 generates a TCP header, a UDP header, and an IP header of a TCP segment, performs processing such as checksum calculation, and generates a packet.

パケット生成部23は、オフロード処理部(ハードウェア)である。オフロード処理部として、パケット処理に特化したパケット生成オフローダを用いることができる。パケット生成オフローダは、TSO機能を用いることで、MSSよりも大きいデータ単位で送信要求されたアプリケーションデータをMSS単位でチャンク化し、ネットワークへの連続送信を可能とする。パケット生成完了通知部231は、データ転送部232とヘッダ生成部233とパケット生成部234によるパケット化処理の完了通知を、割り込みで行うかポーリングで行うかの選択をする。
データ転送部232は、図1のデータ転送部107に対応し、データのチャンク機能、チェックサム計算機能および転送機能を持つ。チャンク機能は、送信データをデータ転送する際、所定の単位(例えばMSS単位)にチャンク化する。チェックサム計算機能は、図1のチェックサム計算部110に対応する。チェックサム計算機能は、所定の単位にチャンク化した各データに対するチェックサム計算を行う。
The packet generation unit 23 is an offload processing unit (hardware). As the offload processing unit, a packet generation offloader specialized for packet processing can be used. By using the TSO function, the packet generation offloader chunks application data requested to be transmitted in units of data larger than the MSS in units of MSS, and enables continuous transmission to the network. The packet generation completion notification unit 231 selects whether to notify the completion of the packetization processing by the data transfer unit 232, header generation unit 233, and packet generation unit 234 by using an interrupt or by polling.
The data transfer unit 232 corresponds to the data transfer unit 107 in FIG. 1, and has a data chunking function, a checksum calculation function, and a data transfer function. The chunk function chunks transmission data into predetermined units (for example, MSS units) when transferring data. The checksum calculation function corresponds to the checksum calculation section 110 in FIG. The checksum calculation function performs checksum calculation for each piece of data chunked into predetermined units.

ヘッダ生成部233は、所定のヘッダ情報に基づいて、ネットワークバッファ管理部221が管理している送信バッファを用いて、TCP/IPヘッダ、UDP/IPヘッダおよびイーサネットヘッダを生成する。
パケット生成部234は、データ転送部232とヘッダ生成部233から出力されたデータを用いて、パケット化処理を行う。
The header generation unit 233 generates a TCP/IP header, a UDP/IP header, and an Ethernet header using the transmission buffer managed by the network buffer management unit 221 based on predetermined header information.
The packet generation unit 234 performs packetization processing using the data output from the data transfer unit 232 and the header generation unit 233.

本実施形態では、セグメント処理部225により決定された送信データのサイズに応じて、通信プロトコル処理部226またはパケット生成部23が、ネットワークバッファ管理部221が管理する送信バッファを用いてパケットを生成する。パケットの生成手法については、図3を用いて後述する。 In this embodiment, the communication protocol processing unit 226 or the packet generation unit 23 generates a packet using the transmission buffer managed by the network buffer management unit 221 according to the size of the transmission data determined by the segment processing unit 225. . The packet generation method will be described later using FIG. 3.

通信プロトコル処理部226またはパケット生成部23により生成されたパケットは、通信I/F制御部24に入力される。通信I/F制御部24は、プロトコルスタック22と通信I/F25との間でデータおよび情報のやり取りを行う。通信I/F25は、図1のMACモジュール113aおよびPHYモジュール113bに対応し、ネットワーク2を介した通信を行う。パケットの送信は、タイマ管理部104により一定時間以上経過したことが通知された場合に行われてもよい。 The packets generated by the communication protocol processing unit 226 or the packet generation unit 23 are input to the communication I/F control unit 24. The communication I/F control unit 24 exchanges data and information between the protocol stack 22 and the communication I/F 25. The communication I/F 25 corresponds to the MAC module 113a and the PHY module 113b in FIG. 1, and performs communication via the network 2. The packet may be transmitted when the timer management unit 104 notifies that a certain period of time or more has elapsed.

バッファ解放通知部261は、パケットが格納されているバッファをネットワークバッファ管理部221が解放する際に、そのバッファの解放をアプリケーション21に通知する。このとき、バッファ解放通知部261は、通信I/F制御部24によって通信I/F25からネットワーク2へパケットが送信された後に、パケットが格納されているバッファの解放をアプリケーション21に通知する。バッファ解放通知部261は、図1のバッファ解放通知部111に対応する。 When the network buffer management unit 221 releases a buffer in which a packet is stored, the buffer release notification unit 261 notifies the application 21 of the release of the buffer. At this time, after the communication I/F control unit 24 transmits the packet from the communication I/F 25 to the network 2, the buffer release notification unit 261 notifies the application 21 of releasing the buffer in which the packet is stored. The buffer release notification unit 261 corresponds to the buffer release notification unit 111 in FIG.

通知設定部262は、バッファ解放通知部261による通知を無効か有効かに設定する。通知設定部262の処理をコールバック関数で実現し、アプリケーション21により通知が有効に登録された場合にバッファ解放を通知し、通知が有効に登録されてない場合にバッファ解放を通知しないようにしてもよい。通知設定部262は、図1の通知設定部112に対応する。 The notification setting unit 262 sets the notification by the buffer release notification unit 261 to be invalid or valid. The processing of the notification setting unit 262 is realized by a callback function, and when the notification is registered as valid by the application 21, the buffer release is notified, and when the notification is not registered as valid, the buffer release is not notified. Good too. The notification setting section 262 corresponds to the notification setting section 112 in FIG.

次に、図3および図4を参照し、図1の通信装置1により行われるデータ送信処理を説明する。図3では、ソケットAPI send()によるデータ送信処理を例にとる。なお、sendto()、sendmsg()、sendmmsg()によるデータ送信処理の場合も、図3と同様の処理を用いることができる。図4では、ソケットAPI send()によるデータ送信処理が完了後、パケット格納用バッファの解放通知処理を説明する。
本実施形態では、ウィンドウサイズを使用するプロトコルのデータ送信処理において、ネットワーク2へパケットの送信完了後、アプリケーション21へパケット格納用バッファ101bの解放通知を行う。
Next, data transmission processing performed by the communication device 1 of FIG. 1 will be described with reference to FIGS. 3 and 4. In FIG. 3, data transmission processing using the socket API send() is taken as an example. Note that the same processing as in FIG. 3 can be used in the case of data transmission processing using sendto(), sendmsg(), and sendmmsg(). In FIG. 4, a packet storage buffer release notification process will be described after the data transmission process using the socket API send( ) is completed.
In this embodiment, in data transmission processing using a protocol using a window size, after the transmission of a packet to the network 2 is completed, the application 21 is notified of the release of the packet storage buffer 101b.

なお、図3および図4の各ステップは、通信装置1の記憶部に記憶されたプログラムをCPU102読み出し、実行することで実現される。また、図3および図4に示すフローチャートの少なくとも一部をハードウェアにより実現してもよい。ハードウェアにより実現する場合、例えば、所定のコンパイラを用いることで、各ステップを実現するためのプログラムからFPGA上に自動的に専用回路を生成すればよい。また、FPGAと同様にしてGate Array回路を形成し、ハードウェアとして実現するようにしてもよい。また、ASICにより実現するようにしてもよい。 Note that each step in FIGS. 3 and 4 is realized by the CPU 102 reading out and executing a program stored in the storage unit of the communication device 1. Furthermore, at least a portion of the flowcharts shown in FIGS. 3 and 4 may be realized by hardware. In the case of implementation using hardware, for example, a dedicated circuit may be automatically generated on the FPGA from a program for implementing each step by using a predetermined compiler. Further, a Gate Array circuit may be formed in the same manner as an FPGA and realized as hardware. Alternatively, it may be realized by ASIC.

この場合、図3および図4に示すフローチャートにおける各ブロックは、ハードウェアブロックとみなすことができる。なお、複数のブロックをまとめて1つのハードウェアブロックとして構成してもよく、1つのブロックを複数のハードウェアブロックとして構成してもよい。 In this case, each block in the flowcharts shown in FIGS. 3 and 4 can be regarded as a hardware block. Note that a plurality of blocks may be configured as one hardware block, or one block may be configured as a plurality of hardware blocks.

図3のS1において、図1のCPU102は、ソケットAPIの呼び出しを行う。より詳しくは、CPU102は、ROM103に格納されている所定のプログラムを実行することに応じて、図2のアプリケーション21は、send()を呼び出す。
CPU102は、send()を呼び出すと、S2において、send()に指定された値が正しいかどうかを判定する。S2の判定結果がNoの場合、S3に処理を進める。S2の判定結果がYesの場合、S4に処理を進める。
In S1 of FIG. 3, the CPU 102 of FIG. 1 calls the socket API. More specifically, in response to the CPU 102 executing a predetermined program stored in the ROM 103, the application 21 in FIG. 2 calls send().
When the CPU 102 calls send(), in S2 it determines whether the value specified in send() is correct. If the determination result in S2 is No, the process advances to S3. If the determination result in S2 is Yes, the process advances to S4.

S3において、CPU102は、指定された値によりエラー番号へEALREADYまたはENOTCONNまたはEFAULTを設定し、-1を返り値にして、処理を終了する。
S4において、データ転送部107は、不図示のユーザバッファからのデータ転送先であるRAM101内の送信バッファへ送信データを転送し、送信データのチャンク化と、送信バッファへの送信データの格納のため、送信データ用バッファを取得する。データ転送部107は、ゼロコピーが指定された場合は、送信データ管理バッファを指定し、ゼロコピーが指定されない場合は、送信データ用バッファを指定し、S5に処理を進める。
In S3, the CPU 102 sets EALREADY, ENOTCONN, or EFAULT to the error number according to the specified value, sets -1 as the return value, and ends the process.
In S4, the data transfer unit 107 transfers the transmission data from the user buffer (not shown) to the transmission buffer in the RAM 101 which is the data transfer destination, chunks the transmission data, and stores the transmission data in the transmission buffer. , get the buffer for sending data. If zero copy is specified, the data transfer unit 107 specifies the transmission data management buffer, and if zero copy is not specified, the data transfer unit 107 specifies the transmission data buffer, and advances the process to S5.

S5において、データ転送部107は、指定したバッファが1つでも確保できたかどうかを判定する。S5の判定結果がNoの場合、S6に処理を進める。S5の判定結果がYesの場合、S7に処理を進める。
S6において、データ転送部107は、指定したバッファが1つも確保できていない場合、エラー番号へENOMEMを設定し、-1を返り値にし、S19に処理を進める。
In S5, the data transfer unit 107 determines whether at least one designated buffer has been secured. If the determination result in S5 is No, the process advances to S6. If the determination result in S5 is Yes, the process advances to S7.
In S6, if no designated buffer has been secured, the data transfer unit 107 sets ENOMEM to the error number, sets -1 as the return value, and advances the process to S19.

S7において、データ転送部107は、不図示のユーザバッファからのデータ転送先であるRAM101内の送信バッファへ送信データを転送し、チャンク化を行い、送信バッファに格納する。なお、データ転送部107は、送信データの格納場所を送信バッファへ格納してもよい。ゼロコピーでsend()が呼び出された場合は、データ転送部107は、ユーザバッファの格納場所の情報を送信バッファへ転送する。
セグメント処理部225は、送信バッファに格納されている送信データのサイズが、ウィンドウ制御部223により管理されている送信ウィンドウサイズを超えるか確認する。セグメント処理部225は、超えている場合は送信バッファに格納されている送信データのサイズを、送信データのサイズとして決定し、超えていない場合は送信ウィンドウサイズを送信データのサイズとして決定し、S8に処理を進める。
In S7, the data transfer unit 107 transfers the transmission data from the user buffer (not shown) to the transmission buffer in the RAM 101, which is the data transfer destination, chunks the data, and stores the chunked data in the transmission buffer. Note that the data transfer unit 107 may store the storage location of the transmission data in the transmission buffer. When send( ) is called with zero copy, the data transfer unit 107 transfers information about the storage location of the user buffer to the send buffer.
The segment processing unit 225 checks whether the size of the transmission data stored in the transmission buffer exceeds the transmission window size managed by the window control unit 223. If the size exceeds, the segment processing unit 225 determines the size of the transmission data stored in the transmission buffer as the size of the transmission data, and if it does not exceed the size, determines the transmission window size as the size of the transmission data, and performs S8. Proceed with the process.

S8において、フレーム生成部108は、TCP/IPヘッダとイーサネットヘッダを生成するための情報としてヘッダ情報を生成し、S9に処理を進める。
S9において、パケット生成部109は、パケットを格納するため、パケット格納用バッファを1つでも確保できたかどうかを判定する。S9の判定結果がNoの場合、S10に処理を進める。S9の判定結果がYesの場合、S11に処理を進める。
S10において、パケット生成部109は、指定したバッファが1つも確保できていない場合は、エラー番号へENOMEMを設定し、-1を返り値にして、S19に処理を進める。
In S8, the frame generation unit 108 generates header information as information for generating a TCP/IP header and an Ethernet header, and proceeds to S9.
In S9, the packet generation unit 109 determines whether at least one packet storage buffer has been secured for storing the packet. If the determination result in S9 is No, the process advances to S10. If the determination result in S9 is Yes, the process advances to S11.
In S10, if no designated buffer has been secured, the packet generation unit 109 sets ENOMEM to the error number, sets -1 as the return value, and advances the process to S19.

S11において、パケット生成にパケット生成オフローダを使用する場合、プロトコルスタック22は、パケット生成部23にパケット生成のデータを設定し実行を行う。このとき、S11において、データ転送部232は、送信データがチャンク化されていない場合にはチャンク化とチェックサム計算を行い、チャンク化されている場合にはチェックサム計算を行う。次に、S11において、ヘッダ生成部233は、S8で生成されたヘッダ情報を使用し、送信データがMSS単位にチャンク化されて得られる各セグメントに対してTCP/IPヘッダとイーサネットヘッダを(自動)生成する。send()が呼び出された際に送信データがRAM101内の送信バッファに転送された場合には、パケット生成によりイーサネットフレーム化される。次に、S11において、パケット生成部234は、データ転送部232とヘッダ生成部233から出力されたデータを用いて、パケット化処理を行う。 In S11, when using the packet generation offloader for packet generation, the protocol stack 22 sets data for packet generation in the packet generation unit 23 and executes it. At this time, in S11, the data transfer unit 232 performs chunking and checksum calculation if the transmission data is not chunked, and performs checksum calculation if it is chunked. Next, in S11, the header generation unit 233 uses the header information generated in S8 to create a TCP/IP header and an Ethernet header (automatically) for each segment obtained by chunking the transmission data in units of MSS. ) generate. If the transmission data is transferred to the transmission buffer in the RAM 101 when send() is called, it is converted into an Ethernet frame by packet generation. Next, in S11, the packet generation unit 234 performs packetization processing using the data output from the data transfer unit 232 and the header generation unit 233.

S12において、パケット生成完了通知部231は、S11で実行されたパケット生成オフローダの処理が完了したかどうかを判定する。S12の判定結果がNoの場合、S12に処理を繰り返し、処理が終了するのを待つ。S12の判定結果がYesの場合、S13に処理を進める。 In S12, the packet generation completion notifying unit 231 determines whether the packet generation offloader process executed in S11 has been completed. If the determination result in S12 is No, the process is repeated to S12 and waits for the process to end. If the determination result in S12 is Yes, the process advances to S13.

S13において、CPU101は、パケット生成によりイーサネットフレーム化されたパケットをネットワークドライバが送信可能かどうかを判定する。S13の判定結果がNoの場合、S14に処理を進める。S13の判定結果がYesの場合、S17に処理を進める。
S14において、CPU101は、ネットワークドライバが送信可能になるまで、送信キューにパケットの追加が可能かどうかを判定する。S14の判定結果がNoの場合、S15に処理を進める。S14の判定結果がYesの場合、S16に処理を進める。
In S13, the CPU 101 determines whether the network driver can transmit the packet that has been converted into an Ethernet frame by packet generation. If the determination result in S13 is No, the process advances to S14. If the determination result in S13 is Yes, the process advances to S17.
In S14, the CPU 101 determines whether packets can be added to the transmission queue until the network driver becomes capable of transmission. If the determination result in S14 is No, the process advances to S15. If the determination result in S14 is Yes, the process advances to S16.

S15において、CPU101は、送信キューにパケットの追加が不可の場合はエラー番号へENOSPCまたはENOBUFSを設定し、-1を返り値にして、S19に処理を進める。
S16において、CPU101は、送信キューにパケットの追加が可能の場合は送信キューにパケットを追加し、S19に処理を進める。
S17において、通信プロトコル処理部226は、ネットワークドライバによりイーサネットフレームを通信I/F制御部24に送信し、S18に処理を進める。
In S15, if the packet cannot be added to the transmission queue, the CPU 101 sets the error number to ENOSPC or ENOBUFS, sets -1 as the return value, and advances the process to S19.
In S16, if the packet can be added to the transmission queue, the CPU 101 adds the packet to the transmission queue, and advances the process to S19.
In S17, the communication protocol processing unit 226 transmits the Ethernet frame to the communication I/F control unit 24 using the network driver, and the process proceeds to S18.

S18において、CPU101は、送信すべき全てのパケットについてパケット生成処理が完了しているか否かを判定する。送信すべき全てのパケットのパケット生成処理が全て完了していない場合は(S18:Yes)、S13に戻る。送信すべき全てのパケットのパケット生成処理が全て完了した場合は(S18:No)、S19に処理を進める。 In S18, the CPU 101 determines whether the packet generation process has been completed for all packets to be transmitted. If the packet generation processing for all packets to be transmitted has not been completed (S18: Yes), the process returns to S13. If the packet generation process for all packets to be transmitted has been completed (S18: No), the process advances to S19.

S19において、CPU101は、送信すべき全てのパケット(S16の送信キューにキューイングされたパケット)が送信されたか、かつ送信エラー(S6、S10およびS15の送信エラーが該当)が発生していないかどうかを判定する。送信すべき全てのパケットが送信され、かつ送信エラーが発生していない場合は(S19:Yes)、S20に処理を進める。送信すべき全てのパケットが送信されていないまたは送信エラーが発生している場合は(S19:No)、S21に処理を進める。
S20において、アプリケーション21は、送信データがあるか判定する。送信データがある場合は(S20:Yes)、図3のデータ送信処理の開始へ戻る。送信データがない場合は(S20:No)、データ送信処理を終了する。
In S19, the CPU 101 checks whether all packets to be transmitted (packets queued in the transmission queue in S16) have been transmitted, and whether a transmission error (the transmission errors in S6, S10, and S15 apply) has occurred. judge whether If all packets to be transmitted have been transmitted and no transmission error has occurred (S19: Yes), the process advances to S20. If all the packets to be transmitted have not been transmitted or a transmission error has occurred (S19: No), the process advances to S21.
In S20, the application 21 determines whether there is data to be transmitted. If there is transmission data (S20: Yes), the process returns to the start of the data transmission process in FIG. If there is no data to send (S20: No), the data sending process ends.

S21において、通知設定部262は、バッファ解放の通知を有効(ON)に設定するか否かを判定する。通知を有効にしない設定は、アプリケーション21により、バッファ解放通知部261に対して、バッファ解放の通知を設定するコールバック関数が未登録とされることで実現する。通知を有効にしない設定は、アプリケーション21により、コールバック関数で通知を無効にする処理で実現してもよい。通知を有効にしない設定では(S21:No)、データ送信処理の開始へ戻る。通知を有効にする設定では(S21:Yes)、S22に処理を進める。
S22において、バッファ解放通知部261は、パケットを格納しているバッファ解放の通知待ちを行う。
In S21, the notification setting unit 262 determines whether to enable (ON) the buffer release notification. The setting to disable the notification is achieved by the application 21 setting the buffer release notification unit 261 to unregister a callback function that sets a buffer release notification. The setting to disable notifications may be implemented by the application 21 through a process of disabling notifications using a callback function. If the notification is not enabled (S21: No), the process returns to the start of the data transmission process. If the notification is set to be enabled (S21: Yes), the process advances to S22.
In S22, the buffer release notification unit 261 waits for notification of release of the buffer storing the packet.

ネットワークドライバがイーサネットフレームを通信I/F制御部24に送信した後、通信部113は、図4の送信完了割り込み処理を開始する。
図4において、S231では、ネットワークドライバは、パケットを格納していたバッファを全て解放し、S232に処理を進める。
After the network driver transmits the Ethernet frame to the communication I/F control unit 24, the communication unit 113 starts the transmission completion interrupt process shown in FIG.
In FIG. 4, in S231, the network driver releases all buffers storing packets, and advances the process to S232.

S232において、パケットを格納していたバッファが全て解放されると、バッファ解放通知部261は、バッファ解放通知機能がONの場合、アプリケーション21へバッファ解放を通知し、S233に処理を進める。なお、バッファ解放通知部261は、バッファ解放通知機能がOFFのときは、アプリケーション21へバッファ解放を通知しない。
S233において、プロトコルスタック22は、送信キューにキューイングされたパケットがあるか否かを判定する。送信キューに送信するパケットが存在する場合は(S233:Yes)、S234に処理を進める。送信キューに送信するパケットが存在しない場合は(S233:No)、S235に処理を進める。
In S232, when all the buffers storing packets are released, the buffer release notification unit 261 notifies the application 21 of the buffer release if the buffer release notification function is ON, and the process proceeds to S233. Note that the buffer release notification unit 261 does not notify the application 21 of buffer release when the buffer release notification function is OFF.
In S233, the protocol stack 22 determines whether there are any packets queued in the transmission queue. If there is a packet to be transmitted in the transmission queue (S233: Yes), the process advances to S234. If there is no packet to be transmitted in the transmission queue (S233: No), the process advances to S235.

S234において、通信I/F制御部24は、バッファ解放通知機能がONの場合、図3のS24の送信完了通知待ちに対して通信プロトコル処理部226へ送信完了を通知し、S235に処理を進める。
S235において、バッファ解放通知部261は、バッファ解放通知機能がONの場合、図3のS22のバッファ解放通知待ちに対してアプリケーション21へバッファ解放を通知し、送信完了割り込み処理を終了する。
In S234, if the buffer release notification function is ON, the communication I/F control unit 24 notifies the communication protocol processing unit 226 of transmission completion in response to the transmission completion notification waiting in S24 of FIG. 3, and advances the process to S235. .
In S235, if the buffer release notification function is ON, the buffer release notification unit 261 notifies the application 21 of buffer release in response to the buffer release notification wait in S22 of FIG. 3, and ends the transmission completion interrupt process.

図3のS24の送信完了通知待ちでは、図4のS234からの送信完了の通知を受けると、通信プロトコル処理部226は、送信処理を開始し、S13に処理を進める。
図3のS22のバッファ解放通知待ちでは、図4のS235からのバッファ解放の通知を受けると、アプリケーション21は、処理を開始し、S23に処理を進める。
S23において、通知設定部262は、バッファ解放の通知を無効(OFF)に設定し、データ送信処理の開始へ戻る。
While waiting for the transmission completion notification in S24 of FIG. 3, upon receiving the transmission completion notification from S234 in FIG. 4, the communication protocol processing unit 226 starts the transmission process and advances the process to S13.
While waiting for the buffer release notification in S22 of FIG. 3, upon receiving the buffer release notification from S235 in FIG. 4, the application 21 starts processing and proceeds to S23.
In S23, the notification setting unit 262 sets the buffer release notification to invalid (OFF), and returns to the start of the data transmission process.

以上説明したように、本実施形態によれば、送信データのセグメント化とTCP/IPヘッダの生成とイーサネットフレーム化を実施するパケット生成処理を行い、ネットワークドライバがイーサネットフレームを通信I/F制御部24に送信する。このとき、バッファ解放通知部は、アプリケーションへバッファ解放を通知することで、プロトコルスタックおよびネットワークドライバが送信可能な状態になり次第、アプリケーションが送信データの送信の要求を再開できる。このため、アプリケーションは、ソケットAPIにて送信されたデータが全て送信できない現象または送信エラーが発生した場合においても、ソケットAPIを定期的にコールし、送信可能かどうかを確認する必要がなくなる。この結果、アプリケーションは、送信可能かどうかの確認の時間間隔が経過する前に、送信データの送信処理を開始でき、通信装置1のパケットの送信効率を向上させることができる。
また、上述した実施形態によれば、バッファ解放の完了通知を状況に応じて有効または無効を設定し、有効の場合にアプリケーションがバッファ解放の完了通知を受けることができる。このため、パケットの正常に送信されている場合には、バッファ解放の完了通知をやり取りするためにかかる負荷を軽減することができ、送信処理の効率を改善することができる。
なお、パケット生成部23のハードウェアによる処理をソフトウェアで実行した場合においても、本実施形態を適用することができる。
As described above, according to the present embodiment, a packet generation process is performed that segments transmission data, generates a TCP/IP header, and converts it into an Ethernet frame, and the network driver transfers the Ethernet frame to the communication I/F control unit. Send to 24th. At this time, the buffer release notification unit notifies the application of the buffer release, so that the application can resume requesting transmission of data as soon as the protocol stack and network driver become ready for transmission. Therefore, even if all the data sent using the socket API cannot be sent or a sending error occurs, the application does not need to periodically call the socket API to check whether data can be sent. As a result, the application can start the transmission process of the transmission data before the time interval for checking whether transmission is possible has elapsed, and the packet transmission efficiency of the communication device 1 can be improved.
Further, according to the embodiment described above, the buffer release completion notification can be set to be enabled or disabled depending on the situation, and when the buffer release completion notification is enabled, the application can receive the buffer release completion notification. Therefore, if the packet is being transmitted normally, the load required for exchanging buffer release completion notifications can be reduced, and the efficiency of the transmission process can be improved.
Note that this embodiment can be applied even when the processing by the hardware of the packet generation unit 23 is executed by software.

なお、本実施形態では、通信I/F25が1つの場合を例にとったが、通信I/Fが複数ある場合にも本実施形態を適用することができる。
また、上述した実施形態では、通知部26のバッファ解放通知部261と通知設定部262の通知処理はコールバック関数を使用したが、オペレーティングシステム(OS)のシステムコール等の他の方法を使用することも可能である。
In addition, in this embodiment, although the case where there is one communication I/F 25 was taken as an example, this embodiment can be applied also when there are multiple communication I/Fs.
Further, in the embodiment described above, the notification processing of the buffer release notification section 261 and the notification setting section 262 of the notification section 26 uses a callback function, but other methods such as a system call of the operating system (OS) may be used. It is also possible.

<実施形態2>
以下、図1、図2、図4および図5を用いて、実施形態2の通信装置による通信処理を説明する。なお、実施形態2において、実施形態1と同様の構成および機能については、同一符号を付して、その詳細な説明は省略し、異なる点についてのみ説明する。実施形態1との相違は、実施形態2では、通信プロトコルとしてUDP(User Datagram Protocol)を使用する。このとき、図2の通信プロトコル処理部226は、UDP/IPヘッダおよびUDP/IPパケットを生成する。
<Embodiment 2>
Communication processing by the communication device of the second embodiment will be described below with reference to FIGS. 1, 2, 4, and 5. In the second embodiment, the same configurations and functions as those in the first embodiment are denoted by the same reference numerals, detailed explanation thereof will be omitted, and only the different points will be explained. The difference from the first embodiment is that the second embodiment uses UDP (User Datagram Protocol) as a communication protocol. At this time, the communication protocol processing unit 226 in FIG. 2 generates a UDP/IP header and a UDP/IP packet.

UDPは、TCP/IPと異なり、ハンドシェイクを省いたコネクションレスのプロトコルである。UDPのデータ転送は、送受信されるデータの順序性の保証がなく、送信先からの確認応答がないため信頼性を保証されない。
しかし、UDPは、通信の処理にかかるコストが少ないため、データが途中で抜け落ちても問題が少ないストリーミングおよび通信処理のオーバーヘッドの軽減が求められるリアルタイムシステム通信で使われることがある。このとき、図2の通知設定部262は、パケットを送信する通信インタフェースの種類により、バッファ解放の通知を無効か有効かに設定することができる。
Unlike TCP/IP, UDP is a connectionless protocol that omits handshaking. In UDP data transfer, there is no guarantee of the order of transmitted and received data, and reliability is not guaranteed because there is no acknowledgment from the destination.
However, since UDP requires less cost for communication processing, it is sometimes used in streaming, where there are fewer problems even if data is dropped during the process, and in real-time system communication, which requires reduction in the overhead of communication processing. At this time, the notification setting unit 262 in FIG. 2 can set the buffer release notification to be invalid or valid depending on the type of communication interface that transmits the packet.

図5は、実施形態2に係る通信装置のデータ送信処理を示すフローチャートである。
図5の処理では、ソケットAPIによる複数データのデータ送信処理を想定している。複数データのデータ送信処理は、例えば、sendmmmsg()によるデータ送信である。
図5の処理では、複数の送信データを一度にソケットAPIで指定するデータ送信処理において、データ送信処理が完了後、パケット格納用バッファの解放通知処理を行う場合を例にとる。
FIG. 5 is a flowchart showing data transmission processing of the communication device according to the second embodiment.
The processing in FIG. 5 assumes data transmission processing of multiple data using the socket API. The data transmission process for multiple data is, for example, data transmission using sendmmmsg().
The process in FIG. 5 takes as an example a case where, in a data transmission process in which a plurality of pieces of transmission data are specified at once using the socket API, a packet storage buffer release notification process is performed after the data transmission process is completed.

図5の処理では、図3の処理のS21およびS23の代わりにS51およびS53を実行し、それ以外の処理は、図3の処理と同様である。
S51において、図2の通知設定部262は、通信インタフェースが有線LANの場合、通知を有効に設定するか否かを判定する。通知を有効にしない設定は、アプリケーション21により、バッファ解放通知部261に対して、バッファ解放の通知を設定するコールバック関数が未登録とされることで実現する。通知を有効にしない設定は、コールバック関数で送信に使用する通信インタフェースが有線LANではない場合に通知を無効にする処理で実現してもよい。通知を有効にしない設定では(S51:No)、データ送信処理の開始へ戻る。通知を有効にする設定では(S51:Yes)、S22に処理を進める。
S53において、通知設定部262は、通信インタフェースが有線LANの場合、通知を無効に設定し、データ送信処理の開始へ戻る。
In the process of FIG. 5, S51 and S53 are executed instead of S21 and S23 of the process of FIG. 3, and the other processes are the same as the process of FIG.
In S51, when the communication interface is a wired LAN, the notification setting unit 262 in FIG. 2 determines whether to enable notification. The setting to disable the notification is achieved by the application 21 setting the buffer release notification unit 261 to unregister a callback function that sets a buffer release notification. The setting to disable notifications may be realized by disabling notifications when the communication interface used for transmission in a callback function is not a wired LAN. If the notification is not enabled (S51: No), the process returns to the start of the data transmission process. If the notification is set to be enabled (S51: Yes), the process advances to S22.
In S53, if the communication interface is a wired LAN, the notification setting unit 262 sets the notification to be invalid, and returns to the start of the data transmission process.

以上説明したように、本実施形態によれば、送信データのセグメント化とUDP/IPヘッダ生成とイーサネットフレーム化を実施するパケット生成処理を行い、ネットワークドライバがイーサネットフレームを通信I/F制御部24に送信する。このとき、バッファ解放通知部は、アプリケーションへバッファ解放を通知することで、プロトコルスタックおよびネットワークドライバが送信可能な状態になり次第、アプリケーションが送信データの送信の要求を再開できる。このため、通信プロトコルとしてUDPを使用した場合においても、通信装置1のパケットの送信効率を向上させることができる。
また、本実施形態によれば、バッファ解放の完了通知を状況に応じて有効または無効を設定し、有効の場合にアプリケーションが完了通知を受けることで、送信処理の効率を改善することができる。
なお、パケット生成部23のハードウェアによる処理をソフトウェアで実行した場合においても、本実施形態を適用することができる。
As described above, according to the present embodiment, a packet generation process that segments transmission data, generates a UDP/IP header, and converts it into an Ethernet frame is performed, and the network driver transfers the Ethernet frame to the communication I/F control unit 24. Send to. At this time, the buffer release notification unit notifies the application of the buffer release, so that the application can resume requesting transmission of data as soon as the protocol stack and network driver become ready for transmission. Therefore, even when UDP is used as the communication protocol, the packet transmission efficiency of the communication device 1 can be improved.
Further, according to the present embodiment, the efficiency of the transmission process can be improved by setting the buffer release completion notification to be enabled or disabled depending on the situation, and when the buffer release completion notification is enabled, the application receives the completion notification.
Note that the present embodiment can be applied even when the processing by the hardware of the packet generation unit 23 is executed by software.

なお、本実施形態では、通信I/F25が1つの場合を例にとったが、通信I/Fが複数ある場合にも本実施形態を適用することができる。
また、上述した実施形態では、通知部26のバッファ解放通知部261と通知設定部262の通知処理はコールバック関数を使用したが、オペレーティングシステムのシステムコール等の他の方法を使用することも可能である。
In addition, in this embodiment, although the case where there is one communication I/F25 was taken as an example, this embodiment can be applied also when there are multiple communication I/Fs.
Furthermore, in the embodiment described above, a callback function is used for notification processing by the buffer release notification section 261 and the notification setting section 262 of the notification section 26, but other methods such as a system call of the operating system can also be used. It is.

また、上述した実施形態では、S51およびS53の処理において、通信インタフェースが有線LANの場合を例にとったが、通信インタフェースが無線LANの場合であってもよい。
また、通信インタフェースが有線LANまたは無線LANに限らず、それ以外の通信インタフェースの種類に基づいて、バッファの解放を通知させるか否かを設定するようにしてもよい。さらに、TCPおよびUDPなどのプロトコルの種類に基づいて、バッファの解放を通知させるか否かを設定するようにしてもよい。
また、上述した実施形態では、S51の判定条件において、「通信インタフェースが有線LAN」の場合を例にとった。これ以外にも、「任意のプロトコル」、「任意のポート番号」、「任意のコネクション」、「任意の宛先IPアドレス」または「任意の送信元IPアドレス」の場合であってもよい。
Further, in the above-described embodiment, in the processing of S51 and S53, the communication interface is a wired LAN, but the communication interface may be a wireless LAN.
Further, the communication interface is not limited to wired LAN or wireless LAN, and whether or not to notify buffer release may be set based on the type of communication interface other than wired LAN or wireless LAN. Furthermore, it may be set whether or not to notify buffer release based on the type of protocol such as TCP and UDP.
Furthermore, in the embodiment described above, the case where "the communication interface is a wired LAN" is taken as an example in the determination condition of S51. In addition to this, it may be "any protocol", "any port number", "any connection", "any destination IP address", or "any source IP address".

<その他の実施形態> <Other embodiments>

本発明は、上述の実施形態の1以上の機能を実現するプログラムを、ネットワークまたは記憶媒体を介してシステムまたは装置に供給してもよい。そして、上述の実施形態の1以上の機能は、そのシステムまたは装置のコンピュータにおける1つ以上のプロセッサがプログラムを読出し実行する処理でも実現可能である。 In the present invention, a program that implements one or more functions of the embodiments described above may be supplied to a system or device via a network or a storage medium. One or more functions of the above-described embodiments can also be realized by a process in which one or more processors in a computer of the system or device read and execute a program.

1:通信装置、3:通信相手装、102:CPU、107:データ転送部、108:フレーム生成部、23、109、234:パケット生成部、113a:MACモジュール置、22:プロトコルスタック、231:パケット生成完了通知部、232:データ転送部、260:通知部、261:バッファ解放通知部、262:通知設定部 1: communication device, 3: communication partner device, 102: CPU, 107: data transfer unit, 108: frame generation unit, 23, 109, 234: packet generation unit, 113a: MAC module placement, 22: protocol stack, 231: Packet generation completion notification unit, 232: Data transfer unit, 260: Notification unit, 261: Buffer release notification unit, 262: Notification setting unit

Claims (12)

送信データを含むパケットをバッファに格納する格納手段と、
前記格納手段に格納された前記パケットを送信する送信手段と、
前記送信手段によって前記パケットが送信された場合に、前記パケットの格納に用いられた前記バッファを解放する解放手段と、
前記バッファの解放を通知させるか否かを設定する設定手段と、
前記解放手段によって前記バッファが解放された場合に、前記設定手段で通知させる設定がされている場合に前記バッファの解放を通知し、通知させない設定がされている場合に前記バッファの開放を通知しない通知手段と、
を備えることを特徴とする通信装置。
storage means for storing packets containing transmission data in a buffer;
a transmitting means for transmitting the packet stored in the storing means;
releasing means for releasing the buffer used to store the packet when the packet is transmitted by the transmitting means;
a setting means for setting whether to notify the release of the buffer;
When the buffer is released by the release means, the release of the buffer is notified if the setting means is set to notify , and the release of the buffer is not notified if the setting is set not to notify. notification means;
A communication device comprising:
前記送信データから前記パケットを生成する生成手段をさらに備えることを特徴とする請求項1に記載の通信装置。 The communication device according to claim 1, further comprising generation means for generating the packet from the transmission data. 前記生成手段は、オフローダを用いて前記パケットを生成することを特徴とする請求項2に記載の通信装置。 3. The communication device according to claim 2, wherein the generating means generates the packet using an offloader. 前記オフローダは、TSO(TCP Segmentation Offload)機能を用いることで、前記パケットを生成することを特徴とする請求項3に記載の通信装置。 4. The communication device according to claim 3, wherein the offloader generates the packet by using a TSO (TCP Segmentation Offload) function. 前記通知手段は、前記送信データの送信を要求したアプリケーションに対して前記バッファの解放を通知することを特徴とする請求項1から4のいずれか1項に記載の通信装置。 5. The communication device according to claim 1, wherein the notification means notifies an application that has requested transmission of the transmission data of the release of the buffer. 前記アプリケーションは、前記通知手段から前記バッファの解放が通知されると、前記送信データの送信の要求を再開することを特徴とする請求項5に記載の通信装置。 6. The communication device according to claim 5, wherein the application resumes requesting the transmission of the transmission data when the notification unit notifies the release of the buffer. 前記設定手段は、ソケットAPI(Application Programming Interface)の返り値に基づいて、前記バッファの解放を通知させるか否かを設定することを特徴とする請求項1から6のいずれか1項に記載の通信装置。 7. The device according to claim 1 , wherein the setting means sets whether or not to notify the release of the buffer based on a return value of a socket API (Application Programming Interface). Communication device. 前記設定手段は、前記送信手段が前記パケットを送信する通信プロトコルの種類に基づいて、前記バッファの解放を通知させるか否かを設定することを特徴とする請求項1から7のいずれか1項に記載の通信装置。 8. The setting means sets whether or not to notify the release of the buffer based on the type of communication protocol by which the transmitting means transmits the packet. The communication device described in . 前記設定手段は、前記パケットを送信する通信インタフェースの種類に基づいて、前記バッファの解放を通知させるか否かを設定することを特徴とする請求項からのいずれか1項に記載の通信装置。 9. The communication method according to claim 1 , wherein the setting means sets whether or not to notify the release of the buffer based on the type of communication interface that transmits the packet. Device. 前記通信インタフェースの種類は、有線LAN(Local Area Network)および無線LANを含むことを特徴とする請求項に記載の通信装置。 10. The communication device according to claim 9 , wherein the type of communication interface includes a wired LAN (Local Area Network) and a wireless LAN. 送信データを含むパケットをバッファに格納するステップと、
前記格納された前記パケットを送信するステップと、
前記パケットが送信された場合に、前記パケットの格納に用いられた前記バッファを解放するステップと、
前記バッファの解放を通知させるか否かを設定するステップと、
前記バッファが解放された場合に、前記設定するステップで通知させる設定がされている場合に前記バッファの解放を通知し、通知させない設定がされている場合に前記バッファの開放を通知しないステップと、
を備えることを特徴とする通信方法。
storing the packet containing the transmission data in a buffer;
transmitting the stored packet;
releasing the buffer used to store the packet when the packet has been transmitted;
a step of setting whether or not to notify the release of the buffer;
When the buffer is released, notifying the release of the buffer if the notification is set in the setting step , and not notifying the release of the buffer if the setting is set not to notify ;
A communication method comprising:
コンピュータを請求項1から10のいずれか1項に記載の通信装置として動作させるためのプログラム。 A program for causing a computer to operate as the communication device according to any one of claims 1 to 10 .
JP2020022229A 2020-02-13 2020-02-13 Communication devices, communication methods and programs Active JP7427464B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2020022229A JP7427464B2 (en) 2020-02-13 2020-02-13 Communication devices, communication methods and programs

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2020022229A JP7427464B2 (en) 2020-02-13 2020-02-13 Communication devices, communication methods and programs

Publications (2)

Publication Number Publication Date
JP2021129201A JP2021129201A (en) 2021-09-02
JP7427464B2 true JP7427464B2 (en) 2024-02-05

Family

ID=77489022

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2020022229A Active JP7427464B2 (en) 2020-02-13 2020-02-13 Communication devices, communication methods and programs

Country Status (1)

Country Link
JP (1) JP7427464B2 (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003304248A (en) 2002-04-09 2003-10-24 Nippon Telegr & Teleph Corp <Ntt> Data transfer method and device
JP2019165423A (en) 2018-03-16 2019-09-26 キヤノン株式会社 Communication device, method for controlling communication device, and program
JP2019165380A (en) 2018-03-20 2019-09-26 株式会社東芝 Transfer control device, transfer control method, and program

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0730611A (en) * 1993-07-09 1995-01-31 Hitachi Ltd Transmission processing method for full-duplex communication

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003304248A (en) 2002-04-09 2003-10-24 Nippon Telegr & Teleph Corp <Ntt> Data transfer method and device
JP2019165423A (en) 2018-03-16 2019-09-26 キヤノン株式会社 Communication device, method for controlling communication device, and program
JP2019165380A (en) 2018-03-20 2019-09-26 株式会社東芝 Transfer control device, transfer control method, and program

Also Published As

Publication number Publication date
JP2021129201A (en) 2021-09-02

Similar Documents

Publication Publication Date Title
US10430374B2 (en) Selective acknowledgement of RDMA packets
CN1698337B (en) Method for Processing TCP Connection Data Using Offloading Unit
CN109936510B (en) Multipath RDMA transport
US9729437B2 (en) Transferring data between a first network node and a second network node by measuring a capability of different communication paths
JP5635117B2 (en) Dynamically connected transport service
CN114520711B (en) Selective retransmission of data packets
CN112631788B (en) Data transmission method and data transmission server
TW200537877A (en) Retransmission system and method for a transport offload engine
CN113687770B (en) System and method for regulating NVMe-oF command requests and data flows across rate-mismatched networks
WO2023109891A1 (en) Multicast transmission method, apparatus and system
WO2005020523A1 (en) Session relay device and relay method
EP2383647A1 (en) Networking system call data division for zero copy operations
CN116233243A (en) A communication system and method in a weak network environment
CN100363922C (en) Systems and methods for bandwidth-delay product independent TCP/IP offload
JP7427464B2 (en) Communication devices, communication methods and programs
CN107273318A (en) Parallel processing device and communication control method
US8150996B2 (en) Method and apparatus for handling flow control for a data transfer
US8854957B2 (en) Packet retransmission control system, packet retransmission control method and retransmission control program
KR100932968B1 (en) How to handle TCPC retransmission by TOE without intervention of host computer
RU2846657C1 (en) Network controller
JP7704287B2 (en) System, method and program for collecting data
JP7831649B2 (en) Apparatus and method for predicting and executing the release of a communication path in advance.
JP2021087172A (en) Communication device, communication method, and program
JP2026005543A (en) Communication device, control method thereof, and program
JP2020178182A (en) Communication equipment, control methods and programs for communication equipment

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20230116

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20231012

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20231024

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20231206

TRDD Decision of grant or rejection written
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 20231226

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20240124

R151 Written notification of patent or utility model registration

Ref document number: 7427464

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R151

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: R3D03