diff options
Diffstat (limited to 'src/vnet')
-rw-r--r-- | src/vnet/devices/tap/cli.c | 5 | ||||
-rw-r--r-- | src/vnet/devices/tap/tap.h | 20 | ||||
-rw-r--r-- | src/vnet/devices/tap/tapv2.api | 13 | ||||
-rw-r--r-- | src/vnet/devices/virtio/virtio.h | 9 |
4 files changed, 30 insertions, 17 deletions
diff --git a/src/vnet/devices/tap/cli.c b/src/vnet/devices/tap/cli.c index 486cd9fda21..34897ea7c5d 100644 --- a/src/vnet/devices/tap/cli.c +++ b/src/vnet/devices/tap/cli.c @@ -90,6 +90,8 @@ tap_create_command_fn (vlib_main_t * vm, unformat_input_t * input, args.tap_flags &= ~TAP_FLAG_GSO; else if (unformat (line_input, "gso")) args.tap_flags |= TAP_FLAG_GSO; + else if (unformat (line_input, "gro-coalesce")) + args.tap_flags |= TAP_FLAG_GRO_COALESCE; else if (unformat (line_input, "csum-offload")) args.tap_flags |= TAP_FLAG_CSUM_OFFLOAD; else if (unformat (line_input, "persist")) @@ -138,7 +140,8 @@ VLIB_CLI_COMMAND (tap_create_command, static) = { "[host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6-addr>] " "[host-ip4-gw <ip4-addr>] [host-ip6-gw <ip6-addr>] " "[host-mac-addr <host-mac-address>] [host-if-name <name>] " - "[host-mtu-size <size>] [no-gso|gso|csum-offload] [persist] [attach] [tun]", + "[host-mtu-size <size>] [no-gso|gso|csum-offload|gro-coalesce] " + "[persist] [attach] [tun]", .function = tap_create_command_fn, }; /* *INDENT-ON* */ diff --git a/src/vnet/devices/tap/tap.h b/src/vnet/devices/tap/tap.h index c1ac7a61229..a9cd4766c3c 100644 --- a/src/vnet/devices/tap/tap.h +++ b/src/vnet/devices/tap/tap.h @@ -22,6 +22,21 @@ #define MIN(x,y) (((x)<(y))?(x):(y)) #endif +#define foreach_tapv2_flags \ + _ (GSO, 0) \ + _ (CSUM_OFFLOAD, 1) \ + _ (PERSIST, 2) \ + _ (ATTACH, 3) \ + _ (TUN, 4) \ + _ (GRO_COALESCE, 5) + +typedef enum +{ +#define _(a, b) TAP_FLAG_##a = (1 << b), + foreach_tapv2_flags +#undef _ +} tap_flag_t; + typedef struct { u32 id; @@ -31,11 +46,6 @@ typedef struct u16 rx_ring_sz; u16 tx_ring_sz; u32 tap_flags; -#define TAP_FLAG_GSO (1 << 0) -#define TAP_FLAG_CSUM_OFFLOAD (1 << 1) -#define TAP_FLAG_PERSIST (1 << 2) -#define TAP_FLAG_ATTACH (1 << 3) -#define TAP_FLAG_TUN (1 << 4) u8 *host_namespace; u8 *host_if_name; mac_address_t host_mac_addr; diff --git a/src/vnet/devices/tap/tapv2.api b/src/vnet/devices/tap/tapv2.api index 61b6720a0d3..94e1a7c00c2 100644 --- a/src/vnet/devices/tap/tapv2.api +++ b/src/vnet/devices/tap/tapv2.api @@ -19,18 +19,19 @@ the Linux kernel TAP device driver */ -option version = "3.0.0"; +option version = "4.0.0"; import "vnet/interface_types.api"; import "vnet/ethernet/ethernet_types.api"; import "vnet/ip/ip_types.api"; enum tap_flags { - TAP_FLAG_GSO = 1, - TAP_FLAG_CSUM_OFFLOAD = 2, - TAP_FLAG_PERSIST = 4, - TAP_FLAG_ATTACH = 8, - TAP_FLAG_TUN = 16, + TAP_API_FLAG_GSO = 1, /* enable gso on the interface */ + TAP_API_FLAG_CSUM_OFFLOAD = 2, /* enable checksum offload without gso on the interface */ + TAP_API_FLAG_PERSIST = 4, /* make the interface persistence to exist in linux even vpp crash/restart */ + TAP_API_FLAG_ATTACH = 8, /* attach to the existing persistence interface after vpp crash/restart */ + TAP_API_FLAG_TUN = 16, /* create TUN interface instead of tap */ + TAP_API_FLAG_GRO_COALESCE = 32, /* enable packet coalescing on tx side, provided gso enabled */ }; /** \brief Initialize a new tap interface with the given parameters diff --git a/src/vnet/devices/virtio/virtio.h b/src/vnet/devices/virtio/virtio.h index 3151c50cbb4..f5dc1c86930 100644 --- a/src/vnet/devices/virtio/virtio.h +++ b/src/vnet/devices/virtio/virtio.h @@ -58,7 +58,6 @@ _ (VHOST_USER_F_PROTOCOL_FEATURES, 30) \ _ (VIRTIO_F_VERSION_1, 32) - #define foreach_virtio_if_flag \ _(0, ADMIN_UP, "admin-up") \ _(1, DELETING, "deleting") @@ -81,16 +80,16 @@ typedef enum #define RX_QUEUE_ACCESS(X) (X/2) #define foreach_virtio_if_types \ - _ (TAP, 1) \ - _ (TUN, 2) \ - _ (PCI, 3) + _ (TAP, 0) \ + _ (TUN, 1) \ + _ (PCI, 2) typedef enum { #define _(a, b) VIRTIO_IF_TYPE_##a = (1 << b), foreach_virtio_if_types #undef _ - VIRTIO_IF_N_TYPES = (1 << 4), + VIRTIO_IF_N_TYPES = (1 << 3), } virtio_if_type_t; |