A method for packet matching, characterized in that the method comprises the steps of: adding N first data packets into N pipelines and configuring a stage for each pipeline as a root node of a decision tree (S601), wherein, each of nodes of the decision tree represents a prefix length and prefix lengths for the nodes of the decision tree are different from each other; calculating a first hash value for a first pipeline in the N pipelines, and asynchronously prefetching a first output interface data corresponding to the first hash value from a memory, storing the first output interface data in a cache, calculating a second hash value for a second pipeline in the N pipelines while prefetching the first output interface data from the memory, and repeatedly performing a process of calculating a hash value for one pipeline in the N pipelines, and then calculating a next hash value for a next pipeline in the N pipelines while asynchronously prefetching output interface data corresponding to the hash value from the memory, and storing the output interface data in the cache, until calculation of a hash value for each pipeline in the N pipelines is finished , wherein, the hash value for each pipeline is a hash value of a destination address for a data packet in the pipeline and a prefix length represented by the stage; obtaining the first output interface data from the cache when calculation of the hash value for each pipeline in the N pipelines is finished ; and when the first output interface data is characterized as being used to forward a first data packet in the first pipeline, forwarding the first data packet in the pipeline via the first output interface and deleting the first data packet in the first pipeline from the first pipeline, and adding a second data packet into the first pipeline when receiving the second data packet . adding N first data packets into N pipelines and configuring a stage for each pipeline as a root node of a decision tree (S601), wherein, each of nodes of the decision tree represents a prefix length and prefix lengths for the nodes of the decision tree are different from each other; calculating a first hash value for a first pipeline in the N pipelines, and asynchronously prefetching a first output interface data corresponding to the first hash value from a memory, storing the first output interface data in a cache, calculating a second hash value for a second pipeline in the N pipelines while prefetching the first output interface data from the memory, and repeatedly performing a process of calculating a hash value for one pipeline in the N pipelines, and then calculating a next hash value for a next pipeline in the N pipelines while asynchronously prefetching output interface data corresponding to the hash value from the memory, and storing the output interface data in the cache, until calculation of a hash value for each pipeline in the N pipelines is finished , wherein, the hash value for each pipeline is a hash value of a destination address for a data packet in the pipeline and a prefix length represented by the stage; obtaining the first output interface data from the cache when calculation of the hash value for each pipeline in the N pipelines is finished ; and when the first output interface data is characterized as being used to forward a first data packet in the first pipeline, forwarding the first data packet in the pipeline via the first output interface and deleting the first data packet in the first pipeline from the first pipeline, and adding a second data packet into the first pipeline when receiving the second data packet . <EOS>