JP2004336427A - Search circuit and packet transfer device - Google Patents

Search circuit and packet transfer device Download PDF

Info

Publication number
JP2004336427A
JP2004336427A JP2003130066A JP2003130066A JP2004336427A JP 2004336427 A JP2004336427 A JP 2004336427A JP 2003130066 A JP2003130066 A JP 2003130066A JP 2003130066 A JP2003130066 A JP 2003130066A JP 2004336427 A JP2004336427 A JP 2004336427A
Authority
JP
Japan
Prior art keywords
search
entry
divided
search key
result
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.)
Pending
Application number
JP2003130066A
Other languages
Japanese (ja)
Inventor
Yasutaka Saito
泰孝 斎藤
Hiroyuki Sato
浩之 佐藤
Yasushi Matsumoto
康 松本
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric Corp
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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP2003130066A priority Critical patent/JP2004336427A/en
Publication of JP2004336427A publication Critical patent/JP2004336427A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide a search circuit capable of obtaining a right searched result when a search key is divided and an LPM search process is carried out. <P>SOLUTION: The search circuit includes a search control unit 2 for dividing an entered search key into a plurality of divided search keys and performs longest identification search by using corresponding tables 1a to 1c from a high order divided search key which includes head data in the search key, and tables 1a to 1c provided as many as the divided search keys for storing entries including prescribed result information corresponding to the divided search keys. The tables 1a to 1c have dummy entries for avoiding a case that the result information on the divided search key is no longer acquired by dividing the search key. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
この発明は、パケットなどを、パケットのヘッダに書かれたアドレスに基づき転送先を決定するアドレス検索回路およびこのアドレス検索回路を有するパケット転送装置に関するものである。
【0002】
【従来の技術】
従来、パケットの転送を行なうルータでは、パケットの宛先IP(Internet Protocol)アドレスから転送先のポートなどの情報を得るための検索を高速に行なうために、CAM(Content Addressable Memory,連想メモリ)などのデバイスを用いて実現している。また、一般的な検索アルゴリズムであるツリーと組み合わせることによって、上記デバイスが対応している検索キー長を超える検索をサポートし、長いアドレスからの転送先ポートなどの情報の検索を容易にしている。たとえば、ルータにおける検索キーであるパケットの宛先アドレスを任意の数に分割し、この分割した検索キーのそれぞれに対応した種類のテーブルを設け、このテーブルに、分割した検索キーに対応したデータまたは別のテーブルを示すポインタまたはインデックスを格納して最長一致(Longest Prefix Match,以下、LPMという)検索を実現するテーブル検索装置が提案されている(たとえば、特許文献1参照)。
【0003】
【特許文献1】
特開2001−326679号公報(第2頁、第2図)
【0004】
【発明が解決しようとする課題】
しかしながら、上述した従来の技術のように検索キーを複数に分割してLPM検索を行う場合には、ミスヒットが発生してしまうという問題点があった。図24は、従来のLPM検索の問題点を説明するための図である。ここでは、IPv6のパケットに格納されている宛先IPアドレス(以下、アドレスという)を用いて、パケットの転送先を求める場合を例に挙げて説明する。また、説明を簡略化するために、検索キーを2つに分割して検索を行う場合を例に挙げる。
【0005】
図24(a)は、検索キーを分割しない場合のテーブルの内容を示すものであり、2つのエントリA,Bの「検索対象情報」に、それぞれの転送先の「結果」であるアドレスA,Bが対応付けされている。また、それぞれのエントリに項目「マスク長」が設けられている。すなわち、アドレス「4000:0102:0304:0506:0708:090a:0b0c:0d04」(16進数表示である。以下に示されるアドレスも同様に16進数表示で表示する。)を有するパケットの場合には、エントリAに一致するので、アドレスAに出力(転送)し、48ビットでマスクした結果得られるアドレスがアドレス「4000:0102:0304:0000:0000:0000:0000:0000」であるパケットの場合にはアドレスBに出力(転送)することを示している。なお、エントリA,Bともに48ビット目まで同じであるが、LPM検索では、検索キーと長く一致する方の検索対象情報の結果が優先される。
【0006】
図24(b)は、上記(a)のテーブルを2つに分割したテーブルを示し、第1のテーブルには、分割された上位64ビットのアドレスからなる「検索対象情報」と、それに対応する「マスク長」と「結果データ」が格納され、第2のテーブルには、分割された検索キーの下位64ビットのアドレスからなる「検索対象情報」と、それに対応する「マスク長」と「結果データ」が格納される。なお、図示していないが、第1のテーブルのエントリAと第2のテーブルのエントリAとは、インデックスなどで対応付けされている。また、エントリBに格納されるアドレスは、128ビットのうち上位48ビットをマスクしたもので転送先を判断することが可能なために、第1のテーブルには格納されるが第2のテーブルには格納されていない。
【0007】
たとえば、アドレス「4000:0102:0304:0506:0708:090a:0b0c:0d04」を有するパケット1の場合、検索キーであるアドレスは、第1の分割検索キー「4000:0102:0304:0506」と第2の分割検索キー「0708:090a:0b0c:0d04」に分割される。まず、第1の分割検索キーは第1のテーブルのエントリAに一致し、第2のテーブルで検索する情報を得る。そして、第2の分割検索キーを第2のテーブルで検索すると、エントリAに一致し、結果としてアドレスAを取得する。また、アドレス「4000:0102:0304:0000:0708:090a:0b0c:0d04」を有するパケット2の場合、検索キーであるアドレスは、第1の分割検索キー「4000:0102:0304:0000」と第2の分割検索キー「0708:090a:0b0c:0d04」に分割され、第1の分割検索キーは第1のテーブルのエントリBに一致するので、結果としてアドレスBを取得する。
【0008】
一方、アドレス「4000:0102:0304:0506:0708:090a:0b0c:0000」を有するパケット3の場合には、検索キーであるアドレスは、第1の分割検索キー「4000:0102:0304:0506」と第2の分割検索キー「0708:090a:0b0c:0000」に分割されるが、検索結果が得られなくなってしまう。すなわち、第1の分割検索キーは第1のテーブルのエントリAに一致し、第2のテーブルで検索する情報を得るが、第2の分割検索キーで第2のテーブルを検索すると、第2のテーブルには上記検索条件に合致するエントリは存在せず、ミスヒットという結果になる。しかし、このパケット3は、図24(a)よりエントリBに一致するパケットであるので、実際にはアドレスBを結果として取得しなければならない。このように、エントリAとエントリBとの間に包含関係が存在する場合に、検索キーを分割してLPM検索を実施すると、このようなミスヒットが生じてしまうという問題点があった。
【0009】
この発明は、上記に鑑みてなされたもので、検索キーを分割してLPM検索を行う場合においても、正しい検索結果を得ることが可能な検索回路およびこの検索回路を使用したパケット転送装置を得ることを目的とする。
【0010】
【課題を解決するための手段】
上記目的を達成するため、この発明にかかる検索回路は、入力された検索キーを複数の分割検索キーに分割し、前記検索キー内の先頭のデータが含まれる上位の分割検索キーから対応するテーブルを用いて順に最長一致検索を行って、所望の結果情報を得る検索制御手段と、前記分割検索キーの数だけ設けられるテーブルであり、前記分割検索キーに対応する所定の結果情報を含むエントリを格納するテーブルと、を備える検索回路であって、前記テーブルは、前記検索キーの分割によって前記分割検索キーに対する結果情報が得られなくなることを回避するためのダミーエントリを有することを特徴とする。
【0011】
【発明の実施の形態】
以下に添付図面を参照して、この発明にかかる検索回路およびパケット転送装置の好適な実施の形態を詳細に説明する。
【0012】
実施の形態1.
図1はこの発明にかかる検索回路の構成を模式的に示すブロック図である。この検索回路は、LPM検索を行うCAMなどから構成される複数のテーブル(検索エンジン)1a〜1c、検索キーを2以上の分割検索キーに分割して、各テーブル1a〜1cを用いて検索を実行する検索制御部2、検索回路を管理する図示しない管理装置からのエントリの追加・削除要求があったエントリ(検索キー、結果)をテーブル1a〜1cに設定する検索キー分割・タグ管理部3、エントリの包含関係などの必要な情報を管理し、それらの情報を検索キー分割・タグ管理部3による設定時に提供する包含関係検出・ダミーエントリ管理部4を備えて構成される。なお、この図1ではCAMなどのテーブルは、複数個に分けて表示されているが、論理的に複数に分かれていればよい。また、3つのテーブル1a〜1cを用いる場合を示しているが、これに限られる趣旨ではない。さらに、以下の説明では、検索キーとしてパケットに格納された宛先IPアドレス(アドレス)を用い、このアドレスに上記パケットを転送するための出力先を検索する場合を例に挙げるが、この検索回路の用途がこれのみに限定される訳ではない。
【0013】
テーブル1a〜1cは、検索回路に入力された検索キー(アドレス)のLPM検索を行って、出力先の結果を得るものであり、上記検索キーを分割した数のテーブルから構成される。図24(a)に示されるようにアドレスとその出力先(結果)が決定されているエントリのアドレスが複数のアドレス(以下、分割検索キー対応データという)に分割され、先頭のビットが含まれる上位の分割検索キー対応データから順に第1のテーブル、第2のテーブル、・・・にエントリとして格納される。なお、この明細書では、2つのテーブルを比較したときに、第1のテーブルに近い方のテーブルを相対的に上位のテーブルといい、第1のテーブルから遠い方のテーブルを相対的に下位のテーブルという。
【0014】
図2は、テーブルの構成の一例を示す図である。この図2に示されるように、テーブル1は、分割検索キーに対応する長さのアドレスである分割検索キー対応データが格納される「検索対象情報」、分割検索キーが「検索対象情報」と一致する必要のあるデータの長さを示すマスク長が格納される「マスク長」、そして「検索対象情報」に格納されたエントリと一致する場合の結果が格納される「結果データ」を含む項目から構成される。「結果データ」には、マスク長でマスクされた「検索対象情報」に格納されるエントリから出力先を導くことができる場合には、その出力先が格納され、出力先を導くことができない場合には下位に存在するつぎのテーブルで検索を行う際に必要なタグが格納される。「検索対象情報」には、第1のテーブル1aでは、分割検索キーに対応する長さのアドレスが格納されるが、第2のテーブル1b以下のテーブルでは、タグに分割検索キーに対応する長さのアドレスが組み合わされた検索対象情報が格納される。
【0015】
検索制御部2は、検索キーを2以上の分割検索キーに分割し、各テーブル1a〜1cに適切な検索を実行するためのキーを出力して、正しい検索結果を求める機能を有する。検索キーの分割検索キーへの分割は、各テーブル1a〜1cと同じ数に分割するとともに、各テーブル1a〜1cに格納されている検索対象情報内のアドレス(分割検索キー対応データ)と同じビット数で分割するように行われる。この明細書では、分割された分割検索キーの先頭のビットを含む分割検索キーから順に第1の分割検索キー、第2の分割検索キー、第3の分割検索キー、・・・とする。また、テーブルと同様に、2つの分割検索キーを比較した場合に、第1の分割検索キーに近い方の分割検索キーを相対的に上位の分割検索キーといい、第1の分割検索キーに遠い方の分割検索キーを相対的に下位の分割検索キーという。この検索制御部2は、たとえば、第1のテーブル1aに第1の分割検索キーを出力した結果、タグを得た場合に、そのタグとつぎの第2の分割検索キーを組み合わせたものを第2のテーブル1bに出力する。このようにして、あるテーブルから最終的な結果であるパケットの出力先が得られると、検索処理を終了する。
【0016】
検索キー分割・タグ管理部3は、テーブル1a〜1cへの新たなエントリ(分割検索キー対応データ、結果データ)の追加や削除要求があった場合に、包含関係検出・ダミーエントリ管理部4の指示に基づいて、検索制御部2とテーブル1a〜1cで正しく検索できるように設定する機能を有する。
【0017】
包含関係検出・ダミーエントリ管理部4は、テーブル1a〜1cへのエントリの追加がある場合に、追加されるエントリとテーブル1a〜1c内のエントリとの間の包含関係などを調査して、正しく検索を行うことが可能か否かを管理し、必要な場合には、上記包含関係などの必要な情報に基づいてダミーエントリの追加や削除などの指示を、検索キー分割・タグ管理部3に提供する機能を有する。
【0018】
なお、ダミーエントリとは、上述した従来のLPM検索の問題点で説明したパケット3のような検索結果がミスヒットとなることを防ぎ、本来の転送先を得ることができるようにするために、テーブル1に挿入されるエントリである。具体的には、ダミーエントリは、追加するエントリとテーブル1内のエントリの間に包含関係がある場合に、包含されている方のエントリの結果データに格納されているタグに任意のアドレスを付加した「分割対象情報」、上記タグの長さをマスク長とした「マスク長」、包含する方のエントリの最終的な結果情報である出力先を格納する「結果データ」を含むデータ構造を有する。
【0019】
つぎに、図3〜図12を参照して、包含関係検出・ダミーエントリ管理部4の動作について説明する。包含関係検出・ダミーエントリ管理部4は、既にテーブル1a〜1cに格納されているエントリとの包含関係を考慮してエントリの追加と削除の2つの処理を行うが、ここでは、最初にエントリの追加について説明し、つぎにエントリの削除について説明する。
【0020】
図3は、エントリ追加時の全体の処理手順を示すフローチャートである。まず、管理装置からエントリ追加の要求があると、包含関係検出・ダミーエントリ管理部4は、追加するエントリの検索キーを、それぞれのテーブル1a〜1cで規定された分割検索キー長の第1〜第3の分割検索キー対応データに分割する(ステップS1)。つぎに、追加するエントリが、他のエントリとどのような包含関係になっているか判定し、ダミーエントリが必要か否か、また必要な場合にはどのようなダミーエントリが必要かを決定する(ステップS2)。つぎに、それぞれのテーブル1a〜1cにエントリを追加し(ステップS3)、ステップS2の結果により、エントリ追加処理を終了するか、ダミーエントリを追加するかの判定を行う(ステップS4)。ダミーエントリの追加が必要でないと判定された場合(ステップS4でNoの場合)には、そのまま処理を終了し、ダミーエントリの追加が必要と判定された場合(ステップS4でYesの場合)には、ステップS2で得られた結果からダミーエントリの追加を行い(ステップS5)、処理を終了する。
【0021】
ここで、ステップS2における包含関係検出処理の詳細について説明する。図4〜図8は、包含関係検出の判定内容を示す図である。なお、これらの包含関係検出の判定内容を示す図は、後述するエントリを削除する場合に行われる包含関係検出の判定と同じであるので、図中には、両者についての判定がまとめて記載されている。図4は、追加されるエントリと、既にテーブルに格納されているエントリとの包含関係に基づいて、ダミーエントリが必要か否かを判定するものである。この包含関係の判定は、追加するエントリの検索キーを分割する前の状態で行う。追加するエントリ(以下、追加エントリという)が他のエントリを包含しておらず、かつ他のエントリに包含されていない場合には、ダミーエントリは必要がない。
【0022】
また、追加エントリが他のエントリを包含しておらず、かつ他のエントリに包含されている場合には、図4に示される包含関係1に対応してダミーエントリの有無が決定される。図5は、包含関係1における追加エントリのマスク長と、追加エントリを包含するエントリのマスク長との関係からダミーエントリが必要か否かの判定結果を示す図である。ここで、領域1とは、マスク長が第1のテーブル1aに格納される分割検索キー対応データの長さ(以下、第1の分割検索キー長という)以下である場合をいい、領域2とは、マスク長が、第1の分割検索キー長より長く、第1の分割検索キー長と第2のテーブル1bに格納される分割検索キー対応データの長さ(以下、第2の分割検索キー長という)の和以下である場合をいい、領域3とは、マスク長が、第1の分割検索キー長と第2の分割検索キー長の和よりも長い場合をいう。また、追加エントリが複数のエントリに包含されている場合には、最もマスク長の長いエントリに対して、この図5の判定を適用する。
【0023】
たとえば、追加エントリのマスク長、追加エントリを包含するエントリのマスク長ともに領域1にある場合には、ダミーエントリの追加の必要はない。また、追加エントリのマスク長が領域2にあり、追加エントリを包含するエントリのマスク長が領域1にある場合には、図8に示されるダミーエントリの「追加1−1」の処理が必要と判断される。図8は、ダミーエントリの追加判定の結果とその処理内容を規定する図である。たとえば、上記「追加1−1」の場合には、追加エントリを包含しているエントリのダミーエントリを第2のテーブル1bに追加する処理が選択される。
【0024】
また、図4で、追加エントリが他のエントリを包含しており、かつ他のエントリに包含されていない場合には、図6に示される包含関係2に対応してダミーエントリの有無が決定される。この図6は、追加エントリのマスク長と、追加エントリが包含しているエントリのマスク長との関係からダミーエントリが必要か否かを判定するものである。そして、この判定の結果、図8に規定されるダミーエントリの追加または変更処理が必要と判断される。ここで、追加エントリが、複数のエントリを二重に包含している場合は、最もマスク長の短いエントリに対して、この図6の判定を適用する。また、追加エントリが、複数のエントリを包含しているが、二重に包含している関係にはない場合には、それぞれのエントリに対して図6の判定を適用する(すなわち、複数のエントリA,Bと追加エントリCが、A⊂C,B⊂CでかつA⊆BでもなくB⊆Aでもない場合には、エントリA、エントリBの両者に対して図6の判定を行う)。
【0025】
さらに図4で、追加エントリが他のエントリを包含しており、かつ他のエントリに包含されている場合には、図7に示される包含関係3に対応してダミーエントリの有無が決定される。この図7は、追加エントリのマスク長と、追加エントリが包含しているエントリのマスク長と、追加エントリが包含されるエントリのマスク長の関係からダミーエントリが必要か否かを判定するものである。そして、この判定の結果、図8に規定されるダミーエントリの追加または変更処理が必要と判断される。ここで、追加エントリが、複数のエントリを二重に包含している場合は、最もマスク長の短いエントリに対して、この図7の判断を適用する。また、追加エントリが、複数のエントリを包含しているが、二重に包含している関係にはない場合には、それぞれのエントリに対して図7の判定を適用する(すなわち、複数のエントリA,Bと追加するエントリCが、A⊂C,B⊂CでかつA⊆BでもB⊆Aでもない場合には、エントリA、エントリBの両者に対して図7の判定を行う)。さらに、追加エントリが複数のエントリに包含されている場合には、最もマスク長の長いエントリに対して、この図7の判定を適用する。
【0026】
これらのように、追加エントリと既にテーブル1a〜1cに格納されているエントリとの包含関係の判定にあたっては、エントリ同士のマスク長も考慮して行われる。以上のような包含関係を求めるアルゴリズムは様々なものが考えられるが、例えば特開平11−103313号公報に示された方法などを適用することができる。
【0027】
つぎに、上述した図3のステップS3におけるエントリ追加処理の詳細について説明する。ここでは、既に登録されているエントリの追加が行われないように管理装置でチェックされているという前提での処理手順を示す。
【0028】
図9は、エントリ追加の処理手順を示すフローチャートである。まず、包含関係検出・ダミーエントリ管理部4は、エントリの追加のために、該エントリの第1の分割検索キー対応データと同じエントリが第1のテーブルにあるか否かを判定する(ステップS101)。このとき、第1の分割検索キー対応データだけでなく、マスク長も考慮することが通常の検索とは異なる(以下では、エントリの設定に関する処理の場合、エントリの有無の判定はマスク長も考慮しているものとする)。判定の結果、第1の分割検索キー対応データと同じエントリがないと判定された場合(ステップS101でNoの場合)には、追加エントリのマスク長の判定を行う(ステップS102)。追加エントリのマスク長が、“マスク長≦第1の分割検索キー長(領域1)”である場合(ステップS102でYesの場合)には、第1のテーブル1aに、エントリを追加する(ステップS103)。このフローは追加エントリのマスク長が第1の分割検索キー長以下の場合の通常のフローである。
【0029】
また、ステップS102で、マスク長が領域1でないと判定された場合(ステップS102でNoの場合)には、包含関係検出・ダミーエントリ管理部4は、使用していない第2のテーブル1b用のタグ(以下、タグ1とする)を取得し(ステップS104)、第1の分割検索キー対応データを「検索対象情報」とし、取得したタグ1を「結果データ」とするエントリとして第1のテーブル1aに追加する(ステップS105)。つぎに、追加エントリのマスク長の判定を行う(ステップS106)。このとき、追加エントリのマスク長が“第1の分割検索キー長(領域1)<マスク長≦第1の分割検索キー長+第2の分割検索キー長(領域2)”であると判定された場合(ステップS106でYesの場合)には、第2のテーブル1bに、タグ1と第2の分割検索キー対応データの組合せを「検索対象情報」とし、追加エントリの結果を「結果データ」として、エントリを追加する(ステップS107)。このフローは、追加エントリのマスク長が第1の分割検索キー長より長く、第1の分割検索キー長と第2の分割検索キー長の合計以下の場合で、かつ第1の分割検索キーと同じエントリが未だ登録されていない場合のフローである。
【0030】
上記ステップS106で、追加エントリのマスク長が領域2でないと判定された場合(ステップS106でNoの場合)には、包含関係検出・ダミーエントリ管理部4は、使用していない第3のテーブル1c用のタグ(以下、タグ2とする)を取得し(ステップS108)、タグ1と第2の分割検索キー対応データの組合せを「検索対象情報」とし、取得したタグ2を「結果データ」とするエントリとして第2のテーブル1bに追加する(ステップS109)。そして、取得したタグ2と第3の分割検索キー対応データを「検索対象情報」として、追加エントリの結果を「結果データ」として、第3のテーブル1cに追加する(ステップS110)。このフローは、追加エントリのマスク長が第1の分割検索キー長と第2の分割検索キー長の合計より長い場合で、かつ第1の分割検索キー対応データ+第2の分割検索キー対応データと同じエントリが未だ登録されていない場合のフローである。
【0031】
一方、ステップS101で、既に第1のテーブル1aにエントリが存在する場合(ステップS101でYesの場合)には、そのエントリの結果がタグか否かを判定する(ステップS111)。エントリの結果がタグでないと判定された場合(ステップS111でNoの場合)には、このエントリを第1のテーブル1aから削除する(ステップS112)。なお、このエントリは、マスク長が領域1の長さと等しい場合で、後でこのエントリ用のダミーエントリの追加を行う。その後、上述したステップS102以降の処理を行う。このフローは既に第1のテーブル1aに追加するエントリと同じエントリがあり、かつそのエントリのマスク長が第1の分割検索キー長と等しい特別な場合のフローである。
【0032】
なお、このような状況で、第1の分割検索キー対応データが等しく、マスク長が領域2または3の場合、元のエントリに、タグ情報を「結果データ」として登録しなければならないため、上記ステップS112でエントリを削除している。ただし、ここではエントリを削除しているが、後で行われるダミーエントリ追加処理によって、削除したエントリの代わりのエントリを第2のテーブル1bに追加する処理を行う。
【0033】
また、ステップS111で、エントリの結果がタグであると判定された場合(ステップS111でYesの場合)には、包含関係検出・ダミーエントリ管理部4は、そのタグ値(以下、このタグ値もタグ1とする)を第1のテーブル1aから取得する(ステップS113)。つぎに、追加エントリのマスク長の判定を行う(ステップS114)。追加エントリのマスク長が領域1でないと判定された場合(ステップS114でNoの場合)には、第2のテーブル1bに取得したタグ1+第2の分割検索キー対応データのエントリがあるか否かの判定を行う(ステップS115)。第2のテーブル1bに取得したタグ1+第2の分割検索キー対応データのエントリがないと判定された場合(ステップS115でNoの場合)には、第2のテーブル1bにおけるタグ1の使用数をインクリメントして、上述したステップS106以降の処理を行う。このフローは、マスク長が第1の分割検索キー長より長い場合で、第1の分割検索キー対応データと同じ値のエントリが既に登録されている場合でかつ、第2の分割検索キー対応データに関しては、同じ値のエントリが未だ登録されていない場合のフローである。
【0034】
上述したステップS115の判定で、第2のテーブル1bにタグ1+第2の分割検索キー対応データのエントリがあると判定された場合(ステップS115でYesの場合)には、エントリの結果がタグか否かを判断する(ステップS117)。タグでないと判断された場合(ステップS117でNoの場合)には、このエントリを第2のテーブル1bから削除する(ステップS118)。その後、上述したステップS106以降の処理を行う。このフローは、既に第1と第2のテーブル1a,1bにエントリがあり、かつそのエントリのマスク長が第1の分割検索キー長+第2の分割検索キー長の合計と等しい場合のフローである。
【0035】
また、ステップS117でエントリの結果がタグであると判定された場合(ステップS117でYesの場合)には、そのタグ値(以下、このタグ値もタグ2とする)を取得する(ステップS119)。つぎに、追加エントリのマスク長の判定を行う(ステップS120)。追加エントリのマスク長が領域2でない場合、すなわち領域3である場合(ステップS120でNoの場合)には、第3のテーブル1cにおけるタグ2の使用数をインクリメントして、ステップS110の処理を行う。このフローは、マスク長が第1の分割検索キー長+第2の分割検索キー長の合計より長い場合で、かつ第1と第2の分割検索キー対応データまで同じ値のエントリが登録されている場合である。
【0036】
一方、ステップS120で、追加エントリのマスク長が領域2であると判定された場合(ステップS120でYesの場合)には、エントリの追加を行わず、そのまま処理が終了する。このエントリについての処理は、ダミーエントリ追加のときに行われる。
【0037】
また、ステップS114で、追加エントリのマスク長が領域1であると判定された場合(ステップS114でYesの場合)にも、エントリの追加を行わず、そのまま処理が終了する。このエントリについての処理は、ダミーエントリ追加の時に行われる。
【0038】
以上のようにして、第1〜第3のテーブル1a〜1cにエントリが追加される。
【0039】
つぎに、図3のステップS5におけるダミーエントリ追加処理について説明する。この図8は、図5〜図7の包含関係の判定処理で行われた結果に対するダミーエントリの追加処理内容を規定している。図9に示されるエントリ追加処理の終了後、追加エントリに関するステップS2における包含関係の判定結果と図8の処理内容に基づいて、各テーブル1a〜1cについてダミーエントリの追加処理または変更処理が行われる。
【0040】
以上のようにして、新たなエントリがテーブル1a〜1cに追加される際に、追加エントリと既にテーブルに格納されているエントリとの間の包含関係を考慮しないために生じる検索時のミスヒットを防ぐためのダミーエントリが必要に応じて追加されるようにしている。
【0041】
つぎに、包含関係検出・ダミーエントリ管理部4によるエントリの削除について説明する。図10は、エントリ削除時の全体の処理手順を示すフローチャートである。まず、管理装置からエントリの削除要求があると、検索キーをそれぞれテーブル1a〜1cで規定された分割検索キー長を有する第1〜第3の分割検索キー対応データに分割する(ステップS11)。つぎに、エントリを削除したことでダミーエントリが不要になるかどうか、他のエントリとの包含関係に基づいて判定し(ステップS12)、それぞれのテーブル1a〜1cのエントリを削除する(ステップS13)。
【0042】
その後、ステップS12の結果に基づいて、エントリ削除処理を終了するか、さらにダミーエントリを削除するかの判定を行う(ステップS14)。ダミーエントリの削除がない場合(ステップS14でNoの場合)には、そのまま処理が終了する。また、ダミーエントリの削除がある場合(ステップS14でYesの場合)には、不要なダミーエントリの削除を行い(ステップS15)、処理を終了する。なお、ステップS12における包含関係検出処理は、エントリの追加処理において図4〜図7で説明した場合と同じであるので、その説明を省略する。ただし、この場合には、追加処理内容を規定している図8ではなく、削除処理内容を規定している図12が使用される。
【0043】
ここで、上述したステップS13におけるエントリ削除処理の詳細について説明する。なお、未登録のエントリに対する削除が行われないように管理装置でチェックされているという前提での処理手順を示す。
【0044】
図10は、エントリ削除処理の手順を示すフローチャートである。まず、エントリを削除するために、包含関係検出・ダミーエントリ管理部4は、削除するエントリについて、第1のテーブル1aにおける該エントリの結果がタグであるか否かを判定する(ステップS201)。第1のテーブル1aにおけるエントリの結果がタグでないと判定された場合(ステップS201でNoの場合)には、第1の分割検索キー対応データのエントリを第1のテーブル1aから削除し(ステップS213)、エントリ削除処理を終了する。このフローは、削除するエントリのマスク長が領域1である場合の通常のフローある。
【0045】
つぎに、ステップS201で、第1のテーブル1aにおけるエントリの結果がタグであると判定された場合(ステップS201でYesの場合)には、包含関係検出・ダミーエントリ管理部4は、削除するエントリのマスク長の判定を行う(ステップS202)。ここで、削除するエントリのマスク長が領域1でないと判定された場合(ステップS202でNoの場合)には、第2のテーブル1bのエントリの結果がタグであるか否かを判定する(ステップS203)。第2のテーブル1bのエントリの結果がタグでないと判断された場合(ステップS203でNoの場合)には、第2の分割検索キー対応データのエントリを第2のテーブル1bから削除する(ステップS209)。その後、第2のテーブル1bにおけるタグ1の使用数をディクリメントし(ステップS210)、タグ1の使用数が0になったか否かを判定する(ステップS211)。タグ1の使用数が0になった場合(ステップS211でYesの場合)には、該当するタグ1を解放し(ステップS212)、上述したステップS213の処理を行う。このフローは、削除するエントリのマスク長が領域2で、第1の分割検索キー対応データが同じ値のエントリが他にない場合のフローである。
【0046】
一方、ステップS211でタグ1の使用数が0でないと判定された場合(ステップS211でNoの場合)には、そのまま処理を終了する。このフローは、削除するエントリのマスク長が領域2で、第1の分割検索キー対応データが同じ値のエントリが他にある場合のフローである。
【0047】
また、ステップS203で、第2のテーブル1bのエントリの結果がタグであると判定された場合(ステップS203でYesの場合)には、削除するエントリのマスク長の判定を行う(ステップS204)。ここでマスク長が領域2でないと判定されると(ステップS204でNoの場合)、第3のテーブル1cからエントリを削除する(ステップS205)。その後、第3のテーブル1cにおけるタグ2の使用数をディクリメントし(ステップS206)、タグ2の使用数が0になったか否か判定する(ステップS207)。タグ2の使用数が0になった場合(ステップS207でYesの場合)には、該当するタグ2を解放し(ステップS208)、上述したステップS206以降の処理を行う。このフローは、削除するエントリのマスク長が領域3のエントリで、第2の分割検索キー対応データまでが同じ値のエントリが他にない場合のフローである。
【0048】
一方、ステップS207でタグ2の使用数が0でないと判定された場合(ステップS207でNoの場合)には、そのまま処理を終了する。このフローは、削除するエントリのマスク長が領域3で、第2の分割検索キー対応データまで同じ値のエントリが他にある場合のフローである。
【0049】
また、ステップS204でマスク長が領域2であると判断された場合(ステップS204でYesの場合)には、そのまま処理を終了する。このフローは、削除するエントリのマスク長が第1の分割検索キー長+第2の分割検索キー長の合計と等しい場合で、第2の分割検索キー対応データまで同じ値のエントリが他にある場合のフローである。この削除するエントリ自身はダミーエントリとして登録されているので、ダミーエントリ削除の処理工程で削除される。
【0050】
上述したステップS202で、マスク長が領域1であると判断された場合(ステップS202でYesの場合)にも、そのまま処理を終了する。このフローは、削除するエントリのマスク長が第1の分割検索キー長の合計と等しい場合で、第1の分割検索キー対応データと同じ値のエントリが他にある場合のフローである。このフローも、このエントリ自身はダミーエントリ削除の処理工程で削除される。
【0051】
以上のようにして、第1〜第3のテーブル1a〜1cからエントリが削除される。
【0052】
つぎに、図10のステップS15におけるダミーエントリ削除処理について説明する。図12は、ダミーエントリの削除内容を示す図である。この図12は、図4〜図7の包含関係の判定処理で行われた結果に対するダミーエントリの削除処理内容を規定している。図11に示されるエントリ削除処理の終了後、削除するエントリに関するステップS12における包含関係の判定結果と図12の処理内容に基づいて、各テーブルについてダミーエントリの削除処理または変更処理が行われる。
【0053】
以上のようにして、テーブル1a〜1cからエントリが削除される際に、削除されるエントリと既にテーブルに格納されているエントリとの間の包含関係を含めてダミーエントリを削除するようにしている。
【0054】
なお、上述した説明では、検索キーを3分割した場合を例に挙げたが、検索キーを2分割または4分割以上する場合でも同様の処理手順でエントリの追加または削除処理を実現することができる。
【0055】
ここで、ダミーエントリの追加処理、削除処理およびダミーエントリが追加された場合の検索処理について具体的な例を挙げて説明する。まず、ダミーエントリの追加処理ついて、1つのエントリが既に格納されている2つのテーブルに、新たにエントリを追加する場合を例に挙げて説明する。
【0056】
図13は、テーブルが2つの場合のエントリ追加の様子を示す図であり、図13(a)は、新たなエントリを追加する前のテーブルの様子を示している。ここでは、第1および第2のテーブル1a,1bには、図24(a)のテーブルのエントリAに対応するエントリが格納されている。これらのテーブル1a,1bに図24(a)のテーブルのアドレス(検索キー)が「4000:0102:0304:0000:0000:0000:0000:0000」であり、マスク長が48ビットであり、転送先がアドレスBであるエントリBを追加する場合には、まず、包含関係検出・ダミーエントリ管理部4は、アドレス(検索キー)を第1の分割検索キー「4000:0102:0304:0000」と第2の分割検索キー「0000:0000:0000:0000」に分割する。
【0057】
追加エントリとテーブル1a,1bに格納されているエントリとの包含関係を調べると、追加エントリはエントリAを包含しているが他のエントリを包含していないので、図4から包含関係2に該当する。また、追加エントリのマスク長(48ビット)は第1の分割検索キー長(64ビット)以下であり、エントリAのマスク長は128ビットで領域2にあることから、図7の「ダミーエントリ追加2−1」に該当する。
【0058】
第1のテーブル1aには、第1の分割検索キー対応データと同じエントリが存在せず(ステップS101でNoの場合)、またマスク長(48ビット)は領域1にあるので(ステップS102でYesの場合)、第1のテーブル1aに第1の分割検索キー対応データが追加される。ここでは、図13(b)に示されるように、「検索対象情報」に「4000:0102:0304:0000」が追加され、「マスク長」に「48」が追加され、「結果データ」に「アドレスB」が追加される。
【0059】
そして、包含関係の結果は「ダミーエントリ追加2−1」であり、これは図8から、「第2のテーブルに、追加したエントリのダミーエントリ追加」の処理を行う。したがって、第2のテーブル1bには、「検索対象情報」が「タグα+0000:0000:0000:0000」であり、「マスク長」がタグαのビット数である「n」であり、そして「結果データ」が「アドレスB」であるダミーエントリが追加される。その結果が図13(c)に示されている。なお、「検索対象情報」のタグαの後に付される数値は、「マスク長」がタグαのビット数であるので、任意の数値に設定することができる。
【0060】
つぎに、2つのテーブルからエントリを削除する場合について、図14を参照しながら説明する。図14は、2つのテーブルからエントリを削除する様子を示す図であり、図14(a)は図13(c)の状態に相当する。上記したように、削除するエントリBは、テーブル1a,1b内の他のエントリに対して図4の包含関係2に該当し、また、図12の「ダミーエントリ削除2−1」に該当する。
【0061】
第1のテーブル1aにおける第1の分割検索キー対応データのエントリBの「結果データ」はタグでないので(ステップS201でNoの場合)、第1のテーブル1aから第1の分割検索キー対応データのエントリが削除される(ステップS213)。この様子が図14(b)に示されている。
【0062】
また、図12の「ダミーエントリ削除2−1」から「第2のテーブルに、削除したエントリのダミーエントリ削除」の処理が実行される。したがって、第1のテーブル1aで削除したエントリのダミーエントリ、すなわち、「検索対象情報」が「タグα+0000:0000:0000:0000」であり、「マスク長」が「n」であり、「結果データ」が「アドレスB」であるダミーエントリが第2のテーブル1bから削除される。その結果が図14(c)に示されている。
【0063】
つぎに、ダミーエントリを有するテーブルを用いた検索の手順について、図15を参照しながら説明する。この図15は、図24に示した従来例に、実施の形態1を適用した場合の例であり、図13(c)と同一のものであり、第2のテーブル1bに上記検索回路によって挿入されたダミーエントリが格納されている。このダミーエントリは、タグ以外の部分は比較対象としないように、マスク長が設定されており、「結果データ」にはエントリBと同じ結果が格納されている。このようにすることで、図24の従来例では正しく検索ができなかった検索キーが「4000:0102:0304:0506:0708:090a:0b0c:0000」であるパケット3も、第1の分割検索キー「4000:0102:0304:0506」は、第1のテーブル1aのエントリAにヒットしてタグαを取得し、つぎに、タグα+第2の分割検索キー「タグα+0708:090a:0b0c:0000」は、マスク長がタグαの長さである第2のテーブル1bのダミーエントリにヒットするので、最終的に正しい結果であるアドレスBを取得することが可能となる。
【0064】
このようにダミーエントリを追加することで、検索制御部2およびテーブル1は、従来と全く同じ処理で長い検索キーを分割したLPM検索でも正しく検索ができるようになる。
【0065】
この実施の形態1によれば、新たに追加/削除を行うエントリと、テーブル1に格納されているエントリの包含関係を求め、その結果、両者の間に包含関係が存在する場合には、テーブル1a〜1cにダミーエントリの追加/削除、変更を行うように構成したので、複数に分割したLPM検索でも正しく検索を行うことが可能になる。
【0066】
実施の形態2.
実施の形態1では、ダミーエントリを追加することで、複数に分割したLPM検索が正しくできるようにしたものであるが、この実施の形態2では、エントリの内容にフラグを追加し、検索時にこのフラグの値によって結果を選択することで、複数に分割したLPM検索でも正しく検索を行うことが可能な検索回路について説明する。
【0067】
図16は、この発明にかかる検索回路のテーブルの実施の形態2の構成を示す図である。このテーブルには、検索を行う際のキーとなる「検索キー」と、この検索キーに一致するエントリに対する結果を格納する「検索結果」の項目からなる。「検索キー」は、タグと分割検索キーの組合せからなる「検索対象情報」、マスク長を示す「マスク長」の項目を含んで構成される。また、「検索結果」は、つぎのテーブルの検索を行なうか否かを示す「処理継続フラグ」、つぎのテーブルを検索するときのキーの一部となるタグを格納する「タグ」、検索の最終結果が格納される「結果データ」、その結果データが有効か否かを示す「データ有効フラグ」の項目を含んで構成される。なお、項目「検索対象情報」は、最上位のテーブルの場合には、分割検索キー対応データのみが格納される。
【0068】
また、以下の説明では、「処理継続フラグ」に格納されるフラグにおいて、「1」は、つぎのテーブルの検索を行う場合を示しており、「1」でない数値(たとえば、「0」)は、つぎのテーブルの検索を行わない場合を示している。さらに、「データ有効フラグ」に格納されるフラグにおいて、「1」は、有効を示し、「1」でない数値(たとえば、「0」)は、無効を示している。なお、この定義は、この明細書の説明においてなされるものであり、上記と異なるようにそれぞれのフラグを定義してもよい。
【0069】
この実施の形態2では、「データ有効フラグ」を有効にセットし、「結果データ」にダミーエントリで追加した内容のデータを登録することによって、ダミーエントリを追加した場合と同じ効果を得られるようにしている。なお、この実施の形態2における検索回路のその他の構成は、上述した実施の形態1の図1と同一であるので、その説明を省略している。
【0070】
この実施の形態2におけるエントリの追加・削除の処理に関しては、実施の形態1とほぼ同じ手順で処理が行われるが、ダミーエントリを追加する場合の処理が、「データ有効フラグ」を有効にして、包含されているエントリの「結果データ」に、包含しているエントリの結果データ(結果情報)を登録する処理に代わる点と、ダミーエントリを削除する場合の処理が、「データ有効フラグ」を無効にする処理に代わる点が異なる。
【0071】
つぎに、この検索回路による検索方法について説明する。図17は、この発明にかかる検索回路の実施の形態2による検索の処理手順を示すフローチャートである。この説明でも、検索キーを3分割した場合を例に挙げる。まず、検索制御部2は、検索キーを分割して得られる第1の分割検索キーで第1のテーブル1aの検索を行い(ステップS301)、エントリがあるか否かを判定する(ステップS302)。エントリがある場合(ステップS302でYesの場合)には、そのエントリの処理継続フラグが1であるか否かを判定し(ステップS303)、処理継続フラグが1の場合(ステップS303でYesの場合)には、その結果得られるタグと第2の分割検索キーの組合せで第2のテーブル1bを用いて検索し(ステップS304)、第2のテーブル1bにエントリがあるか否かを判定する(ステップS305)。第2のテーブル1bにエントリがある場合(ステップS305でYesの場合)には、そのエントリの処理継続フラグが1であるか否かを判定し(ステップS306)、処理継続フラグが1の場合(ステップS306でYesの場合)には、その結果得られるタグと第3の分割検索キーの組合せで第3のテーブル1cを検索し(ステップS307)、第3のテーブル1cにエントリがあるか否かを判定する(ステップS308)。第3のテーブル1cにエントリがある場合(ステップS308でYesの場合)には、この3回目検索結果のデータ有効フラグが1であるか否かを判定し(ステップS309)、データ有効フラグが1である場合には、3回目の検索結果を有効な結果として出力し(ステップS310)、検索処理を終了する。
【0072】
また、ステップS306で第2のテーブル1bのエントリの処理継続フラグが1でない場合(ステップS306でNoの場合)、またはステップS308で第3のテーブル1cにエントリがない場合(ステップS308でNoの場合)には、2回目検索結果のデータ有効フラグが1であるか否かを判定する(ステップS311)。2回目検索結果のデータ有効フラグが1の場合(ステップS311でYesの場合)には、2回目の検索結果を有効な結果として出力し(ステップS312)、検索処理を終了する。
【0073】
さらに、ステップS303で第1のテーブル1aのエントリの処理継続フラグが1でない場合(ステップS303でNoの場合)、ステップS305で第2のテーブル1bにエントリがない場合(ステップS305でNoの場合)、またはステップS311で2回目検索結果のデータ有効フラグが1でない場合(ステップS311でNoの場合)には、1回目検索結果のデータ有効フラグが1であるか否かを判定する(ステップS313)。1回目検索結果のデータ有効フラグが1の場合(ステップS313でYesの場合)には、1回目の検索結果を有効な結果として出力し(ステップS314)、検索処理を終了する。
【0074】
また、ステップS302で第1のテーブル1aにエントリがない場合(ステップS302でNoの場合)、ステップS309で3回目検索結果のデータ有効フラグが1でない場合(ステップS309でNoの場合)、またはステップS313で1回目検索結果のデータ有効フラグが1でない場合(ステップS313でNoの場合)には、結果はミスヒットとして出力し(ステップS315)、検索処理を終了する。
【0075】
このような手順で処理を行うことによって、たとえばパケットが入力されてきたときの検索で、1回目の検索でミスヒットになった場合(ステップS302でNoの場合)はミスヒットとするが、2回目や3回目の検索(ステップS304,S307)で、ミスヒットになった場合(ステップS305,S308のそれぞれでNoの場合)は、それより前の検索結果のデータ有効フラグが有効かどうかを判断し(ステップS311,S313)、その結果が無効の場合にはミスヒットとし、有効の場合にはその検索した結果を最終的な結果として出力することが可能となる。なお、検索は、1回目を除き前の検索で処理継続フラグ=1の場合(ステップS303,S306のそれぞれでYesの場合)に行なう(ステップS301,S304,S307)。
【0076】
なお、上述した説明では、検索キーを3分割した場合を例に挙げたが、検索キーを2分割または4分割以上する場合でも同様の処理手順でエントリの追加または削除処理と、検索処理を実現することができる。
【0077】
図18は、図13で説明した例をこの実施の形態2の場合に適用した場合を示す図である。この図18に示されるように、エントリA,Bの分割検索キー対応データの間に包含関係がある場合に、第1のテーブル1aから得られる包含されるエントリAの「タグ」に、第2のテーブル1bでのつぎの検索で使用するタグを格納するとともに、「結果データ」に、包含するエントリBの結果データ(結果情報)であるアドレスBを格納し、「データ有効フラグ」を有効(1)にする。このようなデータ構造によって、上述したアドレス「4000:0102:0304:0506:0708:090a:0b0c:0000」を有するパケット3の場合、第1の分割検索キー「4000:0102:0304:0506」は第1のテーブル1aのエントリAに一致するので、「タグ」としてタグαを取得し、「処理継続フラグ」が1であるので、さらに第2のテーブル1bでの検索を継続する。しかし、第2の分割検索キー「0708:090a:0b0c:0000」は第2のテーブル1bのエントリに一致するものがないので、第1のテーブル1aに戻って、「データ有効フラグ」が1(有効)であるので、その「結果データ」に格納されているアドレスBをパケット3の結果とすることで正しい検索を行うことができる。
【0078】
この実施の形態2によれば、新たに追加/削除を行うエントリの包含関係を求め、その判定結果からデータ有効フラグおよび結果のデータをテーブル1a〜1cに登録するように構成したので、検索時にミスヒットになった場合でも、それより前の検索結果のデータ有効フラグが有効である場合には、検索結果を判断することができるようになる。その結果、複数に分割したLPM検索でも正しく検索することができる。
【0079】
実施の形態3.
この実施の形態3では、実施の形態1,2で説明した検索回路で、検索のパイプライン処理を実現するための検索制御ブロック2を複数備えたものを、パケット転送装置に適用した場合について説明する。
【0080】
図16は、この発明にかかるパケット転送装置の全体の構成を示すブロック図である。このパケット転送装置は、物理レイヤの終端やパケットの転送先の検索などを行なう複数のインタフェース10a,10b,・・・と、それぞれのインタフェース10a,10b,・・・を接続し、パケットの交換を行うスイッチ11を備えて構成される。また、インタフェース10a,10b,・・・は、物理レイヤの終端を行なう物理レイヤ処理部12、受信したパケットの転送先などを求める検索を行なう受信側パケット処理部13、スイッチ11から送信されるパケットのカプセル化などを行なう送信側パケット処理部14を備えて構成される。
【0081】
図17は、受信側パケット処理部の構成を示すブロック図である。この図17に示されるように、受信側パケット処理部13は、物理レイヤ処理部12から送られてくるパケットを受信し、ヘッダのチェックなどを行なうパケット入力部20、パケットのヘッダから検索に必要な情報を抽出するヘッダ抽出部21、抽出されたヘッダからパケットの出力先を検索する検索回路22、検索結果をパケットに追加(挿入)するヘッダ挿入部23、パケットをスイッチ11が交換できるフォーマットに変換するパケット出力部24を備えて構成される。
【0082】
検索回路22は、CAMなどから構成される第1〜第3のテーブル(検索エンジン)1a〜1c、検索キーを分割して各テーブル1a〜1cに適切なキーを出力することで、正しい検索結果を求める第1〜第3の検索制御部2a〜2cを備えて構成される。この第1〜第3の検索制御部2a〜2cの機能は、基本的に実施の形態1,2で説明した検索制御部2と同じであるが、パイプライン処理を行なうことができるように検索結果およびキーを次段の検索制御部に通知する機能を有する。
【0083】
図21は、受信側パケット処理部における処理のタイミングの概要を示す図である。この図21に示されるように、パケット1,2,3,4,・・・と順に受信側パケット処理部13のパケット入力部20に入力されるものとする。まず、第1の検索制御部2aではパケット1の第1のテーブル1aを用いた検索処理が行われる。つぎのタイミングで、第1の検索制御部2aによる検索結果が検索制御部2に出力され、その検索結果と第2の分割検索キーの組合せによってパケット1の第2のテーブル1bを用いた検索処理が行われる。同時に、第1の検索制御部2aではつぎのパケット2の第1のテーブル1aを用いた検索処理が行われる。以後、同様にしてそれぞれの検索制御部2a〜2cでそれぞれ別々のパケットについての検索処理を同時に実行し、第3のテーブル1cで検索結果が得られると、パケット1から順にヘッダ挿入部23に出力される。なお、ここでは、テーブル1a〜1cと検索制御部2a〜2cが3つの場合を示したが、これらを2つに構成しても、4つ以上に構成してもよい。
【0084】
この実施の形態3によれば、複数の検索制御部2a〜2cを設け、パイプライン処理を実行可能なように構成したので、短い検索キーの検索の場合と同等のスループットを実現できるパケット転送装置を実現することが可能となる。
【0085】
実施の形態4.
実施の形態1〜3では、検索キーを複数の分割検索キーに分割して、第1の分割検索キーを用いて第1のテーブルを検索し、その検索した結果と残りの第2の分割検索キーを合わせた新たな検索キーで、つぎの第2のテーブルの検索を行うというように順次処理を行なうことで、データ長の長い検索キーの検索を行なっていた。しかし、この実施の形態4では、分割した分割検索キーで並行して、それぞれのテーブルを検索し、検索したそれぞれの結果データ(タグ)を合わせたものをキーとしてテーブルを検索し、最終的な結果を求める場合を説明する。
【0086】
図22は、この発明の実施の形態4による検索方法の概略を模式的に示す図である。検索回路に入力された検索キーは複数の分割検索キーに分割され、それぞれ同時に対応するテーブルに入力される。ここでは、2つの分割検索キーに分割する場合を例に挙げて説明する。図23は、図22のそれぞれのテーブルに格納されるエントリの内容を示す図である。これらのテーブル1a,1bに格納される内容は、上述した図13の例と同じものである。第1のテーブル1aには検索キーの上位64ビットのアドレスが格納されており、第2のテーブル1bには検索キーの下位64ビットのアドレスが格納されている。検索キーが2つの分割検索キーに分割され、それぞれの分割検索キーが第1と第2のテーブル1a,1bによって同時に検索される。そして、それぞれ、検索結果としてタグを検索制御部2に出力する。
【0087】
つぎに、検索制御部2は、それぞれのテーブル1a,1bから出力されたタグを組み合わせたものを最終検索キーとして、最終テーブル1dに出力し、最終テーブル1dから検索結果を得る。この最終テーブル1dは図23に示されるように、エントリとしてタグの組合せと、タグの長さを指定するマスク長と、タグの組合せに対する結果データが格納される。なお、図22と図23における第1と第2のテーブル1a,1bは、特許請求の範囲の第1のテーブルに相当し、最終テーブル1dは、同じく第2のテーブルに相当する。
【0088】
たとえば、図23で上述したアドレス「4000:0102:0304:0506:0708:090a:0b0c:0d0e」を有するパケット1が検索回路に入力した場合には、上位64ビットの第1の分割検索キー「4000:0102:0304:0506」と、下位64ビットの第2の分割検索キー「0708:090a:0b0c:0d0e」に分割され、第1の分割検索キーは第1のテーブル1aに、第2の分割検索キーは第2のテーブル1bにそれぞれ入力される。その結果、第1のテーブル1aではエントリ1に該当するので「タグa1」が出力され、第2のテーブル1bではエントリ2に該当するので「タグa2」が出力される。そして、これらのタグを組み合わせた最終検索キー「タグa1+タグa2」が最終テーブル1dに入力される。最終テーブル1dでは、エントリAに該当するので「結果データ」としてアドレスAが出力される。
【0089】
また、上述したアドレス「4000:0102:0304:0000:0708:090a:0b0c:0d04」を有するパケット2の場合は、第1の分割検索キー「4000:0102:0304:0000」は第1のテーブル1aのエントリBに一致するので、タグb1を取得し、第2の分割検索キー「0708:090a:0b0c:0d04」は第2のテーブル1bのエントリAに一致するので、タグa2を取得する。これらのタグを合わせた「タグb1+タグa2」で最終テーブル1dを検索すると、その結果エントリBに該当するので「結果データ」としてアドレスBを取得する(エントリBはマスク長が1つのタグ長となっているので、上位のタグがタグb1ならば、下位が何であってもエントリBに該当する)。
【0090】
さらに、上述したアドレス「4000:0102:0304:0506:0708:090a:0b0c:0000」を有するパケット3の場合は、第1の分割検索キー「4000:0102:0304:0506」は第1のテーブル1aのエントリAに一致するので、タグa1を取得し、第2の分割検索キー「0708:090a:0b0c:0000」は第2のテーブル1bに該当するエントリがないので、ミスヒットになる。ミスヒットになった場合はエントリに使用しないタグ値(この例ではx)を割り当てる。最後に、これらのタグを合わせた「タグa1+タグx」で最終テーブル1dを検索し、その結果ダミーエントリに該当するので、「結果データ」としてアドレスBを取得する。
【0091】
ただし、この場合も単にエントリのアドレスを分割して登録した各テーブル1a,1b,1dに、分割した検索キーで検索するだけでは、図24の従来の問題点で示した場合と同様に正しく検索できない場合があるため、実施の形態1,2のようにエントリ同士の包含関係を調べ、包含関係が存在する場合には、必要なテーブルにダミーエントリを追加したりフラグを立てたりする必要がある。
【0092】
なお、上述した説明では、検索キーを2分割した場合を例に挙げたが、検索キーを3分割以上する場合でも同様の処理手順でエントリの追加または削除処理を実現することができる。
【0093】
この実施の形態4によれば、「検索対象情報」に対する「結果データ」としてタグを設定し、検索キーを複数に分割した分割検索キーを、それぞれのテーブルで同時に検索して得られたタグ値を組み合わせたものを検索キーとして、最終テーブルを用いて検索を行うように構成したので、複数に分割したLPM検索でも正しく検索し、検索時間を短くすることができるようになる。
【0094】
なお、実施の形態1,2,4に示した検索回路を、図20に示される受信側パケット処理部13中の検索回路22に設置して、パケット転送装置を構成することができる。特に、実施の形態4の場合には、検索キーを分割した分割検索キーを同時に検索するので、長い検索キーであっても短い検索キーの場合と同等のスループットを実現できる。
【0095】
【発明の効果】
以上説明したように、この発明によれば、新たに追加・削除を行うエントリと、テーブルに格納されているエントリの包含関係を求め、その結果、両者の間に包含関係が存在する場合には、テーブルにダミーエントリの追加、削除、変更を行うように構成したので、複数に検索キーを分割したLPM検索でも、検索キーの分割によって分割検索キーに対する結果情報が得られなくなることを回避して、正しく検索を行うことができるという効果を有する。
【図面の簡単な説明】
【図1】この発明による検索回路の構成を模式的に示すブロック図である。
【図2】テーブルの構成の一例を示す図である。
【図3】エントリ追加時の全体の処理手順を示すフローチャートである。
【図4】包含関係を判定する条件を示す図である。
【図5】図4の包含関係1におけるダミーエントリの必要の有無を判定する条件を示す図である。
【図6】図4の包含関係2におけるダミーエントリの必要の有無を判定する条件を示す図である。
【図7】図4の包含関係3におけるダミーエントリの必要の有無を判定する条件を示す図である。
【図8】ダミーエントリの追加判定の結果とその処理内容を規定する図である。
【図9】エントリ追加の処理手順を示すフローチャートである。
【図10】エントリ削除時の全体の処理手順を示すフローチャートである。
【図11】エントリ削除処理の手順を示すフローチャートである。
【図12】ダミーエントリの削除内容を示す図である。
【図13】テーブルが2つの場合のエントリ追加の様子を示す図である。
【図14】テーブルが2つの場合のエントリを削除する様子を示す図である。
【図15】この発明によるテーブルの構成を示す図である。
【図16】この発明による検索回路のテーブルの実施の形態2の構成を示す図である。
【図17】この発明による検索回路の実施の形態2による検索の処理手順を示すフローチャートである。
【図18】テーブルが2つの場合のエントリの追加の様子を示す図である。
【図19】この発明によるパケット転送装置の全体の構成を示すブロック図である。
【図20】受信パケット処理部の構成を示すブロック図である。
【図21】受信側パケット処理部における処理のタイミングの概要を示す図である。
【図22】この発明の実施の形態4による検索方法の概略を模式的に示す図である。
【図23】この発明の実施の形態4のテーブルの一例を示す図である。
【図24】従来のLPM検索の問題点を説明するための図である。
【符号の説明】
1 テーブル(検索エンジン)、2 検索制御部、3 検索キー分割・タグ管理部、4 包含関係検出・ダミーエントリ管理部、10 インタフェース、11スイッチ、12 物理レイヤ処理部、13 受信側パケット処理部、14 送信側パケット処理部、20 パケット入力部、21 ヘッダ抽出部、22 検索回路、23 ヘッダ挿入部、24 パケット出力部。
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to an address search circuit that determines a transfer destination of a packet or the like based on an address written in a header of the packet, and a packet transfer device having the address search circuit.
[0002]
[Prior art]
2. Description of the Related Art Conventionally, a router that transfers a packet uses a CAM (Content Addressable Memory, associative memory) or the like in order to perform a high-speed search for obtaining information such as a transfer destination port from a packet destination IP (Internet Protocol) address. It is realized using devices. In addition, by combining with a tree which is a general search algorithm, a search exceeding a search key length supported by the device is supported, and search of information such as a transfer destination port from a long address is facilitated. For example, the destination address of a packet, which is a search key in a router, is divided into arbitrary numbers, and a table of a type corresponding to each of the divided search keys is provided. In this table, data corresponding to the divided search key or another data is stored. A table search device that stores a pointer or an index indicating the table of (1) and implements a longest match (Longest Match) (hereinafter referred to as LPM) search has been proposed (for example, see Patent Document 1).
[0003]
[Patent Document 1]
JP 2001-326679 A (Page 2, FIG. 2)
[0004]
[Problems to be solved by the invention]
However, when an LPM search is performed by dividing a search key into a plurality of pieces as in the above-described conventional technique, there is a problem that a mishit occurs. FIG. 24 is a diagram for explaining a problem of the conventional LPM search. Here, an example will be described in which a destination of a packet is determined using a destination IP address (hereinafter, referred to as an address) stored in an IPv6 packet. In addition, in order to simplify the description, a case where a search is performed by dividing a search key into two will be described as an example.
[0005]
FIG. 24A shows the contents of the table in the case where the search key is not divided. The "search target information" of the two entries A and B contains the address A, which is the "result" of each transfer destination. B is associated therewith. Further, an item “mask length” is provided for each entry. That is, in the case of a packet having the address “4000: 0102: 0304: 0506: 0708: 090a: 0b0c: 0d04” (in hexadecimal notation. The following address is also indicated in hexadecimal notation). , Since the packet matches the entry A, the packet is output (transferred) to the address A, and the address obtained as a result of masking with 48 bits is the address "4000: 0102: 0304: 0000: 0000: 0000: 0000: 0000: 0000". Indicates that the data is output (transferred) to the address B. Note that the entries A and B are the same up to the 48th bit, but in the LPM search, the result of the search target information that has a longer match with the search key has priority.
[0006]
FIG. 24B shows a table obtained by dividing the table shown in FIG. 24A into two parts. The first table has “search target information” including the upper 64 bits of the divided table and the corresponding table. The “mask length” and the “result data” are stored. The second table stores “search target information” including the lower 64 bits of the address of the divided search key, and the corresponding “mask length” and “result”. "Data" is stored. Although not shown, the entry A of the first table and the entry A of the second table are associated by an index or the like. The address stored in the entry B is stored in the first table but is stored in the second table since the destination can be determined by masking the upper 48 bits of the 128 bits. Is not stored.
[0007]
For example, in the case of the packet 1 having the address “4000: 0102: 0304: 0506: 0708: 090a: 0b0c: 0d04”, the search key address is the first divided search key “4000: 0102: 0304: 0506”. It is divided into a second divided search key “0708: 090a: 0b0c: 0d04”. First, the first divided search key matches the entry A in the first table, and information to be searched in the second table is obtained. Then, when the second divided search key is searched in the second table, it matches the entry A, and the address A is obtained as a result. In the case of the packet 2 having the address “4000: 0102: 0304: 0000: 0708: 090a: 0b0c: 0d04”, the search key address is the first divided search key “4000: 0102: 0304: 0000”. It is divided into the second divided search key “0708: 090a: 0b0c: 0d04”, and the first divided search key matches the entry B of the first table, so that the address B is obtained as a result.
[0008]
On the other hand, in the case of the packet 3 having the address “4000: 0102: 0304: 0506: 0708: 090a: 0b0c: 0000”, the address which is the search key is the first divided search key “4000: 0102: 0304: 0506”. And the second divided search key “0708: 090a: 0b0c: 0000”, but the search result cannot be obtained. That is, the first divided search key matches the entry A of the first table, and the information to be searched is obtained in the second table. However, when the second table is searched by the second divided search key, the second There is no entry in the table that matches the search condition, resulting in a mishit. However, since this packet 3 is a packet matching the entry B from FIG. 24A, it is necessary to actually obtain the address B as a result. As described above, in the case where the inclusion relationship exists between the entry A and the entry B, if the search key is divided and the LPM search is performed, there is a problem that such a miss occurs.
[0009]
The present invention has been made in view of the above, and provides a search circuit capable of obtaining a correct search result even when a search key is divided and performing an LPM search, and a packet transfer device using the search circuit. The purpose is to:
[0010]
[Means for Solving the Problems]
In order to achieve the above object, a search circuit according to the present invention divides an input search key into a plurality of divided search keys, and stores a corresponding table from a higher-order divided search key including the leading data in the search key. A search control means for performing a longest match search in order using, and obtaining a desired result information; and a table provided as many as the number of the divided search keys, and an entry including predetermined result information corresponding to the divided search key. And a table for storing, wherein the table has a dummy entry for preventing the result information for the divided search key from being lost due to the division of the search key.
[0011]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, preferred embodiments of a search circuit and a packet transfer device according to the present invention will be described in detail with reference to the accompanying drawings.
[0012]
Embodiment 1 FIG.
FIG. 1 is a block diagram schematically showing a configuration of a search circuit according to the present invention. This search circuit divides a search key into a plurality of divided search keys by a plurality of tables (search engines) 1a to 1c including a CAM for performing an LPM search, and performs a search using each of the tables 1a to 1c. A search control unit 2 to be executed, a search key division / tag management unit 3 for setting entries (search keys and results) for which entry addition / deletion has been requested from a management device (not shown) for managing a search circuit in the tables 1a to 1c. , And includes an inclusion relation detection / dummy entry management unit 4 which manages necessary information such as entry inclusion relations and provides the information at the time of setting by the search key division / tag management unit 3. In FIG. 1, the table such as the CAM is divided into a plurality of tables, but may be logically divided into a plurality of tables. Further, the case where three tables 1a to 1c are used is shown, but the present invention is not limited to this. Further, in the following description, a case where a destination IP address (address) stored in a packet is used as a search key and an output destination for transferring the packet to this address is searched will be described as an example. The application is not limited to this.
[0013]
The tables 1a to 1c are used to perform an LPM search for the search key (address) input to the search circuit and obtain a result of the output destination, and are composed of tables obtained by dividing the search key. As shown in FIG. 24A, the address of an entry whose address and its output destination (result) are determined is divided into a plurality of addresses (hereinafter, referred to as divided search key corresponding data), and the first bit is included. .. Are stored as entries in the first table, the second table,... In this specification, when comparing two tables, a table closer to the first table is called a relatively higher table, and a table farther from the first table is relatively lower. It is called a table.
[0014]
FIG. 2 is a diagram illustrating an example of a table configuration. As shown in FIG. 2, the table 1 includes “search target information” in which data corresponding to a divided search key, which is an address having a length corresponding to the divided search key, is stored. An item including a "mask length" in which a mask length indicating the length of data that needs to be matched is stored, and a "result data" in which a result when the entry matches the entry stored in the "search target information" is stored. Consists of When the output destination can be derived from the entry stored in the “search target information” masked by the mask length in the “result data”, the output destination is stored, and the output destination cannot be derived. Stores a tag required for performing a search in the next table that exists below. In the "search target information", an address having a length corresponding to the divided search key is stored in the first table 1a, but in the tables below the second table 1b, a tag corresponding to the length corresponding to the divided search key is stored. The search target information in which the addresses are combined is stored.
[0015]
The search control unit 2 has a function of dividing a search key into two or more divided search keys, outputting a key for executing an appropriate search to each of the tables 1a to 1c, and obtaining a correct search result. The search key is divided into the search keys by the same number as the tables 1a to 1c, and the same bits as the addresses (split search key corresponding data) in the search target information stored in the tables 1a to 1c. It is done to divide by number. In this specification, a first divided search key, a second divided search key, a third divided search key, and so on are referred to in order from a divided search key including a leading bit of the divided divided search keys. Further, similarly to the table, when two divided search keys are compared, a divided search key closer to the first divided search key is called a relatively higher divided search key, and the first divided search key is used as the first divided search key. The distant divided search key is called a relatively lower divided search key. When the search control unit 2 obtains a tag as a result of outputting the first divided search key to the first table 1a, for example, the combination of the tag and the next second divided search key is used as the first divided search key. 2 to the table 1b. When the output destination of the packet, which is the final result, is obtained from a certain table in this way, the search processing ends.
[0016]
The search key division / tag management unit 3 is configured to execute the inclusion relationship detection / dummy entry management unit 4 when a request for adding or deleting a new entry (divided search key corresponding data, result data) to the tables 1a to 1c is made. It has a function to set the search control unit 2 and the tables 1a to 1c so that the search can be performed correctly based on the instruction.
[0017]
When an entry is added to the tables 1a to 1c, the inclusion relation detection / dummy entry management unit 4 investigates the inclusion relation between the added entry and the entry in the tables 1a to 1c, etc. It manages whether or not the search can be performed, and if necessary, instructs the search key division / tag management unit 3 to add or delete a dummy entry based on the necessary information such as the inclusion relation. It has a function to provide.
[0018]
Note that the dummy entry is used to prevent a search result such as the packet 3 described above in the problem of the conventional LPM search from becoming a mishit and to obtain an original transfer destination. This is an entry to be inserted into Table 1. Specifically, when there is an inclusion relationship between the entry to be added and the entry in Table 1, an arbitrary address is added to the tag stored in the result data of the included entry. Has a data structure that includes the “division target information”, the “mask length” using the tag length as the mask length, and the “result data” that stores the output destination that is the final result information of the enclosing entry. .
[0019]
Next, the operation of the inclusion relation detection / dummy entry management unit 4 will be described with reference to FIGS. The inclusion relationship detection / dummy entry management unit 4 performs two processes of adding and deleting entries in consideration of the inclusion relationship with the entries already stored in the tables 1a to 1c. The addition will be described, and then the deletion of the entry will be described.
[0020]
FIG. 3 is a flowchart showing the overall processing procedure when adding an entry. First, when there is a request to add an entry from the management device, the inclusion relation detection / dummy entry management unit 4 sets the search key of the entry to be added to the first to the first of the divided search key lengths specified in the respective tables 1a to 1c. The data is divided into third divided search key corresponding data (step S1). Next, it is determined how the entry to be added has an inclusion relationship with other entries, and it is determined whether or not a dummy entry is necessary, and if so, what kind of dummy entry is required ( Step S2). Next, an entry is added to each of the tables 1a to 1c (step S3), and it is determined whether the entry addition process is completed or a dummy entry is added based on the result of step S2 (step S4). If it is determined that it is not necessary to add a dummy entry (No in step S4), the process is terminated, and if it is determined that a dummy entry needs to be added (Yes in step S4), Then, a dummy entry is added from the result obtained in step S2 (step S5), and the process ends.
[0021]
Here, details of the inclusion relation detection processing in step S2 will be described. 4 to 8 are diagrams showing the contents of determination of inclusion relation detection. It should be noted that these diagrams showing the contents of the judgment of inclusion relation detection are the same as the judgment of inclusion relation detection performed when an entry is deleted, which will be described later. ing. FIG. 4 is for determining whether or not a dummy entry is necessary based on the inclusion relationship between the entry to be added and the entry already stored in the table. This inclusion relation is determined before the search key of the entry to be added is divided. If the entry to be added (hereinafter, referred to as an additional entry) does not include another entry and is not included in another entry, the dummy entry is not necessary.
[0022]
If the additional entry does not include another entry and is included in another entry, the presence / absence of a dummy entry is determined in accordance with the inclusion relationship 1 shown in FIG. FIG. 5 is a diagram illustrating a result of determining whether or not a dummy entry is necessary based on the relationship between the mask length of an additional entry and the mask length of an entry including the additional entry in the inclusion relationship 1. Here, the area 1 refers to a case where the mask length is equal to or less than the length of the divided search key corresponding data stored in the first table 1a (hereinafter, referred to as a first divided search key length). Indicates that the mask length is longer than the first divided search key length, and the first divided search key length and the length of the divided search key corresponding data stored in the second table 1b (hereinafter referred to as the second divided search key Area 3), and region 3 refers to a case where the mask length is longer than the sum of the first divided search key length and the second divided search key length. When the additional entry is included in a plurality of entries, the determination in FIG. 5 is applied to the entry having the longest mask length.
[0023]
For example, if both the mask length of the additional entry and the mask length of the entry including the additional entry are in the area 1, there is no need to add a dummy entry. Further, when the mask length of the additional entry is in the area 2 and the mask length of the entry including the additional entry is in the area 1, the processing of “addition 1-1” of the dummy entry shown in FIG. Will be determined. FIG. 8 is a diagram that specifies the result of the dummy entry addition determination and the processing content thereof. For example, in the case of “addition 1-1”, a process of adding a dummy entry of an entry including an additional entry to the second table 1b is selected.
[0024]
In FIG. 4, when the additional entry includes another entry and is not included in the other entry, the presence / absence of a dummy entry is determined corresponding to the inclusion relationship 2 shown in FIG. You. In FIG. 6, it is determined whether or not a dummy entry is necessary based on the relationship between the mask length of the additional entry and the mask length of the entry included in the additional entry. Then, as a result of this determination, it is determined that addition or change processing of the dummy entry defined in FIG. 8 is necessary. Here, when the additional entry includes a plurality of entries doubly, the determination in FIG. 6 is applied to the entry having the shortest mask length. Further, when the additional entry includes a plurality of entries but is not in a relationship of doubly including, the determination in FIG. 6 is applied to each entry (that is, the plurality of entries are included). When A and B and the additional entry C are not A⊂C, B⊂C and neither A⊆B nor B⊆A, the determination of FIG. 6 is performed for both the entry A and the entry B).
[0025]
Further, in FIG. 4, when the additional entry includes another entry and is included in another entry, the presence / absence of a dummy entry is determined corresponding to the inclusion relationship 3 shown in FIG. . FIG. 7 is a diagram for determining whether or not a dummy entry is necessary based on the relationship between the mask length of the additional entry, the mask length of the entry included in the additional entry, and the mask length of the entry including the additional entry. is there. Then, as a result of this determination, it is determined that addition or change processing of the dummy entry defined in FIG. 8 is necessary. Here, when the additional entry includes a plurality of entries doubly, the determination in FIG. 7 is applied to the entry having the shortest mask length. If the additional entry includes a plurality of entries but does not have a double inclusion relationship, the determination of FIG. 7 is applied to each entry (ie, a plurality of entries). If the entries C to be added, A and B, are not A⊂C, B⊂C and neither A⊆B nor B⊆A, the determination in FIG. 7 is performed for both the entries A and B). Further, when the additional entry is included in a plurality of entries, the determination in FIG. 7 is applied to the entry having the longest mask length.
[0026]
As described above, the inclusion relationship between the additional entry and the entry already stored in the tables 1a to 1c is determined in consideration of the mask length between the entries. Various algorithms for obtaining the above-described inclusion relation can be considered. For example, a method disclosed in Japanese Patent Application Laid-Open No. 11-103313 can be applied.
[0027]
Next, the details of the entry addition process in step S3 in FIG. 3 will be described. Here, the processing procedure is shown on the premise that the entry has already been checked by the management device so as not to add the already registered entry.
[0028]
FIG. 9 is a flowchart illustrating a procedure for adding an entry. First, the inclusion relation detection / dummy entry management unit 4 determines whether or not the same entry as the first divided search key corresponding data of the entry exists in the first table for adding the entry (step S101). ). At this time, it is different from a normal search in that not only the first divided search key corresponding data but also the mask length is taken into consideration. You have to). When it is determined that there is no entry that is the same as the first divided search key corresponding data (No in step S101), the mask length of the additional entry is determined (step S102). If the mask length of the additional entry is “mask length ≦ first divided search key length (area 1)” (Yes in step S102), the entry is added to the first table 1a (step S102). S103). This flow is a normal flow when the mask length of the additional entry is equal to or less than the first divided search key length.
[0029]
When it is determined in step S102 that the mask length is not the area 1 (in the case of No in step S102), the inclusion relation detection / dummy entry management unit 4 uses the unused second table 1b for the second table 1b. A tag (hereinafter, referred to as tag 1) is obtained (step S104), and the first divided search key corresponding data is set as “search target information”, and the obtained tag 1 is set as an entry to be set as “result data” in the first table. 1a (step S105). Next, the mask length of the additional entry is determined (step S106). At this time, it is determined that the mask length of the additional entry is “first divided search key length (area 1) <mask length ≦ first divided search key length + second divided search key length (area 2)”. If it is determined (Yes in step S106), in the second table 1b, the combination of the tag 1 and the data corresponding to the second divided search key is set to “search target information”, and the result of the additional entry is set to “result data”. , An entry is added (step S107). This flow is performed when the mask length of the additional entry is longer than the first split search key length and is equal to or less than the sum of the first split search key length and the second split search key length. This is a flow when the same entry has not been registered yet.
[0030]
If it is determined in step S106 that the mask length of the additional entry is not the area 2 (No in step S106), the inclusion relation detection / dummy entry management unit 4 uses the third table 1c that is not used. (Hereinafter, referred to as tag 2) (step S108), the combination of tag 1 and the data corresponding to the second divided search key is referred to as “search target information”, and the obtained tag 2 is referred to as “result data”. An entry to be added is added to the second table 1b (step S109). Then, the acquired tag 2 and the third divided search key corresponding data are added to the third table 1c as “search target information” and the result of the additional entry is set as “result data” (step S110). This flow is performed when the mask length of the additional entry is longer than the sum of the first divided search key length and the second divided search key length, and the first divided search key corresponding data + the second divided search key corresponding data This is a flow in the case where the same entry as has not been registered yet.
[0031]
On the other hand, if an entry already exists in the first table 1a in step S101 (Yes in step S101), it is determined whether the result of the entry is a tag (step S111). If it is determined that the result of the entry is not a tag (No in step S111), the entry is deleted from the first table 1a (step S112). This entry is for the case where the mask length is equal to the length of the area 1, and a dummy entry for this entry will be added later. After that, the processing after step S102 described above is performed. This flow is a special case flow in which there is already the same entry as the entry to be added to the first table 1a, and the mask length of the entry is equal to the first divided search key length.
[0032]
In such a situation, when the first divided search key corresponding data is equal and the mask length is the area 2 or 3, the tag information must be registered as “result data” in the original entry. The entry is deleted in step S112. However, although the entry is deleted here, a process of adding an entry in place of the deleted entry to the second table 1b is performed by a dummy entry addition process performed later.
[0033]
When it is determined in step S111 that the result of the entry is a tag (Yes in step S111), the inclusion detection / dummy entry management unit 4 sets the tag value (hereinafter, this tag value is also referred to as the tag value). Tag 1) is obtained from the first table 1a (step S113). Next, the mask length of the additional entry is determined (step S114). If it is determined that the mask length of the additional entry is not the area 1 (No in step S114), it is determined whether or not there is an entry of the acquired tag 1 + second divided search key corresponding data in the second table 1b. Is determined (step S115). If it is determined that there is no entry of the acquired tag 1 + second divided search key corresponding data in the second table 1b (No in step S115), the number of tags 1 used in the second table 1b is calculated. The value is incremented, and the processing after step S106 is performed. This flow is performed when the mask length is longer than the first divided search key length, when an entry having the same value as the first divided search key corresponding data is already registered, and when the second divided search key corresponding data is Is a flow when an entry of the same value has not been registered yet.
[0034]
If it is determined in the above-described step S115 that there is an entry of tag 1 + second divided search key corresponding data in the second table 1b (Yes in step S115), the result of the entry is a tag. It is determined whether or not it is (step S117). If it is determined that the entry is not a tag (No in step S117), this entry is deleted from the second table 1b (step S118). After that, the processing after step S106 described above is performed. This flow is a flow in the case where there is already an entry in the first and second tables 1a and 1b, and the mask length of the entry is equal to the sum of the first divided search key length + the second divided search key length. is there.
[0035]
If it is determined in step S117 that the entry result is a tag (Yes in step S117), the tag value (hereinafter, this tag value is also referred to as tag 2) is obtained (step S119). . Next, the mask length of the additional entry is determined (step S120). If the mask length of the additional entry is not the area 2, that is, if the mask length is the area 3 (No in step S120), the use number of the tag 2 in the third table 1c is incremented, and the processing in step S110 is performed. . This flow is for the case where the mask length is longer than the sum of the first divided search key length + the second divided search key length, and entries of the same value are registered up to the first and second divided search key corresponding data. If it is.
[0036]
On the other hand, when it is determined in step S120 that the mask length of the additional entry is the area 2 (in the case of Yes in step S120), the process ends without adding an entry. The processing for this entry is performed when adding a dummy entry.
[0037]
Also, when it is determined in step S114 that the mask length of the additional entry is the area 1 (in the case of Yes in step S114), the process ends without adding an entry. The processing for this entry is performed when a dummy entry is added.
[0038]
As described above, entries are added to the first to third tables 1a to 1c.
[0039]
Next, the dummy entry adding process in step S5 of FIG. 3 will be described. FIG. 8 defines the contents of processing for adding a dummy entry to the result of the inclusion relation determination processing of FIGS. 5 to 7. After the entry addition process shown in FIG. 9 is completed, a dummy entry addition process or a change process is performed on each of the tables 1a to 1c based on the determination result of the inclusion relation in step S2 regarding the additional entry and the processing content of FIG. .
[0040]
As described above, when a new entry is added to the tables 1a to 1c, a mishit at the time of search that occurs because the inclusion relationship between the additional entry and the entry already stored in the table is not considered is considered. Dummy entries to prevent this are added as needed.
[0041]
Next, the deletion of an entry by the inclusion relation detection / dummy entry management unit 4 will be described. FIG. 10 is a flowchart showing the entire processing procedure when deleting an entry. First, when there is an entry deletion request from the management device, the search key is divided into first to third divided search key corresponding data having the divided search key lengths specified in the tables 1a to 1c, respectively (step S11). Next, it is determined whether the dummy entry becomes unnecessary by deleting the entry based on the inclusion relation with other entries (step S12), and the entries of the respective tables 1a to 1c are deleted (step S13). .
[0042]
Thereafter, based on the result of step S12, it is determined whether to terminate the entry deletion processing or further delete the dummy entry (step S14). If there is no deletion of the dummy entry (No in step S14), the process ends. If a dummy entry has been deleted (Yes in step S14), unnecessary dummy entries are deleted (step S15), and the process ends. Note that the inclusion relation detection processing in step S12 is the same as the case described with reference to FIGS. 4 to 7 in the entry addition processing, and thus description thereof will be omitted. In this case, however, FIG. 12 that defines the content of the deletion process is used instead of FIG. 8 that defines the content of the addition process.
[0043]
Here, the details of the entry deletion processing in step S13 described above will be described. Note that the processing procedure is shown on the assumption that the management apparatus checks the entry so that the unregistered entry is not deleted.
[0044]
FIG. 10 is a flowchart illustrating the procedure of the entry deletion process. First, in order to delete an entry, the inclusion relation detection / dummy entry management unit 4 determines whether the result of the entry to be deleted in the first table 1a is a tag (step S201). If it is determined that the result of the entry in the first table 1a is not a tag (No in step S201), the entry of the first divided search key corresponding data is deleted from the first table 1a (step S213). ), End the entry deletion process. This flow is a normal flow when the mask length of the entry to be deleted is the area 1.
[0045]
Next, in step S201, if it is determined that the result of the entry in the first table 1a is a tag (Yes in step S201), the inclusion relation detection / dummy entry management unit 4 Is determined (step S202). Here, when it is determined that the mask length of the entry to be deleted is not the area 1 (No in step S202), it is determined whether or not the result of the entry in the second table 1b is a tag (step S202). S203). When it is determined that the result of the entry in the second table 1b is not a tag (No in step S203), the entry of the data corresponding to the second divided search key is deleted from the second table 1b (step S209). ). Thereafter, the number of used tags 1 in the second table 1b is decremented (step S210), and it is determined whether or not the number of used tags 1 has become 0 (step S211). If the number of uses of the tag 1 has become 0 (Yes in step S211), the corresponding tag 1 is released (step S212), and the processing in step S213 described above is performed. This flow is a flow when the mask length of the entry to be deleted is the area 2 and there is no other entry having the same value as the first divided search key corresponding data.
[0046]
On the other hand, if it is determined in step S211 that the number of uses of the tag 1 is not 0 (No in step S211), the process ends. This flow is a flow when the mask length of the entry to be deleted is the area 2 and there is another entry having the same value as the first divided search key corresponding data.
[0047]
If it is determined in step S203 that the result of the entry in the second table 1b is a tag (Yes in step S203), the mask length of the entry to be deleted is determined (step S204). If it is determined that the mask length is not the area 2 (No in step S204), the entry is deleted from the third table 1c (step S205). Thereafter, the number of used tags 2 in the third table 1c is decremented (step S206), and it is determined whether the number of used tags 2 has become 0 (step S207). If the number of uses of the tag 2 has become 0 (Yes in step S207), the corresponding tag 2 is released (step S208), and the processing from step S206 described above is performed. This flow is a flow in a case where the mask length of the entry to be deleted is the entry of the area 3 and there is no other entry having the same value up to the second divided search key corresponding data.
[0048]
On the other hand, if it is determined in step S207 that the number of uses of the tag 2 is not 0 (No in step S207), the process is terminated. This flow is a flow when the mask length of the entry to be deleted is the area 3 and there is another entry having the same value up to the second divided search key corresponding data.
[0049]
If it is determined in step S204 that the mask length is the area 2 (Yes in step S204), the process ends. This flow is when the mask length of the entry to be deleted is equal to the sum of the first divided search key length + the second divided search key length, and there is another entry having the same value up to the second divided search key corresponding data. It is a flow of a case. Since the entry itself to be deleted is registered as a dummy entry, it is deleted in the dummy entry deletion processing step.
[0050]
If it is determined in step S202 that the mask length is the area 1 (Yes in step S202), the process ends. This flow is a flow when the mask length of the entry to be deleted is equal to the sum of the first divided search key lengths and there is another entry having the same value as the first divided search key corresponding data. Also in this flow, this entry itself is deleted in the process of deleting the dummy entry.
[0051]
As described above, the entry is deleted from the first to third tables 1a to 1c.
[0052]
Next, the dummy entry deletion processing in step S15 in FIG. 10 will be described. FIG. 12 shows the contents of deletion of the dummy entry. FIG. 12 defines the contents of the process of deleting the dummy entry with respect to the result of the inclusion relationship determination process of FIGS. 4 to 7. After the entry deletion process shown in FIG. 11 is completed, a dummy entry deletion process or a change process is performed on each table based on the determination result of the inclusion relation in step S12 regarding the entry to be deleted and the processing content of FIG.
[0053]
As described above, when an entry is deleted from the tables 1a to 1c, the dummy entry is deleted including the inclusion relation between the entry to be deleted and the entry already stored in the table. .
[0054]
In the above description, the case where the search key is divided into three is described as an example. However, even when the search key is divided into two or four or more, entry addition or deletion processing can be realized by the same processing procedure. .
[0055]
Here, a dummy entry addition process, a deletion process, and a search process when a dummy entry is added will be described with specific examples. First, the process of adding a dummy entry will be described by taking as an example a case where a new entry is added to two tables in which one entry is already stored.
[0056]
FIG. 13 is a diagram showing how entries are added when there are two tables. FIG. 13A shows the state of the table before adding a new entry. Here, an entry corresponding to the entry A of the table of FIG. 24A is stored in the first and second tables 1a and 1b. In these tables 1a and 1b, the address (search key) of the table of FIG. 24A is "4000: 0102: 0304: 0000: 0000: 0000: 0000: 0000", the mask length is 48 bits, and the transfer is performed. When adding the entry B whose address is the address B, first, the inclusion relation detection / dummy entry management unit 4 sets the address (search key) to the first divided search key “4000: 0102: 0304: 0000”. It is divided into a second divided search key “0000: 0000: 0000: 0000”.
[0057]
When examining the inclusion relationship between the additional entry and the entries stored in the tables 1a and 1b, the additional entry includes the entry A but does not include other entries, and therefore, corresponds to the inclusion relationship 2 from FIG. I do. Further, since the mask length (48 bits) of the additional entry is equal to or less than the first divided search key length (64 bits), and the mask length of entry A is 128 bits and is in area 2, the "add dummy entry" in FIG. 2-1 ".
[0058]
In the first table 1a, the same entry as the first divided search key corresponding data does not exist (No in step S101), and the mask length (48 bits) is in the area 1 (Yes in step S102). ), The first divided search key corresponding data is added to the first table 1a. Here, as shown in FIG. 13B, “4000: 0102: 0304: 0000” is added to “search target information”, “48” is added to “mask length”, and “48” is added to “result data”. “Address B” is added.
[0059]
Then, the result of the inclusion relationship is “addition of dummy entry 2-1”, which performs the processing of “addition of dummy entry of added entry to second table” from FIG. Therefore, in the second table 1b, the “search target information” is “tag α + 0000: 0000: 0000: 0000”, the “mask length” is “n” which is the number of bits of tag α, and the “result A dummy entry whose “data” is “address B” is added. The result is shown in FIG. Note that the numerical value added after the tag α of the “search target information” can be set to an arbitrary numerical value because the “mask length” is the number of bits of the tag α.
[0060]
Next, a case where an entry is deleted from two tables will be described with reference to FIG. FIG. 14 shows how entries are deleted from the two tables, and FIG. 14A corresponds to the state shown in FIG. 13C. As described above, the entry B to be deleted corresponds to the inclusion relation 2 in FIG. 4 with respect to the other entries in the tables 1a and 1b, and corresponds to “dummy entry deletion 2-1” in FIG.
[0061]
Since the "result data" of the entry B of the first divided search key corresponding data in the first table 1a is not a tag (No in step S201), the first divided search key corresponding data The entry is deleted (step S213). This state is shown in FIG.
[0062]
Further, the processing of “dummy entry deletion 2-1” to “deletion of dummy entry of deleted entry in second table” in FIG. 12 is executed. Therefore, the dummy entry of the entry deleted in the first table 1a, that is, “search target information” is “tag α + 0000: 0000: 0000: 0000”, “mask length” is “n”, and “result data” Is deleted from the second table 1b. The result is shown in FIG.
[0063]
Next, a search procedure using a table having dummy entries will be described with reference to FIG. FIG. 15 shows an example in which the first embodiment is applied to the conventional example shown in FIG. 24, which is the same as FIG. 13C, and is inserted into the second table 1b by the search circuit. Stored dummy entry. In this dummy entry, a mask length is set so that portions other than the tag are not compared, and the “result data” stores the same result as that of the entry B. By doing so, the packet 3 with the search key “4000: 0102: 0304: 0506: 0708: 090a: 0b0c: 0000” that could not be searched correctly in the conventional example of FIG. The key “4000: 0102: 0304: 0506” hits the entry A of the first table 1a to acquire the tag α, and then the tag α + the second divided search key “tag α + 0708: 090a: 0b0c: 0000” "Hits the dummy entry of the second table 1b whose mask length is the length of the tag α, so that it is possible to finally obtain the address B which is a correct result.
[0064]
By adding a dummy entry in this manner, the search control unit 2 and the table 1 can correctly search even in an LPM search in which a long search key is divided by exactly the same processing as before.
[0065]
According to the first embodiment, the inclusion relation between the entry to be newly added / deleted and the entry stored in the table 1 is obtained. Since addition / deletion and change of the dummy entry are performed in 1a to 1c, it is possible to correctly perform the search even in the LPM search divided into a plurality.
[0066]
Embodiment 2 FIG.
In the first embodiment, by adding a dummy entry, a plurality of divided LPM searches can be correctly performed. In the second embodiment, a flag is added to the contents of the entry, and this search is performed at the time of the search. A description will be given of a search circuit capable of correctly performing a search even in a plurality of divided LPM searches by selecting a result according to the value of a flag.
[0067]
FIG. 16 is a diagram showing a configuration of a search circuit table according to the second embodiment of the present invention. This table includes items of a “search key” serving as a key when performing a search and a “search result” storing a result for an entry that matches the search key. The “search key” includes items of “search target information” including a combination of a tag and a divided search key, and “mask length” indicating a mask length. The “search result” includes a “processing continuation flag” indicating whether or not to search for the next table, a “tag” storing a tag that is a part of a key when searching for the next table, It is configured to include “result data” in which the final result is stored and “data valid flag” indicating whether the result data is valid. In the case of the item “search target information”, in the case of the highest table, only the divided search key corresponding data is stored.
[0068]
In the following description, in the flags stored in the “processing continuation flag”, “1” indicates a case where the next table is searched, and a numerical value other than “1” (for example, “0”) is , The case where the next table is not searched. Further, in the flags stored in the “data valid flag”, “1” indicates valid, and a numerical value other than “1” (for example, “0”) indicates invalid. This definition is made in the description of this specification, and each flag may be defined differently from the above.
[0069]
In the second embodiment, by setting the "data valid flag" to valid and registering the data of the content added by the dummy entry in the "result data", the same effect as when the dummy entry is added can be obtained. I have to. The other configuration of the search circuit according to the second embodiment is the same as that of FIG. 1 of the above-described first embodiment, and a description thereof will be omitted.
[0070]
The entry addition / deletion processing in the second embodiment is performed in substantially the same procedure as in the first embodiment, but the processing for adding a dummy entry is performed by setting the “data valid flag” to be valid. The difference between the process of registering the result data (result information) of the included entry in the “result data” of the included entry and the process of deleting the dummy entry is the “data valid flag”. The difference lies in the process of invalidating.
[0071]
Next, a search method by the search circuit will be described. FIG. 17 is a flowchart of a search procedure according to the second embodiment of the search circuit according to the present invention. Also in this description, a case where the search key is divided into three will be described as an example. First, the search control unit 2 searches the first table 1a using the first divided search key obtained by dividing the search key (step S301), and determines whether there is an entry (step S302). . If there is an entry (Yes in step S302), it is determined whether the processing continuation flag of the entry is 1 (step S303), and if the processing continuation flag is 1 (Yes in step S303). ), A search is performed using the combination of the tag obtained as a result and the second divided search key using the second table 1b (step S304), and it is determined whether or not there is an entry in the second table 1b (step S304). Step S305). If there is an entry in the second table 1b (Yes in step S305), it is determined whether or not the processing continuation flag of the entry is 1 (step S306), and if the processing continuation flag is 1 (step S306). In the case of Yes in step S306), the third table 1c is searched using the combination of the tag obtained as a result and the third divided search key (step S307), and whether or not there is an entry in the third table 1c Is determined (step S308). If there is an entry in the third table 1c (Yes in step S308), it is determined whether the data valid flag of the third search result is 1 (step S309), and the data valid flag is set to 1 In the case of, the third search result is output as a valid result (step S310), and the search processing ends.
[0072]
If the processing continuation flag of the entry in the second table 1b is not 1 in step S306 (No in step S306), or if there is no entry in the third table 1c in step S308 (No in step S308) ), It is determined whether or not the data valid flag of the second search result is 1 (step S311). If the data valid flag of the second search result is 1 (Yes in step S311), the second search result is output as a valid result (step S312), and the search process ends.
[0073]
Further, if the processing continuation flag of the entry in the first table 1a is not 1 in step S303 (No in step S303), if there is no entry in the second table 1b in step S305 (no in step S305) Alternatively, if the data valid flag of the second search result is not 1 in step S311 (No in step S311), it is determined whether the data valid flag of the first search result is 1 (step S313). . If the data valid flag of the first search result is 1 (Yes in step S313), the first search result is output as a valid result (step S314), and the search process ends.
[0074]
If there is no entry in the first table 1a in step S302 (No in step S302), if the data valid flag of the third search result is not 1 in step S309 (no in step S309), or If the data valid flag of the first search result is not 1 in S313 (No in Step S313), the result is output as a mishit (Step S315), and the search process ends.
[0075]
By performing the processing in such a procedure, for example, in the search when a packet is input, if a miss is found in the first search (No in step S302), it is determined to be a miss. In the case of a mishit in the first or third search (steps S304 and S307) (No in each of steps S305 and S308), it is determined whether the data valid flag of the previous search result is valid. (Steps S311 and S313) If the result is invalid, it is regarded as a mishit. If the result is valid, it is possible to output the retrieved result as a final result. Note that the search is performed when the processing continuation flag is 1 in the previous search except for the first time (in the case of Yes in each of steps S303 and S306) (steps S301, S304, and S307).
[0076]
In the above description, the case where the search key is divided into three is described as an example. However, even when the search key is divided into two or four or more, entry addition or deletion processing and search processing are realized by the same processing procedure. can do.
[0077]
FIG. 18 is a diagram showing a case where the example described in FIG. 13 is applied to the case of the second embodiment. As shown in FIG. 18, when there is an inclusion relationship between the divided search key corresponding data of the entries A and B, the “tag” of the included entry A obtained from the first table 1 a The tag used for the next search in the table 1b is stored, the address B which is the result data (result information) of the included entry B is stored in the "result data", and the "data valid flag" is validated ( 1). With such a data structure, in the case of the packet 3 having the above-mentioned address “4000: 0102: 0304: 0050: 090a: 0b0c: 0000”, the first divided search key “4000: 0102: 0304: 0506” Since it matches the entry A in the first table 1a, the tag α is obtained as a “tag”, and the “processing continuation flag” is 1, so that the search in the second table 1b is further continued. However, since the second divided search key “0708: 090a: 0b0c: 0000” does not match any entry in the second table 1b, returning to the first table 1a, the “data valid flag” is set to 1 ( Valid), correct search can be performed by using the address B stored in the “result data” as the result of the packet 3.
[0078]
According to the second embodiment, the inclusion relation of the entry to be newly added / deleted is determined, and the data valid flag and the resulting data are registered in the tables 1a to 1c based on the determination result. Even in the case of a mishit, if the data valid flag of the previous search result is valid, the search result can be determined. As a result, the search can be correctly performed even in the LPM search divided into a plurality.
[0079]
Embodiment 3 FIG.
In the third embodiment, a case will be described in which the search circuit described in the first and second embodiments, which includes a plurality of search control blocks 2 for implementing search pipeline processing, is applied to a packet transfer device. I do.
[0080]
FIG. 16 is a block diagram showing the overall configuration of the packet transfer device according to the present invention. This packet transfer device connects a plurality of interfaces 10a, 10b,... For searching for the termination of the physical layer and the transfer destination of the packet, and the respective interfaces 10a, 10b,. A switch 11 is provided. The interfaces 10a, 10b,... Include a physical layer processing unit 12 for terminating the physical layer, a receiving side packet processing unit 13 for searching for a destination of a received packet, and a packet transmitted from the switch 11. It is provided with a transmission side packet processing unit 14 for encapsulating the data.
[0081]
FIG. 17 is a block diagram illustrating the configuration of the receiving-side packet processing unit. As shown in FIG. 17, the receiving-side packet processing unit 13 receives a packet transmitted from the physical layer processing unit 12 and checks the header and the like. Header extraction unit 21 for extracting appropriate information, search circuit 22 for searching the output destination of the packet from the extracted header, header insertion unit 23 for adding (inserting) the search result to the packet, and packet in a format that switch 11 can exchange. It comprises a packet output unit 24 for conversion.
[0082]
The search circuit 22 corrects the search results by dividing the search keys into first to third tables (search engines) 1a to 1c composed of a CAM or the like and outputting appropriate keys to the tables 1a to 1c. The first to third search control units 2a to 2c for determining the The functions of the first to third search control units 2a to 2c are basically the same as those of the search control unit 2 described in the first and second embodiments. It has a function of notifying the search control unit of the next stage of the result and the key.
[0083]
FIG. 21 is a diagram illustrating an outline of processing timing in the receiving-side packet processing unit. As shown in FIG. 21, it is assumed that packets 1, 2, 3, 4,... Are sequentially input to the packet input unit 20 of the receiving-side packet processing unit 13. First, in the first search control unit 2a, a search process using the first table 1a of the packet 1 is performed. At the next timing, a search result by the first search control unit 2a is output to the search control unit 2, and a search process using the second table 1b of the packet 1 by a combination of the search result and the second divided search key Is performed. At the same time, the first search control unit 2a performs a search process using the first table 1a of the next packet 2. Thereafter, in the same manner, the respective search control units 2a to 2c simultaneously execute search processes for different packets simultaneously, and when the search results are obtained in the third table 1c, output to the header insertion unit 23 in order from packet 1. Is done. Here, although the case where there are three tables 1a to 1c and three search control units 2a to 2c has been described, these may be configured as two or four or more.
[0084]
According to the third embodiment, since a plurality of search control units 2a to 2c are provided and configured to be able to execute pipeline processing, a packet transfer device capable of realizing the same throughput as in the case of searching for a short search key Can be realized.
[0085]
Embodiment 4 FIG.
In the first to third embodiments, the search key is divided into a plurality of divided search keys, the first table is searched using the first divided search key, and the search result and the remaining second divided search key are used. A search key having a long data length has been searched by sequentially performing processing such as searching the next second table using a new search key with the same key. However, in the fourth embodiment, each table is searched in parallel with the divided search key, and the table is searched using a combination of the searched result data (tags) as a key. The case where the result is obtained will be described.
[0086]
FIG. 22 is a diagram schematically showing an outline of a search method according to the fourth embodiment of the present invention. The search key input to the search circuit is divided into a plurality of divided search keys, each of which is simultaneously input to the corresponding table. Here, a case of dividing into two divided search keys will be described as an example. FIG. 23 is a diagram showing the contents of entries stored in each table of FIG. The contents stored in these tables 1a and 1b are the same as those in the example of FIG. 13 described above. The first table 1a stores the upper 64 bits of the address of the search key, and the second table 1b stores the lower 64 bits of the address of the search key. The search key is split into two split search keys, and each of the split search keys is searched simultaneously by the first and second tables 1a and 1b. Then, the tag is output to the search control unit 2 as a search result.
[0087]
Next, the search control unit 2 outputs a combination of tags output from the tables 1a and 1b to the final table 1d as a final search key, and obtains a search result from the final table 1d. As shown in FIG. 23, the final table 1d stores, as entries, a tag combination, a mask length designating the tag length, and the result data for the tag combination. Note that the first and second tables 1a and 1b in FIGS. 22 and 23 correspond to the first table in the claims, and the final table 1d similarly corresponds to the second table.
[0088]
For example, when the packet 1 having the address “4000: 0102: 0304: 0506: 090a: 0b0c: 0d0e” described above with reference to FIG. 23 is input to the search circuit, the first divided search key “64 bits” 4000: 0102: 0304: 0506 "and a second divided search key" 0708: 090a: 0b0c: 0d0e "of lower 64 bits, and the first divided search key is stored in the first table 1a in the second table. The split search key is input to each of the second tables 1b. As a result, "tag a1" is output because it corresponds to entry 1 in the first table 1a, and "tag a2" is output because it corresponds to entry 2 in the second table 1b. Then, the final search key “tag a1 + tag a2” combining these tags is input to the final table 1d. In the final table 1d, since the entry A corresponds to the entry A, the address A is output as “result data”.
[0089]
In the case of the packet 2 having the address “4000: 0102: 0304: 0000: 0708: 0090a: 0b0c: 0d04”, the first divided search key “4000: 0102: 0304: 0000” is stored in the first table. Since it matches the entry B of 1a, the tag b1 is obtained. Since the second divided search key “0708: 090a: 0b0c: 0d04” matches the entry A of the second table 1b, the tag a2 is obtained. When the final table 1d is searched with “tag b1 + tag a2” combining these tags, address B is obtained as “result data” because the result corresponds to entry B (entry B has a mask length of one tag length and a tag length of one tag). Therefore, if the upper tag is tag b1, whatever the lower tag is, it corresponds to entry B).
[0090]
Further, in the case of the packet 3 having the above-mentioned address “4000: 0102: 0304: 0506: 0070: 090a: 0b0c: 0000”, the first divided search key “4000: 0102: 0304: 0506” is stored in the first table. Since it matches the entry A of 1a, the tag a1 is obtained, and the second divided search key “0708: 090a: 0b0c: 0000” has no corresponding entry in the second table 1b, so that a miss hit occurs. In the case of a mishit, an unused tag value (x in this example) is assigned to the entry. Lastly, the final table 1d is searched for “tag a1 + tag x” combining these tags, and as a result, it corresponds to a dummy entry, so that address B is obtained as “result data”.
[0091]
However, in this case as well, simply by searching the tables 1a, 1b, 1d in which the address of the entry is divided and registered by using the divided search key, the search can be performed correctly as in the case of the conventional problem shown in FIG. In some cases, the inclusion relationship between the entries is checked as in the first and second embodiments, and if the inclusion relationship exists, it is necessary to add a dummy entry or set a flag in a necessary table. .
[0092]
In the above description, the case where the search key is divided into two is described as an example. However, even when the search key is divided into three or more, entry addition or deletion processing can be realized by the same processing procedure.
[0093]
According to the fourth embodiment, a tag is set as “result data” for “search target information”, and a tag value obtained by simultaneously searching a divided search key obtained by dividing a search key into a plurality of tables in respective tables. The search is performed using the final table using a combination of the search keys as a search key. Therefore, even a plurality of divided LPM searches can be correctly searched, and the search time can be shortened.
[0094]
The packet transfer device can be configured by installing the search circuit shown in the first, second, and fourth embodiments in the search circuit 22 in the reception-side packet processing unit 13 shown in FIG. In particular, in the case of the fourth embodiment, since the divided search keys obtained by dividing the search key are simultaneously searched, even the long search key can achieve the same throughput as the short search key.
[0095]
【The invention's effect】
As described above, according to the present invention, the inclusion relationship between an entry to be newly added / deleted and the entry stored in the table is obtained. As a result, when the inclusion relationship exists between the two, Since the configuration is such that a dummy entry is added, deleted, or changed in the table, even in an LPM search in which a search key is divided into a plurality of parts, it is possible to avoid that result information for the divided search key is not obtained due to the division of the search key. This has the effect that the search can be performed correctly.
[Brief description of the drawings]
FIG. 1 is a block diagram schematically showing a configuration of a search circuit according to the present invention.
FIG. 2 is a diagram illustrating an example of a configuration of a table.
FIG. 3 is a flowchart illustrating an overall processing procedure when an entry is added;
FIG. 4 is a diagram showing conditions for determining an inclusion relationship.
FIG. 5 is a diagram showing conditions for determining whether a dummy entry is necessary in inclusion relation 1 in FIG. 4;
FIG. 6 is a diagram showing conditions for determining whether a dummy entry is necessary in inclusion relation 2 in FIG. 4;
FIG. 7 is a diagram showing conditions for determining whether or not a dummy entry is necessary in inclusion relation 3 in FIG. 4;
FIG. 8 is a diagram that defines the result of addition determination of a dummy entry and the processing content thereof.
FIG. 9 is a flowchart illustrating a procedure for adding an entry.
FIG. 10 is a flowchart illustrating an overall processing procedure when deleting an entry.
FIG. 11 is a flowchart illustrating a procedure of an entry deletion process.
FIG. 12 is a diagram showing the contents of deletion of a dummy entry.
FIG. 13 is a diagram showing a state of entry addition when there are two tables.
FIG. 14 is a diagram showing how entries are deleted when there are two tables.
FIG. 15 is a diagram showing a configuration of a table according to the present invention.
FIG. 16 is a diagram showing a configuration of a search circuit table according to a second embodiment of the present invention;
FIG. 17 is a flowchart illustrating a search processing procedure according to a second embodiment of the search circuit according to the present invention;
FIG. 18 is a diagram showing how an entry is added when there are two tables.
FIG. 19 is a block diagram showing an overall configuration of a packet transfer device according to the present invention.
FIG. 20 is a block diagram illustrating a configuration of a received packet processing unit.
FIG. 21 is a diagram showing an outline of processing timing in a receiving-side packet processing unit.
FIG. 22 is a diagram schematically showing an outline of a search method according to Embodiment 4 of the present invention.
FIG. 23 is a diagram showing an example of a table according to the fourth embodiment of the present invention.
FIG. 24 is a diagram for explaining a problem of a conventional LPM search.
[Explanation of symbols]
1 table (search engine), 2 search control section, 3 search key division / tag management section, 4 inclusion relation detection / dummy entry management section, 10 interfaces, 11 switches, 12 physical layer processing section, 13 reception side packet processing section, 14 transmission side packet processing unit, 20 packet input unit, 21 header extraction unit, 22 search circuit, 23 header insertion unit, 24 packet output unit.

Claims (9)

入力された検索キーを複数の分割検索キーに分割し、前記検索キー内の先頭のデータが含まれる上位の分割検索キーから対応するテーブルを用いて順に最長一致検索を行って、所望の結果情報を得る検索制御手段と、
前記分割検索キーの数だけ設けられるテーブルであり、前記分割検索キーに対応する所定の結果情報を含むエントリを格納するテーブルと、
を備える検索回路であって、
前記テーブルは、前記検索キーの分割によって前記分割検索キーに対する結果情報が得られなくなることを回避するためのダミーエントリを有することを特徴とする検索回路。
The input search key is divided into a plurality of divided search keys, and the longest match search is performed in order using the corresponding table from the upper divided search key including the leading data in the search key, and the desired result information is obtained. Search control means for obtaining
A table provided as many as the number of the divided search keys, and a table for storing entries including predetermined result information corresponding to the divided search keys;
A search circuit comprising:
The search circuit according to claim 1, wherein the table has a dummy entry for preventing the result information for the divided search key from being lost due to the division of the search key.
前記テーブルは、前記分割検索キーの検索対象である分割検索キー対応データまたは他のテーブルから取得したタグと前記分割検索キーの組合せからなる検索対象情報と、前記分割検索キーが前記検索対象情報と一致する必要のある長さを示すマスク長と、前記検索対象情報に対応する所定の結果情報または他のテーブルで分割検索キーと組み合わせて検索するためのタグのいずれかの結果データと、を含むエントリを格納し、
前記ダミーエントリは、前記テーブル内の第1のエントリが前記テーブル内の第2のエントリを包含している場合に、前記第2のエントリに対応する前記結果データのタグを先頭に有する検索対象情報と、前記タグの長さを指定するマスク長と、前記第1のエントリの結果情報を含んで構成され、前記第1と第2のエントリの検索対象情報間で包含関係が生じるテーブルよりも下位のテーブルに格納されることを特徴とする請求項1に記載の検索回路。
The table, search target information comprising a combination of the divided search key and data obtained from another table or the divided search key corresponding to the search target of the divided search key, the divided search key is the search target information and Includes a mask length indicating a length that needs to be matched, and any result data of a predetermined result information corresponding to the search target information or a tag for searching in combination with a divided search key in another table Store the entry,
The dummy entry is, when the first entry in the table includes the second entry in the table, search target information having a tag of the result data corresponding to the second entry at the head. And a mask length that specifies the length of the tag, and the result information of the first entry, which is lower than a table in which an inclusion relationship occurs between the search target information of the first and second entries. 2. The search circuit according to claim 1, wherein the search circuit is stored in a table.
入力された検索キーを複数の分割検索キーに分割し、前記検索キー内の先頭のデータが含まれる上位の分割検索キーから対応するテーブルを用いて順に最長一致検索を行って、所望の結果情報を得る検索制御手段と、
前記分割検索キーの数だけ設けられるテーブルであり、前記分割検索キーの検索対象である分割検索キー対応データまたは他のテーブルから取得したタグと前記分割検索キーの組合せからなる検索対象情報と、前記分割検索キーが前記検索対象情報と一致する必要のある長さを示すマスク長と、前記検索対象情報に対応する所定の結果情報または他のテーブルで検索するためのタグからなる結果データとを含むエントリを格納するテーブルと、
前記テーブルにエントリを追加する場合に、この追加エントリと前記テーブルに格納されているエントリとの包含関係を調べ、包含関係がある場合に、前記エントリとともに必要なテーブルに前記ダミーエントリを追加する包含関係検出・ダミーエントリ管理手段と、
を備えることを特徴とする検索回路。
The input search key is divided into a plurality of divided search keys, and the longest match search is performed in order using the corresponding table from the upper divided search key including the leading data in the search key, and the desired result information is obtained. Search control means for obtaining
A table provided as many as the number of the divided search keys, search target information comprising a combination of a tag obtained from the divided search key corresponding data or another table that is a search target of the divided search key and the divided search key, Includes a mask length indicating the length that the divided search key needs to match the search target information, and predetermined result information corresponding to the search target information or result data including a tag for searching in another table A table to store the entries,
When an entry is added to the table, an inclusion relation between the additional entry and an entry stored in the table is checked, and if there is an inclusion relation, the dummy entry is added to the necessary table together with the entry. Relationship detection / dummy entry management means;
A search circuit comprising:
前記包含関係検出・ダミーエントリ管理手段は、前記追加エントリと前記テーブルのエントリとの間に包含関係がある場合に、包含されるエントリに対応する前記結果データのタグを先頭に有する検索対象情報と、前記タグの長さを指定するマスク長と、包含するエントリの結果情報を含むダミーエントリを、前記追加エントリと前記テーブルのエントリの検索対象情報間で包含関係が生じるテーブルよりも下位のテーブルに追加することを特徴とする請求項3に記載の検索回路。The inclusion relation detection / dummy entry management means, when there is an inclusion relation between the additional entry and the entry of the table, the search target information having a tag of the result data corresponding to the included entry at the beginning, The dummy length including the mask length designating the length of the tag and the result information of the included entry is stored in a table lower than the table in which an inclusion relationship occurs between the additional entry and the search target information of the entry of the table. The search circuit according to claim 3, wherein the search circuit is added. 入力された検索キーを複数の分割検索キーに分割し、前記検索キー内の先頭のデータが含まれる上位の分割検索キーから対応するテーブルを用いて順に最長一致検索を行って、所望の結果情報を得る検索制御手段と、
前記分割検索キーの数だけ設けられるテーブルであり、前記分割検索キーの検索対象である分割検索キー対応データまたは他のテーブルから取得したタグと前記分割検索キーの組合せからなる検索対象情報と、前記分割検索キーが前記検索対象情報と一致する必要のある長さを示すマスク長と、前記検索対象情報に対応する結果であり他のテーブルで検索するためのタグと、前記検索対象情報に対応する最終結果である結果情報と、前記結果情報が有効か否かを示すデータ有効フラグを含むエントリを格納するテーブルと、
を備え、
前記検索制御手段は、前記テーブルに前記分割検索キーに一致するエントリがない場合に、このテーブルより前に検索が行われたテーブルで前記データ有効フラグが有効となっているエントリの結果情報を最終的な結果として取得することを特徴とする検索回路。
The input search key is divided into a plurality of divided search keys, and the longest match search is performed in order using the corresponding table from the upper divided search key including the leading data in the search key, and the desired result information is obtained. Search control means for obtaining
A table provided as many as the number of the divided search keys, search target information comprising a combination of a tag obtained from the divided search key corresponding data or another table that is a search target of the divided search key and the divided search key, A mask length indicating a length that the divided search key needs to match with the search target information, a tag corresponding to the search target information, which is a search result in another table, and a mask length corresponding to the search target information A table storing results information that is a final result and an entry including a data valid flag indicating whether the result information is valid;
With
When there is no entry in the table that matches the split search key, the search control unit finalizes the result information of the entry in which the data valid flag is valid in the table searched before this table. A search circuit characterized in that a search result is obtained as a basic result.
前記テーブルにエントリを追加する場合で、追加エントリと前記テーブルのエントリとの間に包含関係が生じる場合に、包含されるエントリの結果情報に包含するエントリの結果情報を格納し、前記データ有効フラグを有効にする処理を、前記追加エントリと前記テーブルのエントリの検索対象情報間で包含関係が生じるテーブルに対して実行する包含関係検出・ダミーエントリ管理手段をさらに備えることを特徴とする請求項5に記載の検索回路。In a case where an entry is added to the table, when an inclusion relationship occurs between the additional entry and the entry of the table, the result information of the entry included in the result information of the included entry is stored, and the data valid flag is stored. 6. An inclusive relation detection / dummy entry management means for executing a process for validating the information for a table in which an inclusive relation occurs between the additional entry and the search target information of the entry of the table. Search circuit described in. 前記検索制御手段は、分割される前のエントリの検索対象情報の先頭データを含む検索対象情報を有する上位のテーブルから、最後のデータを含む検索対象情報を有する下位のテーブルに向かって、順に独立して検索を実施できるように、前記テーブルごとに複数備えられ、
上位側のテーブルに接続される検索制御手段は、その検索結果を、前記テーブルの下位側のテーブルに接続される検索制御手段に通知する機能を備えることを特徴とする請求項1〜6のいずれか1つに記載の検索回路。
The search control means is independent from the upper table having the search target information including the leading data of the search target information of the entry before being divided, in order from the lower table having the search target information including the last data. In order to be able to perform a search, a plurality of tables are provided for each table,
7. The search control means connected to an upper table has a function of notifying a search result to a search control means connected to a lower table of the table. The search circuit according to any one of the above.
入力された検索キーを複数の分割検索キーに分割し、それぞれの前記分割検索キーの最長一致検索を行って、所望の結果情報を得る検索制御手段と、
前記分割検索キーの数だけ設けられるテーブルであり、前記分割検索キーに対応する所定のタグを含むエントリを格納する第1のテーブルと、
それぞれの前記第1のテーブルによって出力されたタグを組み合わせた検索キーに対応する所定の結果情報を含むエントリを格納する第2のテーブルと、
を備える検索回路であって、
前記第2のテーブルは、前記検索キーの分割によって前記分割検索キーに対する結果情報が得られなくなることを回避するためのダミーエントリを有することを特徴とする検索回路。
Search control means for dividing the input search key into a plurality of divided search keys, performing a longest match search for each of the divided search keys, and obtaining desired result information;
A first table for storing an entry including a predetermined tag corresponding to the divided search key, the first table being a table provided by the number of the divided search keys;
A second table storing an entry including predetermined result information corresponding to a search key obtained by combining the tags output by the first tables;
A search circuit comprising:
The search circuit, wherein the second table has a dummy entry for preventing the result information for the divided search key from being lost due to the division of the search key.
所定の通信方式でパケットを送受信する複数の通信インタフェースと、これらの通信インタフェースを接続し、前記通信インタフェース間のパケットの交換を行うスイッチと、を備え、前記通信インタフェースを介して受信したパケットを、その宛先IPアドレスから出力先の通信インタフェースを検索して転送するパケット転送装置において、
前記通信インタフェースは、
受信した前記パケットの宛先アドレスに基づいて、請求項1〜8のいずれか1つに記載の検索回路によって前記パケットの出力先を検索して前記スイッチに送出する受信側パケット処理手段と、
他の前記通信インタフェースから前記スイッチを介して受信したパケットをカプセル化して送信する送信側パケット処理手段と、
を備えることを特徴とするパケット転送装置。
A plurality of communication interfaces for transmitting and receiving packets in a predetermined communication method, and a switch for connecting these communication interfaces and exchanging packets between the communication interfaces, comprising a packet received via the communication interface, In a packet transfer device for searching for and transferring a communication interface of an output destination from the destination IP address,
The communication interface includes:
Receiving-side packet processing means for searching for an output destination of the packet by the search circuit according to any one of claims 1 to 8 based on a destination address of the received packet and sending the packet to the switch,
Sender-side packet processing means for encapsulating and transmitting a packet received from the other communication interface via the switch,
A packet transfer device comprising:
JP2003130066A 2003-05-08 2003-05-08 Search circuit and packet transfer device Pending JP2004336427A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003130066A JP2004336427A (en) 2003-05-08 2003-05-08 Search circuit and packet transfer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003130066A JP2004336427A (en) 2003-05-08 2003-05-08 Search circuit and packet transfer device

Publications (1)

Publication Number Publication Date
JP2004336427A true JP2004336427A (en) 2004-11-25

Family

ID=33505698

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003130066A Pending JP2004336427A (en) 2003-05-08 2003-05-08 Search circuit and packet transfer device

Country Status (1)

Country Link
JP (1) JP2004336427A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009035524A (en) * 2007-08-03 2009-02-19 Chemiprokasei Kaisha Ltd New bicarbazole derivative, and host material and organic electroluminescent element each using the same
JPWO2011083786A1 (en) * 2010-01-06 2013-05-13 日本電気株式会社 Communication control system and communication control method
JP2013225739A (en) * 2012-04-20 2013-10-31 Nippon Telegr & Teleph Corp <Ntt> Frame search processor and method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009035524A (en) * 2007-08-03 2009-02-19 Chemiprokasei Kaisha Ltd New bicarbazole derivative, and host material and organic electroluminescent element each using the same
JPWO2011083786A1 (en) * 2010-01-06 2013-05-13 日本電気株式会社 Communication control system and communication control method
JP5743906B2 (en) * 2010-01-06 2015-07-01 日本電気株式会社 Communication control system
US9432283B2 (en) 2010-01-06 2016-08-30 Nec Corporation Communication control system and communication control method
JP2013225739A (en) * 2012-04-20 2013-10-31 Nippon Telegr & Teleph Corp <Ntt> Frame search processor and method

Similar Documents

Publication Publication Date Title
US10389633B2 (en) Hash-based address matching
US8228908B2 (en) Apparatus for hardware-software classification of data packet flows
US6665297B1 (en) Network routing table
EP2314027B1 (en) Switching table in an ethernet bridge
US7861291B2 (en) System and method for implementing ACLs using standard LPM engine
EP1358739B1 (en) Method and apparatus for routing table management
US7890672B2 (en) Data processing apparatus and data transfer method
US20080065639A1 (en) String matching engine
US8363654B2 (en) Predictive packet forwarding for a network switch
US20070171911A1 (en) Routing system and method for managing rule entry thereof
US20060133374A1 (en) Packet exchange device and packet exchange method
US20090232139A1 (en) Multiple virtual local area network databases in a switch with a relational lookup engine
US7599364B2 (en) Configurable network connection address forming hardware
US20030058860A1 (en) Destination address filtering
WO2020114239A1 (en) Multicast message processing method and apparatus, storage medium and processor
JP2001326679A (en) Information unit, table retrieval device, table retrieval method, and recording medium
CN105760411B (en) Mixed wildcard matching table
CN113709110A (en) Software and hardware combined intrusion detection system and method
US7349981B2 (en) System, apparatus, and method for string matching
KR100524035B1 (en) Packet distributor for distributing IP fragment packets to protocol processors without IP reassembly
US20040105442A1 (en) Internet protocol address lookup system and method using three-layer table architecture
EP2112787B1 (en) Data transmission between different VLANs by using MAC addresses
JP2004336427A (en) Search circuit and packet transfer device
JP2007525037A (en) Network message processing using pattern matching
US7308468B2 (en) Pattern matching