KR20020039492A - Packet processing method - Google Patents

Packet processing method Download PDF

Info

Publication number
KR20020039492A
KR20020039492A KR1020000069330A KR20000069330A KR20020039492A KR 20020039492 A KR20020039492 A KR 20020039492A KR 1020000069330 A KR1020000069330 A KR 1020000069330A KR 20000069330 A KR20000069330 A KR 20000069330A KR 20020039492 A KR20020039492 A KR 20020039492A
Authority
KR
South Korea
Prior art keywords
packet
list
packets
user mode
connection list
Prior art date
Application number
KR1020000069330A
Other languages
Korean (ko)
Inventor
한동훈
Original Assignee
노창환
(주)인젠
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 노창환, (주)인젠 filed Critical 노창환
Priority to KR1020000069330A priority Critical patent/KR20020039492A/en
Publication of KR20020039492A publication Critical patent/KR20020039492A/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/10Packet switching elements characterised by the switching fabric construction
    • H04L49/103Packet switching elements characterised by the switching fabric construction using a shared central buffer; using a shared memory
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • H04L61/2503Translation of Internet protocol [IP] addresses
    • H04L61/256NAT traversal

Abstract

PURPOSE: A method for processing a packet is provided to decrease a load caused by a frequent switching between a kernel mode and a user mode and decrease a processing time. CONSTITUTION: In a method for processing a packet from a kernel mode to a user mode, a shared memory being used in the kernel mode and a user mode is allocated and informed to a kernel mode driver and the shared memory address into a system address(S100). The shared memory area is divided by a packet structure unit, and creates the first linked list(S110). The second linked list is created for storing a packet(S120). If a packet is entered from a network interface card device driver, one space list item is obtained from the first linked list and the packet is copied in the memory area, and the copied packet is inserted in the second linked list(S130a). If packets are accumulated in the second linked list by a repetitious process, the packets are transmitted to a user mode program(S140a). The second linked list is initialized(S150).

Description

패킷 처리방법 {Packet processing method}Packet processing method

본 발명은 패킷 처리방법에 관한 것으로, 네트워크(Network)상에서 커널 모드(Kernel mode)와 유저 모드(User mode) 상호간의 패킷(Packet)처리를 담당하는 프로토콜 드라이버(Protocol driver)의 구현에 관련되는 것이다.The present invention relates to a packet processing method, and relates to the implementation of a protocol driver in charge of packet processing between a kernel mode and a user mode in a network. .

도 1 은 프로토콜(Protocol)의 계층도이다.1 is a hierarchical diagram of a protocol.

도면에서 맨 하단 계층은 링크/네트워크 액세스(Link/Network Access) 계층으로 데이타 전송을 위해 프레그먼트 데이타를 비트형태의 데이타로 만들거나, 비트 형태의 데이타를 프레그먼트 데이타로 조합하는 역할을 한다.The bottom layer in the figure serves to make fragment data into bit data or combine bit data into fragment data for data transmission to the link / network access layer. .

NIC 디바이스 드라이버(Network Interface Card device driver)는 PC나 워크스테이션의 확장 슬롯에 삽입해서 컴퓨터 단말기를 LAN(Local Area Network)에 접속할 수 있도록 하는 카드인 NIC을 제어한다.The network interface card device driver (NIC) controls the NIC, a card that inserts into an expansion slot on a PC or workstation to allow a computer terminal to connect to a local area network (LAN).

도면에서 중간 계층은 네트워크(Network) 계층으로 프레임을 이용하여 통신을 처리하는 계층으로 네트워크가 각 노드에서 보내고 받은 모든 프레임을 조사한다.In the figure, the middle layer is a network layer that processes communication using frames. The middle layer examines all frames sent and received by each node.

NDIS(Network Driver Interface Specification)는 NIC 디바이스 드라이버(Network Interface Card device driver)들을 위하여 표준 인터페이스를 제공한다.The Network Driver Interface Specification (NDIS) provides a standard interface for Network Interface Card device drivers.

NDIS는 NIC 드라이버에서 나오는 패킷을 적절한 프로토콜 스택(Protocol stack)과 매치(Match)시키기 위해 스택이 패킷을 요구할 때까지 스택 하나하나를 폴링한다.NDIS polls the stack one by one until the stack requests the packet to match the packet coming from the NIC driver with the appropriate protocol stack.

도면에서 상단 계층은 트랜스포트(Tranport) 계층으로 네트워크로 연결된 자료의 흐름을 제어한다.In the figure, the upper layer is the transport layer, which controls the flow of networked data.

본 발명 패킷 처리방법은 이 계층의 프로토콜 드라이버를 구현하는 방법에 관련된다.The packet processing method of the present invention relates to a method of implementing a protocol driver of this layer.

도 2 는 종래의 패킷 처리방법에 대한 개요도로서, 네트워크(Network)상에서 커널 모드(Kernel mode)로부터 유저 모드(User mode)로 패킷(Packet)을 처리하는 종래의 통상적인 방법의 일실시예를 도시한 것이다.FIG. 2 is a schematic diagram of a conventional packet processing method, and shows an embodiment of a conventional conventional method of processing a packet from a kernel mode to a user mode in a network. It is.

이 방법은 대기해 있다가 유저 모드 프로그램(User mode program)으로부터 읽기 요청(Read call)이 있으면 커널 모드 프로그램(Kernel mode program)은 NIC 디바이스 드라이버(Network Interface Card device driver)를 통해 입력된 하나의 패킷을 유저 스페이스 버퍼(User space buffer)에 복사하고, 유저 모드 프로그램은 이를 처리한 후 다시 읽기 요청하여 위의 동작을 반복하므로써 커널 모드(Kernel mode)로부터 유저 모드(User mode)로 패킷(Packet)을 처리하게 된다.This method waits, and if there is a read call from the user mode program, the kernel mode program sends one packet input through the network interface card device driver. Is copied to the user space buffer, and the user mode program processes the data and reads it again, repeating the above operation to transfer the packet from kernel mode to user mode. Will be processed.

그러나, 이러한 종래의 패킷 처리방법은 패킷을 복사하는 수만큼의 비동기 프로시져 호출(Asynchronous procedure call)이 이루어지기 때문에 잦은 커널 모드와 유저 모드간의 스위칭(Switching)으로 인한 부담(Overhead)이 높고, 반복되는 패킷 전송도중 패킷을 잃어 버릴(Packet loss) 확률이 높은 문제점이 있었다.However, in the conventional packet processing method, since the number of asynchronous procedure calls are made to copy packets, the overhead due to frequent switching between kernel mode and user mode is high and repeated. There was a problem that there is a high probability of packet loss during packet transmission.

본 발명은 상기와 같은 문제점을 해결하기 위하여 발명된 것으로, 커널 모드와 유저 모드간의 잦은 스위칭으로 인한 부담을 줄일 수 있는 동시에 프로세싱 시간을 단축 시킬 수 있는 패킷 처리방법을 제공함을 그 목적으로 한다.The present invention has been invented to solve the above problems, and an object of the present invention is to provide a packet processing method which can reduce the processing time due to the frequent switching between the kernel mode and the user mode.

본 발명의 또 다른 목적은 패킷 전송시 패킷 손실을 줄일 수 있는 패킷 처리방법을 제공하는 것이다.Still another object of the present invention is to provide a packet processing method that can reduce packet loss during packet transmission.

도 1 은 프로토콜(Protocol)의 계층도.1 is a hierarchical diagram of a protocol.

도 2 는 종래의 패킷 처리방법에 대한 개요도.2 is a schematic diagram of a conventional packet processing method.

도 3 은 본 발명 패킷 처리방법의 개요도.3 is a schematic diagram of a packet processing method of the present invention;

도 4 는 본 발명 패킷 처리방법에서 커널 모드로부터 유저 모드로 패킷을 처리하는 일실시예의 흐름도.4 is a flowchart of an embodiment of processing a packet from kernel mode to user mode in the packet processing method of the present invention.

도 5 는 본 발명 패킷 처리방법에서 유저 모드로부터 커널 모드로 패킷을 처리하는 일실시예의 흐름도.5 is a flowchart of an embodiment of processing a packet from user mode to kernel mode in the packet processing method of the present invention.

상기의 목적을 달성하기 위한 본 발명의 일 양상에 따르면, 본 발명 패킷 처리방법은 커널 모드와 유저 모드가 같이 사용하는 공유 메모리(Shared memory)를 이용하여 코딩(Coding)하되, 이 공유 메모리를 패킷 구조체 단위로 분할하여 연결리스트(Linked list)를 작성하여 패킷을 처리하도록 한 것에 특징이 있다.According to an aspect of the present invention for achieving the above object, the packet processing method of the present invention is coded by using a shared memory (Shared memory) used in the kernel mode and the user mode, the packet is shared It is characterized by creating a linked list by dividing it into structure units to process packets.

본 발명의 부가적인 양상에 따르면, 커널 모드와 유저 모드에서 상기 공유 메모리의 같은 메모리 영역을 동시에 사용하지 않도록 인터록킹(Interlocking)하는 특징이 있다.According to an additional aspect of the present invention, there is a feature of interlocking so as not to simultaneously use the same memory area of the shared memory in kernel mode and user mode.

본 발명을 자세하게 설명하기에 앞서 본 발명에서 사용되는 컴퓨터 및 통신관련 용어에 대해 설명해본다.Before describing the present invention in detail, the computer and communication related terms used in the present invention will be described.

커널(Kernel)은 운영 체제에서 가장 기초적인 시스템 기능을 담당하는 부분으로 프로세스(Process) 관리와 CPU 스케줄링(Sceduling), 입출력 제어, 기억장치 관리 등의 핵심 업무를 맡는다.Kernel is the most basic system function of the operating system. It is responsible for core tasks such as process management, CPU scheduling, I / O control, and storage management.

커널 모드 프로그램(Kernel mode program)은 커널 서비스(Kernel service)와 NIC 드라이버(Network Interface Card driver)를 이용하여 유저 모드 프로그램(User mode program)의 요청을 처리해주는 커널의 일부분으로 동작하는 프로그램이다.Kernel mode program is a program that operates as part of the kernel that processes a user mode program request using a kernel service and a network interface card driver.

유저 모드 프로그램(User mode program)은 커널 모드 프로그램을 이용하여 패킷(Packet)을 받거나 보내고, 또는 NIC 드라이버를 조절하는 프로그램으로, 운영체제(Operating system)하에서 동작하며, 실질적으로 패킷의 내용을 보고 여러가지 작업을 처리한다.A user mode program is a program that receives or sends a packet using a kernel mode program, or controls a NIC driver. The user mode program operates under an operating system, and actually looks at the contents of a packet and performs various tasks. To deal with.

패킷(Packet)은 데이타(Data) 전송에서 사용하는 데이타의 묶음을 말한다. 각각의 패킷은 일정한 크기의 데이타뿐만 아니라 데이타의 수신처, 주소 또는 제어코드 등의 제어정보까지 포함하고 있다.A packet is a bundle of data used in data transmission. Each packet contains not only a certain amount of data but also control information such as a data destination, an address, or a control code.

연결 리스트(Linked list)는 선형 리스트(linear list)에 해당하는 자료구조의 하나로, 리스트의 각 노드(Node)는 데이타(Data) 부분과 링크(Link) 부분으로 구성되며, 링크는 리스트에서 다음 노드를 가리키는 포인터 값을 가진다.A linked list is a data structure that corresponds to a linear list. Each node in the list consists of a data part and a link part. The link is the next node in the list. It has a pointer value.

주소 변환(Address translation)은 프로그램을 메모리(Memory)에 로드할 때 명령어나 자료의 주소를 그것이 로드되거나 또는 재배치될 주메모리의 주소로 변환하는 것을 말한다.Address translation refers to the translation of the address of an instruction or data into the address of main memory where it is loaded or relocated when the program is loaded into memory.

즉, 자료 항목 또는 명령의 가상 기억 주소를 주메모리의 실제 주소로 변환하는 것이다.That is, the virtual memory address of a data item or command is converted into the actual address of main memory.

공유 메모리(Shared memory)는 여러 프로세서(Processor)가 공유하여 사용하는 메모리를 말한다.Shared memory refers to memory shared by multiple processors.

인터록킹(Interlocking)은 한 프로세서 또는 사용자가 사용하고 있는 하드웨어(Hardware) 또는 소프트웨어(Software)를 다른 프로세서 또는 사용자가 건드리지 못하도록 막는 것을 말한다Interlocking refers to preventing another processor or user from touching one processor or hardware or software being used by the user.

이하, 첨부된 도면을 참조하여 기술되는 본 발명의 바람직한 실시예를 통해 본 발명을 당업자가 용이하게 이해하고 재현할 수 있도록 상세히 설명한다.Hereinafter, the present invention will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily understand and reproduce the present invention.

도 3 은 본 발명 패킷 처리방법의 개요도로서, 네트워크(Network)상에서 커널 모드(Kernel mode)로부터 유저 모드(User mode)로 패킷(Packet)을 처리하는 개요를 설명한 것이다.FIG. 3 is a schematic diagram of a packet processing method of the present invention and illustrates an overview of processing a packet from a kernel mode to a user mode in a network.

본 발명 방법은 대기해 있다가 유저 모드 프로그램(User mode program)으로부터 읽기 요청(Read call)이 있으면 커널 모드 프로그램(Kernel mode program)은NIC 디바이스 드라이버(Network Interface Card device driver)를 통해 입력된 패킷을 저장한 링크 리스트(Linked list)로부터 소정의 패킷들을 유저 스페이스 버퍼(User space buffer)에 복사하고, 유저 모드 프로그램은 이를 처리한 후 다시 읽기 요청하여 위의 동작을 반복하므로써 커널 모드(Kernel mode)로부터 유저 모드(User mode)로 패킷(Packet)을 처리하게 된다.The method of the present invention waits and if a read call is received from a user mode program, the kernel mode program receives a packet inputted through a NIC (Network Interface Card device driver). Copy certain packets from the stored linked list to the user space buffer, and the user mode program processes them and then reads them again and repeats the above operation from kernel mode. The packet is processed in the user mode.

즉, 본 발명 방법은 패킷 전송시 하나의 패킷을 처리하여 반복하는 것이 아니라, 다수의 패킷을 소정의 패킷 단위로 처리하여 반복하는 것이다.That is, the present invention does not process and repeat one packet during packet transmission, but processes and repeats a plurality of packets in predetermined packet units.

도 4 는 본 발명에 따른 패킷 처리방법에서 커널 모드로부터 유저 모드로 패킷을 처리하는 일실시예의 흐름도이다.4 is a flowchart of an embodiment of processing a packet from kernel mode to user mode in the packet processing method according to the present invention.

본 발명의 일 양상에 따른 패킷 처리방법은 커널 모드(Kernel mode)로부터 유저 모드(User mode)로 패킷(Packet)을 처리하는 방법으로, 패킷 버퍼(Packet buffer)로 사용할 상기 커널 모드 및 유저 모드에서 동시에 사용하는 공유 메모리(Shared memory)를 할당하여 커널 모드 드라이버(Kernel mode driver)에 알리고, 상기 공유 메모리 주소를 시스템 주소로 변환하는 메모리 할당 단계(S100)와;A packet processing method according to an aspect of the present invention is a method of processing a packet from a kernel mode to a user mode, in the kernel mode and the user mode to be used as a packet buffer. A memory allocation step (S100) of allocating a shared memory to be used simultaneously and informing a kernel mode driver, and converting the shared memory address into a system address;

상기 공유 메모리 영역을 패킷 구조체 단위로 분할하여 제 1 연결 리스트(Linked list)를 생성하는 제 1 연결 리스트 생성단계(S110)와;Generating a first linked list by dividing the shared memory area by a packet structure unit (S110);

패킷 저장을 위한 제 2 연결 리스트를 생성하는 제 2 연결 리스트 생성단계(S120)와;A second connection list generation step (S120) of generating a second connection list for packet storage;

NIC 디바이스 드라이버(Network Interface Card device driver)로부터 패킷이 들어오면, 상기 제 1 연결 리스트로부터 하나의 빈 리스트 항목을 얻어 그 메모리 영역에 패킷을 복사한 후, 상기 제 2 연결 리스트에 삽입하는 패킷 저장단계(S130a)와;When a packet is received from a NIC (Network Interface Card device driver), a packet storing step of obtaining an empty list item from the first connection list, copying the packet to the memory area, and inserting the packet into the second connection list. (S130a);

상기 패킷 저장단계(S130a)의 반복에 의해 상기 제 2 연결 리스트에 소정의 패킷이 쌓이게 되면 유저 모드 프로그램으로 이 패킷들을 전달하는 패킷 전달단계(S140a)와;A packet forwarding step (S140a) of forwarding the packets to a user mode program when predetermined packets are accumulated in the second connection list by repeating the packet storing step (S130a);

상기 제 2 연결 리스트를 초기화하는 초기화단계(S150)를 포함한다.And an initialization step S150 of initializing the second connection list.

이 실시예는 패킷 버퍼(Packet buffer)로 사용할 상기 커널 모드 및 유저 모드에서 동시에 사용하는 공유 메모리(Shared memory)를 할당하고, 상기 커널 모드 드라이버(Kernel mode driver)에 상기 공유 메모리 할당을 알리고, 상기 공유 메모리 주소를 시스템 주소로 변환한다.This embodiment allocates shared memory used simultaneously in the kernel mode and the user mode to be used as a packet buffer, informs the kernel mode driver of the shared memory allocation, and Convert shared memory address to system address.

한편, 상기 공유 메모리 영역을 패킷 구조체 단위로 분할하여 제 1 연결 리스트(Linked list)를 생성하고, 패킷 저장을 위한 제 2 연결 리스트를 생성한다.Meanwhile, the shared memory area is divided into packet structure units to generate a first linked list, and a second linked list for packet storage.

NIC 디바이스 드라이버(Network Interface Card device driver)로부터 패킷이 들어오면, 상기 제 1 연결 리스트로부터 하나의 빈 리스트 항목을 얻어 그 메모리 영역에 패킷을 복사한 후, 상기 제 2 연결 리스트에 삽입하는 것을 반복하여 상기 제 2 연결 리스트에 소정의 패킷이 쌓이게 되면 유저 모드 프로그램으로 이 패킷들을 전달하고 상기 제 2 연결 리스트를 초기화하여 한 주기의 패킷 전송을 종료한다.When a packet comes in from a NIC (Network Interface Card device driver), one empty list item is obtained from the first connection list, the packet is copied to the memory area, and the packet is repeatedly inserted into the second connection list. When a predetermined packet is accumulated in the second connection list, the packets are delivered to a user mode program, and the second connection list is initialized to terminate one cycle of packet transmission.

도 5 는 본 발명에 따른 패킷 처리방법에서 유저 모드로부터 커널 모드로 패킷을 처리하는 일실시예의 흐름도이다.5 is a flowchart of an embodiment of processing a packet from a user mode to a kernel mode in the packet processing method according to the present invention.

본 발명의 일 양상에 따른 패킷 처리방법은 유저 모드(User mode)로부터 커널 모드(Kernel mode)로 패킷(Packet)을 처리하는 방법으로, 패킷 버퍼(Packet buffer)로 사용할 상기 커널 모드 및 유저 모드에서 동시에 사용하는 공유 메모리(Shared memory)를 할당하여 커널 모드 드라이버(Kernel mode driver)에 알리고, 상기 공유 메모리 주소를 시스템 주소로 변환하는 메모리 할당 단계(S100)와;A packet processing method according to an aspect of the present invention is a method of processing a packet from a user mode to a kernel mode, in the kernel mode and a user mode to be used as a packet buffer. A memory allocation step (S100) of allocating a shared memory to be used simultaneously and informing a kernel mode driver, and converting the shared memory address into a system address;

상기 공유 메모리 영역을 패킷 구조체 단위로 분할하여 제 1 연결 리스트(Linked list)를 생성하는 제 1 연결 리스트 생성단계(S110)와;Generating a first linked list by dividing the shared memory area by a packet structure unit (S110);

패킷 저장을 위한 제 2 연결 리스트를 생성하는 제 2 연결 리스트 생성단계(S120)와;A second connection list generation step (S120) of generating a second connection list for packet storage;

유저 모드 프로그램(User mode program)으로부터 패킷이 들어오면, 상기 제 1 연결 리스트로부터 하나의 빈 리스트 항목을 얻어 그 메모리 영역에 패킷을 복사한 후, 상기 제 2 연결 리스트에 삽입하는 패킷 저장단계(S130b)와;When a packet is received from a user mode program, a packet storing step of obtaining one empty list item from the first connection list, copying the packet to the memory area, and inserting the packet into the second connection list (S130b) )Wow;

상기 패킷 저장단계(S130b)의 반복에 의해 상기 제 2 연결 리스트에 소정의 패킷이 쌓이게 되면 커널 모드 프로그램으로 이 패킷들을 전달하는 패킷 전달단계(S140b)와;A packet forwarding step (S140b) of forwarding the packets to a kernel mode program when predetermined packets are accumulated in the second connection list by repeating the packet storing step (S130b);

상기 제 2 연결 리스트를 초기화하는 초기화단계(S150)를 포함한다.And an initialization step S150 of initializing the second connection list.

이 실시예는 패킷 버퍼(Packet buffer)로 사용할 상기 커널 모드 및 유저 모드에서 동시에 사용하는 공유 메모리(Shared memory)를 할당하고, 상기 커널 모드드라이버(Kernel mode driver)에 상기 공유 메모리 할당을 알리고, 상기 공유 메모리 주소를 시스템 주소로 변환한다.This embodiment allocates shared memory used simultaneously in the kernel mode and the user mode to be used as a packet buffer, informs the kernel mode driver of the shared memory allocation, and Convert shared memory address to system address.

상기 공유 메모리 영역을 패킷 구조체 단위로 분할하여 제 1 연결 리스트(Linked list)를 생성하고, 패킷 저장을 위한 제 2 연결 리스트를 생성한다.The shared memory area is divided into packet structure units to generate a first linked list and a second linked list for packet storage.

유저 모드 프로그램(User mode program)으로부터 패킷이 들어오면, 상기 제 1 연결 리스트로부터 하나의 빈 리스트 항목을 얻어 그 메모리 영역에 패킷을 복사한 후, 상기 제 2 연결 리스트에 삽입하는 것을 반복하여 상기 제 2 연결 리스트에 소정의 패킷이 쌓이게 되면 커널 모드 프로그램으로 이 패킷들을 전달하고 상기 제 2 연결 리스트를 초기화하여 한 주기의 패킷 전송을 종료한다.When a packet comes in from a user mode program, one empty list item is obtained from the first linked list, the packet is copied to the memory area, and the packet is repeatedly inserted into the second linked list. When a predetermined packet is accumulated in the second connection list, the packets are delivered to a kernel mode program, and the second connection list is initialized to end packet transmission in one cycle.

즉, 본 발명 방법에 따르면, 기존과는 달리 커널 모드와 유저 모드에서 같이 사용하는 공유 메모리를 이용하므로써 커널 모드와 유저 모드 상호간의 주소변환(Address Translation)을 공유 메모리를 구성할 때 한번만 해주면 그 주소를 이용하여 추가적인 주소변환 없이 양쪽에서 액세스 할 수 있게 된다.That is, according to the method of the present invention, the address translation between the kernel mode and the user mode is performed only once when the shared memory is configured by using the shared memory that is used together in the kernel mode and the user mode. It can be accessed from both sides without additional address translation.

공유 메모리를 사용하지 않는 기존의 방법은 패킷 하나를 처리할 때마다 커널 모드와 유저 모드 상호간의 주소변환을 해주어야만 했다.Conventional methods that do not use shared memory require address translation between kernel mode and user mode each time a packet is processed.

부가적으로 본 발명 패킷 처리방법은 상기 패킷 저장단계(S1340a)(S130b)에서의 상기 제 2 연결 리스트에 패킷 삽입시 연결 리스트가 뒤섞이지 않도록 인터록킹(Interlocking)하고, 상기 패킷 전달단계(S140a)(S140b)에서 패킷 전달시 상기 제 2 연결 리스트가 공유 메모리를 사용하는 배열의 형태이므로 메모리 주소를 전달할 필요없이 배열의 처음과 끝의 인덱스(Index)를 전달하는 것을 특징으로 한다.In addition, the packet processing method of the present invention may interlock to prevent the connection list from being mixed when the packet is inserted into the second connection list in the packet storing step (S1340a) (S130b), and the packet forwarding step (S140a). In operation S140b, since the second connection list is in the form of an array using shared memory, indexes of the beginning and the end of the array may be transferred without having to transfer a memory address.

본 발명에서 공유 메모리를 사용하는데 있어서 가장 문제가 되는 점은 커널 모드와 유저 모드에서 같은 공유 메모리(Shared memory) 영역을 동시에 사용하지 못하도록 인터록킹(Interlocking) 해 주는 문제인데, 커널 모드와 유저 모드에서 록(Lock)을 걸기는 매우 어렵기 때문에 연결 리스트(Linked list)를 사용하여 메모리 주소(Memory address)를 사용하지 않고 배열의 인덱스를 사용하도록 하므로써 이를 해결하였다.The most problem in using the shared memory in the present invention is the problem of interlocking to prevent simultaneous use of the same shared memory area in kernel mode and user mode. Because locking is very difficult, we solved this by using a linked list to use the index of the array instead of the memory address.

부가적으로 본 발명 패킷 처리방법은 상기 패킷 전달단계(S140a)(S140b)에서 상기 제 2 연결 리스트내에 삽입된 패킷의 전달횟수가 삽입되는 패킷 갯수에 비해 적은 것을 특징으로 한다.In addition, the packet processing method of the present invention is characterized in that the number of delivery times of the packets inserted in the second connection list in the packet forwarding step S140a or S140b is less than the number of packets to be inserted.

즉, 상기 제 2 연결 리스트의 패킷이 유저 모드로 자주 전달될 경우 기존 방식과 마찬가지로 많은 부담(Overhead)이 걸리게 되므로 제 2 연결 리스트내에 삽입된 패킷의 전달횟수가 삽입되는 패킷 갯수에 비해 적어야 한다.In other words, if the packets of the second connection list are frequently delivered in the user mode, a lot of overhead is applied as in the conventional method, so the number of delivery of the packets inserted in the second connection list should be less than the number of packets to be inserted.

다만, 패킷의 전달횟수가 너무 작아지게 될 경우, 유저 모드 프로그램의 지연(Delay)이 커지게 되고, 많은 수의 패킷을 연결 리스트에 유지하고 있어야 하기 때문에 공유 메모리이 요구량이 증가하게 되므로 패킷의 전달횟수를 적정하게 설정할 필요가 있다.However, if the number of packet delivery becomes too small, the delay of the user mode program becomes large, and the number of packet delivery is increased because the demand for shared memory increases because a large number of packets must be maintained in the connection list. Needs to be set appropriately.

200Mbps의 트래픽(Traffic)을 처리하는 것이 목표라면, 패킷(Packet) 수는 다음과 같다.If the goal is to handle 200Mbps traffic, the number of packets is as follows.

평균적으로 300byte의 패킷이 흐른다고 가정할 때,Assuming that 300 bytes of packets flow on average,

(200×1024×1024)(bps) / 8(bit/byte) / 300(byte/packet)(200 × 1024 × 1024) (bps) / 8 (bit / byte) / 300 (byte / packet)

= 87380 packet second= 87380 packet second

그런데, 패킷의 최대 크기는 이더넷(Ethernet)의 경우 1514byte이므로. 최대 크기를 기준으로 계산을 하면, 약 126MB 정도의 공유 메모리가 필요하다. 실제로는 처리하는데 필요한 메모리가 있기 때문에 이것의 2배로 보는 것이 타당하다.By the way, the maximum size of the packet is 1514 bytes in the case of Ethernet. Based on the maximum size, about 126MB of shared memory is required. In fact, it's reasonable to see twice that, since there's the memory needed to process it.

현재 컴퓨터 환경을 기준으로 약 100회/초의 속도로 유저 모드에 전달해 주는 것이 이상적이다.Based on the current computer environment, it is ideal to deliver the user mode at a rate of about 100 times / second.

부가적으로 본 발명 패킷 처리방법은 상기의 패킷 전달횟수를 적정하게 조절하기 위하여 다음과 같은 방식으로 패킷 전달 주기를 조절한다.In addition, the packet processing method of the present invention adjusts the packet delivery period in the following manner in order to appropriately adjust the number of packet delivery times.

첫째는, 상기 패킷 전달단계(S140a)(S140b)에서 제 2 연결 리스트의 패킷 전달시 커널에서 제공하는 클럭(Clock)을 사용하여 이전 패킷 전달시의 마지막 전달로부터 이전 패킷 전달시 전달한 패킷 수치 만큼의 시간이 흐른 후 제 2 연결리스트의 패킷을 전달하도록 하여 전달주기를 조절하는 방식이다.First, in the packet forwarding step (S140a) (S140b), by using a clock provided by the kernel when delivering a packet of the second connection list, the number of packets delivered when the previous packet is forwarded from the last delivery when the previous packet is forwarded. After the passage of time, the delivery cycle is controlled by transmitting packets of the second connection list.

즉, 이 방식은 일정 시간마다 패킷을 전달하도록 하는 것이다.In other words, this method allows a packet to be delivered every predetermined time.

둘째는, 상기 패킷 전달단계(S140a)(S140b)에서 제 2 연결 리스트의 길이가 커널 모드 프로그램에 전달한 패킷의 수치에 이를 경우엔 유저 모드로, 제 2 연결 리스트의 길이가 유저 모드 프로그램에 전달한 패킷의 수치에 이를 경우엔 커널 모드로 제 2 연결리스트의 패킷을 전달하도록 하여 전달주기를 조절하는 방식이다.Second, in the packet delivery step (S140a) (S140b), if the length of the second connection list reaches the value of the packet transmitted to the kernel mode program, the packet is the user mode, and the length of the second connection list is transmitted to the user mode program. In the case of reaching the value of, the packet transmission of the second connection list in the kernel mode is controlled.

즉, 이 방식은 일정 갯수마다 패킷을 전달하도록 하는 것이다.In other words, this method is to deliver packets every certain number.

한편, 상기의 패킷 전달 주기를 조절하는 방법으로 커널 모드 프로그램 또는 유저 모드 프로그램에 시간주기 또는 패킷수를 전달하는 방식을 사용할 수 도 있다.On the other hand, as a method for adjusting the packet delivery period may be a method of transmitting a time period or the number of packets to a kernel mode program or a user mode program.

이 방식은 프로토콜 드라이버(Protocol driver)에 특수한 프로그램 함수(Program Function)를 통해 인자를 전달하므로써 패킷 전달 주기를 조절하는 방식으로, 이 방식은 언어 프로그램(Language program) 수단을 통해 다양하게 실시할 수 있으므로 자세한 설명은 생략하고자 한다.This method adjusts the packet delivery cycle by passing arguments through a special program function to the protocol driver. This method can be implemented in various ways through language program means. Detailed description will be omitted.

따라서, 상기한 바와 같은 본 발명 패킷 처리방법을 통해서 NIC 드라이버(Network interface card driver)와 상호교류(Interaction)를 통하여 패킷(Packet)을 보내고 받으며, NIC(Network Interface Card)를 제어하는 프로토콜 드라이버(Protocol driver)를 구현할 수 있게 된다.Therefore, a protocol driver for controlling a network interface card (NIC) by sending and receiving a packet through an interaction with a network interface card driver (NIC) through the packet processing method as described above. driver).

더나아가 암호화 알고리듬을 적용하여 상기의 패킷 전송시 암호화처리하여 패킷을 전송하면 보안 차원에서도 매우 유용하다.In addition, it is very useful in terms of security if the encryption algorithm is applied to transmit the packet by encrypting the packet during transmission.

따라서, 상기와 같은 방법을 통해 위에서 제시한 본 발명의 목적을 달성하게 된다.Therefore, the above object to achieve the object of the present invention.

이상에서 설명한 바와같이 본 발명은 커널 모드와 유저 모드 상호간의 주소변환(Address translation)을 공유 메모리를 구성할 때 한번만 해주면 그 주소를 이용하여 추가적인 주소변환 없이 양쪽에서 액세스 할 수 있도록 하여 커널 모드와 유저 모드간의 잦은 스위칭으로 인한 부담을 줄일 수 있는 동시에 프로세싱 시간을 단축 시킬 수 있고, 패킷 전송시 패킷 손실을 줄일 수 있는 매우 유용한 효과가 있다.As described above, the present invention allows address translation between kernel mode and user mode only once when configuring shared memory so that both addresses can be accessed without additional address translation by using the address. This can reduce the burden of frequent switching between modes, reduce processing time, and reduce packet loss during packet transmission.

본 발명은 첨부된 도면을 참조하여 바람직한 실시예를 중심으로 기술되었지만 당업자라면 이러한 기재로부터 후술하는 특허청구범위에 의해 포괄되는 본 발명의 범주를 벗어남이 없이 다양한 변형이 가능하다는 것은 명백하다.Although the present invention has been described with reference to the accompanying drawings, it will be apparent to those skilled in the art that various modifications may be made therein without departing from the scope of the invention, which is covered by the following claims.

Claims (7)

커널 모드(Kernel mode)로부터 유저 모드(User mode)로 패킷(Packet)을 처리하는 방법에 있어서,In the method of processing a packet from a kernel mode (Kernel mode) to a user mode (User mode), 패킷 버퍼(Packet buffer)로 사용할 상기 커널 모드 및 유저 모드에서 동시에 사용하는 공유 메모리(Shared memory)를 할당하여 커널 모드 드라이버(Kernel mode driver)에 알리고, 상기 공유 메모리 주소를 시스템 주소로 변환하는 메모리 할당 단계와;Allocate shared memory used simultaneously in the kernel mode and the user mode to be used as a packet buffer to inform a kernel mode driver, and allocate a memory to convert the shared memory address into a system address. Steps; 상기 공유 메모리 영역을 패킷 구조체 단위로 분할하여 제 1 연결 리스트(Linked list)를 생성하는 제 1 연결 리스트 생성단계와;Generating a first linked list by dividing the shared memory area by a packet structure unit; 패킷 저장을 위한 제 2 연결 리스트를 생성하는 제 2 연결 리스트 생성단계와;Generating a second linked list for generating a second linked list for storing packets; NIC 디바이스 드라이버(Network Interface Card device driver)로부터 패킷이 들어오면, 상기 제 1 연결 리스트로부터 하나의 빈 리스트 항목을 얻어 그 메모리 영역에 패킷을 복사한 후, 상기 제 2 연결 리스트에 삽입하는 패킷 저장단계와;When a packet is received from a NIC (Network Interface Card device driver), a packet storing step of obtaining an empty list item from the first connection list, copying the packet to the memory area, and inserting the packet into the second connection list. Wow; 상기 패킷 저장단계의 반복에 의해 상기 제 2 연결 리스트에 소정의 패킷이 쌓이게 되면 유저 모드 프로그램으로 이 패킷들을 전달하는 패킷 전달단계와;A packet forwarding step of forwarding the packets to a user mode program when predetermined packets are accumulated in the second connection list by repeating the packet storing step; 상기 제 2 연결 리스트를 초기화하는 초기화단계를 포함하는 것을 특징으로 하는 패킷 처리방법.And an initialization step of initializing the second connection list. 유저 모드(User mode)로부터 커널 모드(Kernel mode)로 패킷(Packet)을 처리하는 방법에 있어서,In the method for processing a packet from the user mode (User mode) to kernel mode (Kernel mode), 패킷 버퍼(Packet buffer)로 사용할 상기 커널 모드 및 유저 모드에서 동시에 사용하는 공유 메모리(Shared memory)를 할당하여 커널 모드 드라이버(Kernel mode driver)에 알리고, 상기 공유 메모리 주소를 시스템 주소로 변환하는 메모리 할당 단계와;Allocate shared memory used simultaneously in the kernel mode and the user mode to be used as a packet buffer to inform a kernel mode driver, and allocate a memory to convert the shared memory address into a system address. Steps; 상기 공유 메모리 영역을 패킷 구조체 단위로 분할하여 제 1 연결 리스트(Linked list)를 생성하는 제 1 연결 리스트 생성단계와;Generating a first linked list by dividing the shared memory area by a packet structure unit; 패킷 저장을 위한 제 2 연결 리스트를 생성하는 제 2 연결 리스트 생성단계와;Generating a second linked list for generating a second linked list for storing packets; 유저 모드 프로그램(User mode program)으로부터 패킷이 들어오면, 상기 제 1 연결 리스트로부터 하나의 빈 리스트 항목을 얻어 그 메모리 영역에 패킷을 복사한 후, 상기 제 2 연결 리스트에 삽입하는 패킷 저장단계와;A packet storing step of, when a packet comes from a user mode program, obtains one empty list item from the first linked list, copies the packet to the memory area, and inserts the packet into the second linked list; 상기 패킷 저장단계의 반복에 의해 상기 제 2 연결 리스트에 소정의 패킷이 쌓이게 되면 커널 모드 프로그램으로 이 패킷들을 전달하는 패킷 전달단계와;A packet forwarding step of forwarding the packets to a kernel mode program when predetermined packets are accumulated in the second connection list by repeating the packet storing step; 상기 제 2 연결 리스트를 초기화하는 초기화단계를 포함하는 것을 특징으로 하는 패킷 처리방법.And an initialization step of initializing the second connection list. 제 1 항 또는 제 2 항에 있어서,The method according to claim 1 or 2, 상기 패킷 저장단계에서의 상기 제 2 연결 리스트에 패킷 삽입시 연결 리스트가 뒤섞이지 않도록 인터록킹(Interlocking)하는 것을 특징으로 하는 패킷 처리전달방법.And interlocking the insertion list so that the connection list is not mixed when the packet is inserted into the second connection list in the packet storing step. 제 1 항 또는 제 2 항에 있어서,The method according to claim 1 or 2, 상기 패킷 전달단계에서 패킷 전달시 상기 제 2 연결 리스트가 공유 메모리를 사용하는 배열의 형태이므로 메모리 주소를 전달할 필요없이 배열의 처음과 끝의 인덱스(Index)를 전달하는 것을 특징으로 하는 패킷 처리방법.In the packet forwarding step, since the second connection list is in the form of an array using a shared memory, the first and the end indexes of the array are transmitted without transmitting a memory address. 제 1 항 또는 제 2 항에 있어서,The method according to claim 1 or 2, 상기 패킷 전달단계에서 상기 제 2 연결 리스트내에 삽입된 패킷의 전달횟수가 삽입되는 패킷 갯수에 비해 적은 것을 특징으로 하는 패킷 처리방법.And a number of delivery times of packets inserted in the second connection list in the packet delivery step is smaller than the number of packets to be inserted. 제 1 항 또는 제 2 항에 있어서,The method according to claim 1 or 2, 상기 패킷 전달단계에서 제 2 연결 리스트의 패킷 전달시 커널에서 제공하는 클럭을 사용하여 이전 패킷 전달시의 마지막 전달로부터 이전 패킷 전달시 전달한 패킷 수치 만큼의 시간이 흐른 후 제 2 연결리스트의 패킷을 전달하도록 전달주기를 조절하는 것을 특징으로 하는 패킷 처리방법.In the packet forwarding step, a packet of the second connection list is delivered after a time equal to the packet number delivered in the previous packet delivery from the last delivery in the previous packet delivery using the clock provided by the kernel when delivering the packet in the second connection list. Packet processing method, characterized in that for adjusting the delivery period. 제 1 항 또는 제 2 항에 있어서,The method according to claim 1 or 2, 상기 패킷 전달단계에서 제 2 연결 리스트의 길이가 커널 모드 프로그램에전달한 패킷의 수치에 이를 경우엔 유저 모드로, 제 2 연결 리스트의 길이가 유저 모드 프로그램에 전달한 패킷의 수치에 이를 경우엔 커널 모드로 제 2 연결리스트의 패킷을 전달하도록 전달주기를 조절하는 것을 특징으로 하는 패킷 처리방법.In the packet forwarding step, if the length of the second connection list reaches the number of packets delivered to the kernel mode program, the user mode; if the length of the second connection list reaches the number of packets delivered to the user mode program, the kernel mode; Adjusting the delivery period to deliver the packets of the second connection list packet processing method.
KR1020000069330A 2000-11-21 2000-11-21 Packet processing method KR20020039492A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020000069330A KR20020039492A (en) 2000-11-21 2000-11-21 Packet processing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020000069330A KR20020039492A (en) 2000-11-21 2000-11-21 Packet processing method

Publications (1)

Publication Number Publication Date
KR20020039492A true KR20020039492A (en) 2002-05-27

Family

ID=19700356

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020000069330A KR20020039492A (en) 2000-11-21 2000-11-21 Packet processing method

Country Status (1)

Country Link
KR (1) KR20020039492A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20040009225A (en) * 2002-07-23 2004-01-31 엘지엔시스(주) Method of network packet checking by kernel hooking
KR101040897B1 (en) * 2009-07-14 2011-06-16 국성식 Rubber label and manufacturing method thereof
KR101350333B1 (en) * 2009-11-03 2014-01-10 한국전자통신연구원 network emulation system and method for on-line server test processing heavy traffic
CN110149262A (en) * 2019-04-02 2019-08-20 视联动力信息技术股份有限公司 A kind for the treatment of method and apparatus and storage medium of signaling message

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5778180A (en) * 1995-11-06 1998-07-07 Sun Microsystems, Inc. Mechanism for reducing data copying overhead in protected memory operating systems
KR19980073517A (en) * 1997-03-15 1998-11-05 김광호 Efficient Transmission of NIC Data
JPH11355322A (en) * 1998-05-12 1999-12-24 Nokia Mobile Phones Ltd Method for connecting radio terminal device to data transmission network and the terminal device
KR20000026244A (en) * 1998-10-19 2000-05-15 윤종용 Atm nic for improving transmission efficiency and data transmission method thereof
US6081846A (en) * 1997-05-08 2000-06-27 Microsoft Corporation Method and computer program product for reducing intra-system data copying during network packet processing

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5778180A (en) * 1995-11-06 1998-07-07 Sun Microsystems, Inc. Mechanism for reducing data copying overhead in protected memory operating systems
KR19980073517A (en) * 1997-03-15 1998-11-05 김광호 Efficient Transmission of NIC Data
US6081846A (en) * 1997-05-08 2000-06-27 Microsoft Corporation Method and computer program product for reducing intra-system data copying during network packet processing
JPH11355322A (en) * 1998-05-12 1999-12-24 Nokia Mobile Phones Ltd Method for connecting radio terminal device to data transmission network and the terminal device
KR20000026244A (en) * 1998-10-19 2000-05-15 윤종용 Atm nic for improving transmission efficiency and data transmission method thereof

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20040009225A (en) * 2002-07-23 2004-01-31 엘지엔시스(주) Method of network packet checking by kernel hooking
KR101040897B1 (en) * 2009-07-14 2011-06-16 국성식 Rubber label and manufacturing method thereof
KR101350333B1 (en) * 2009-11-03 2014-01-10 한국전자통신연구원 network emulation system and method for on-line server test processing heavy traffic
CN110149262A (en) * 2019-04-02 2019-08-20 视联动力信息技术股份有限公司 A kind for the treatment of method and apparatus and storage medium of signaling message
CN110149262B (en) * 2019-04-02 2021-03-12 视联动力信息技术股份有限公司 Method and device for processing signaling message and storage medium

Similar Documents

Publication Publication Date Title
EP0642246B1 (en) Network communication method for systems equipped with virtual memory
US7249206B2 (en) Dynamic memory allocation between inbound and outbound buffers in a protocol handler
JP3730686B2 (en) Method for transmitting data, data communication system, data communication network
KR100773013B1 (en) Method and Apparatus for controlling flow of data between data processing systems via a memory
US5920703A (en) Systems and methods for managing the processing of relatively large data objects in a communications stack
EP0365731B1 (en) Method and apparatus for transferring messages between source and destination users through a shared memory
KR100255503B1 (en) Method and system for assembling data stream
CA2341211A1 (en) Intelligent network interface device and system for accelerating communication
KR20070018270A (en) Method for flow control of wireless USB communication, wireless USB device and wireless USB host using the same
Dittia et al. Design of the APIC: A high performance ATM host-network interface chip
KR20030071856A (en) Method and Apparatus for controlling flow of data between data processing systems via a memory
JP2004364257A (en) Device and method for allocating channel time to application on wireless pan
US5930525A (en) Method and apparatus for network interface fetching initial and data burst blocks and segmenting blocks and scheduling blocks compatible for transmission over multiple virtual circuits
EP0843499A2 (en) Method and device for the management of resources in ATM technique for weighted fair queuing (WFQ) applications
US5894586A (en) System for providing access to memory in which a second processing unit is allowed to access memory during a time slot assigned to a first processing unit
Lo et al. The implementation of a high-performance ORB over multiple network transports
US5047927A (en) Memory management in packet data mode systems
Gopalakrishnan et al. A framework for QoS guarantees for multimedia applications within an endsystem
Ahuja et al. Design, implementation, and performance measurement of a native-mode ATM transport layer (extended version)
KR20020039492A (en) Packet processing method
US7443793B2 (en) Processor with dynamic table-based scheduling using linked transmission elements for handling transmission request collisions
JPH10190734A (en) Packet transfer device/method
JPH10336188A (en) Transmission system
Gopalakrishnan et al. Quality of service support for protocol processing within endsystems
JP2002051100A (en) Repeater and control method therefor

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E601 Decision to refuse application