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;
}
_(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, "") \
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"))
"[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* */
#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;
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;
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
_ (VHOST_USER_F_PROTOCOL_FEATURES, 30) \
_ (VIRTIO_F_VERSION_1, 32)
-
#define foreach_virtio_if_flag \
_(0, ADMIN_UP, "admin-up") \
_(1, DELETING, "deleting")
#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;
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;
}