Are you looking for configuration that will allow forward packets from one port to another without sending the packets to OS level? If yes, you probably searching for “Host Chaining” feature
http://www.mellanox.com/pdf/firmware/ConnectX5-FW-16_26_1040-release_notes.pdf