Hi Nidhia, >Hi Cristian, > >Thanks for your help. > >If that is the case, is there any way to use the incoming port as a key for >table lookup? I need to use incoming port along with some other fields of each >packet as the key for my application.
Yes, you can. There is an input port field in the rte_mbuf structure that you can use. The hash tables from librte_table/rte_table_hash* work with lookup key placed at any location from the start of the mbuf (see the key offset parameter), and for some tables there is a key mask parameter as well. Assuming a flat buffer that has both the mbuf and the packet in the same buffer (see the buffer anatomy in rte_mbuf.h), the key offset parameter can basically cover any location from the buffer, including meta-data (fields from mbuf or the buffer headroom, such as the input port), as well as packet fields (from the header/payload, such as the DiffServ 5-tuple). You can do any of the two things below: 1. Use the key offset and key mask parameter of the hash table to select the relevant metadata/packet header fields; 2. Use the DMA action of the pass-through table to copy & pack the relevant metadata/packet header fields in some unused headroom space, and then point the key offset to this buffer location. > >Regards, >Nidhia Varghese Regards, Cristian