X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=lib%2Fnetdev-provider.h;h=46884ed90d1470cb90b5f6d4be896101eeb5c3ff;hb=refs%2Fheads%2Forig-parallel;hp=c0ed4ef6033d44a921f9167081c86e1007832d20;hpb=d59051362fa8ac4369f1be69ac942a52c9a424b9;p=sliver-openvswitch.git diff --git a/lib/netdev-provider.h b/lib/netdev-provider.h index c0ed4ef60..46884ed90 100644 --- a/lib/netdev-provider.h +++ b/lib/netdev-provider.h @@ -24,6 +24,9 @@ #include "netdev.h" #include "list.h" #include "shash.h" +#ifdef THREADED +#include "dispatch.h" +#endif #ifdef __cplusplus extern "C" { @@ -194,6 +197,22 @@ struct netdev_class { * implement packet reception through the 'recv' member function. */ void (*recv_wait)(struct netdev *netdev); +#ifdef THREADED + /* Attempts to receive 'batch' packets from 'netdev' and process them + * through the 'handler' callback. This function is used in the 'THREADED' + * version in order to optimize the forwarding process, since it permits to + * process packets directly in the netdev memory. + * + * Returns the number of packets processed on success; this can be 0 if no + * packets are available to be read. Returns -1 if an error occurred. + */ + int (*dispatch)(struct netdev *netdev, int batch, pkt_handler handler, + u_char *user); + + /* Return the file descriptor of the device */ + int (*get_fd)(struct netdev *netdev); +#endif + /* Discards all packets waiting to be received from 'netdev'. * * May be null if not needed, such as for a network device that does not @@ -551,6 +570,12 @@ extern const struct netdev_class netdev_tap_class; extern const struct netdev_class netdev_patch_class; extern const struct netdev_class netdev_gre_class; extern const struct netdev_class netdev_capwap_class; +#ifdef __FreeBSD__ +extern const struct netdev_class netdev_bsd_class; +#ifdef NETMAP +extern const struct netdev_class netdev_netmap_class; +#endif +#endif #ifdef __cplusplus }