1. A method for implementing a gateway datapath shared by a plurality of logical networks, each logical network associated with a different namespace, the gateway datapath comprising a plurality of stages, the method comprising: at a datapath daemon executing in a user space of a computing device, receiving a packet belonging to a particular logical network; executing at least a subset of the plurality of pipeline stages for the received packet, the plurality of pipeline stages corresponding to logical entities of the particular logical network; exporting the packet through a user-kernel transport to a network protocol stack in a kernel space of the computing device, wherein the kernel space protocol stack forwards the packet to a logical router in the namespace associated with the particular logical network by using an identifier of the particular logical network in the exported packet; and at the datapath daemon, receiving a processing result of the packet back from the logical router through the network protocol stack and the user-kernel transport using the identifier of the particular logical network.