aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/devices/tap
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2020-04-30 19:05:56 +0200
committerDamjan Marion <dmarion@me.com>2020-05-04 13:56:29 +0000
commitd88fc0fcedb402e3dc82cb44280d4567a6a13266 (patch)
tree24f5f0a9231067437045f1df458312682c5298b1 /src/vnet/devices/tap
parent6bb080f1e54391b161cf211a9cfa3f488f2fd331 (diff)
tap: refactor existing flags
Type: refactor This patch refactor the existing flags and also add a new flag for packet coalescing. Change-Id: Ic826e4c81313f26d87c475cdf666b06cbed60a3a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src/vnet/devices/tap')
-rw-r--r--src/vnet/devices/tap/cli.c5
-rw-r--r--src/vnet/devices/tap/tap.h20
-rw-r--r--src/vnet/devices/tap/tapv2.api13
3 files changed, 26 insertions, 12 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