diff options
-rw-r--r-- | src/vat/api_format.c | 16 | ||||
-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 | ||||
-rw-r--r-- | src/vpp/api/custom_dump.c | 4 |
6 files changed, 44 insertions, 23 deletions
diff --git a/src/vat/api_format.c b/src/vat/api_format.c index c3441eb6986..d443239a940 100644 --- a/src/vat/api_format.c +++ b/src/vat/api_format.c @@ -7360,15 +7360,19 @@ api_tap_create_v2 (vat_main_t * vam) else if (unformat (i, "host-mtu-size %u", &host_mtu_size)) host_mtu_set = 1; else if (unformat (i, "no-gso")) - tap_flags &= ~TAP_FLAG_GSO; + tap_flags &= ~TAP_API_FLAG_GSO; else if (unformat (i, "gso")) - tap_flags |= TAP_FLAG_GSO; + tap_flags |= TAP_API_FLAG_GSO; else if (unformat (i, "csum-offload")) - tap_flags |= TAP_FLAG_CSUM_OFFLOAD; + tap_flags |= TAP_API_FLAG_CSUM_OFFLOAD; else if (unformat (i, "persist")) - tap_flags |= TAP_FLAG_PERSIST; + tap_flags |= TAP_API_FLAG_PERSIST; else if (unformat (i, "attach")) - tap_flags |= TAP_FLAG_ATTACH; + tap_flags |= TAP_API_FLAG_ATTACH; + else if (unformat (i, "tun")) + tap_flags |= TAP_API_FLAG_TUN; + else if (unformat (i, "gro-coalesce")) + tap_flags |= TAP_API_FLAG_GRO_COALESCE; else break; } @@ -20587,7 +20591,7 @@ _(l2_flags, \ _(bridge_flags, \ "bd_id <bridge-domain-id> [learn] [forward] [uu-flood] [flood] [arp-term] [disable]\n") \ _(tap_create_v2, \ - "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload] [persist] [attach]") \ + "id <num> [hw-addr <mac-addr>] [host-if-name <name>] [host-ns <name>] [num-rx-queues <num>] [rx-ring-size <num>] [tx-ring-size <num>] [host-bridge <name>] [host-mac-addr <mac-addr>] [host-ip4-addr <ip4addr/mask>] [host-ip6-addr <ip6addr/mask>] [host-mtu-size <mtu>] [gso | no-gso | csum-offload | gro-coalesce] [persist] [attach] [tun]") \ _(tap_delete_v2, \ "<vpp-if-name> | sw_if_index <id>") \ _(sw_interface_tap_v2_dump, "") \ 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; diff --git a/src/vpp/api/custom_dump.c b/src/vpp/api/custom_dump.c index a5c3fdbdfc9..e0ba9f93c3d 100644 --- a/src/vpp/api/custom_dump.c +++ b/src/vpp/api/custom_dump.c @@ -587,6 +587,10 @@ static void *vl_api_tap_create_v2_t_print s = format (s, "persist "); if ((mp->tap_flags) & 0x8) s = format (s, "attach "); + if ((mp->tap_flags) & 0x16) + s = format (s, "tun "); + if ((mp->tap_flags) & 0x32) + s = format (s, "gro-coalesce-enabled "); FINISH; } |