summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMohsin Kazmi <sykazmi@cisco.com>2021-05-05 14:26:38 +0200
committerDamjan Marion <dmarion@me.com>2021-05-06 10:28:02 +0000
commit36f7a6aeb021a549f2d684868303c9891bc0dd00 (patch)
tree730f3b7ed52c07e52d863d5f467debcb4c4ca8c7 /src
parent11e0d752e67ac3da804e2af798d12995ae401434 (diff)
vlib: fix the offload flags size
Type: fix Change-Id: I433fe3799975fe3ba00fa30226f6e8dae34e88fc Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/avf/output.c2
-rw-r--r--src/plugins/dpdk/device/device.c3
-rw-r--r--src/plugins/vmxnet3/input.c2
-rw-r--r--src/vnet/buffer.h36
-rw-r--r--src/vnet/devices/af_packet/node.c2
-rw-r--r--src/vnet/devices/virtio/device.c4
-rw-r--r--src/vnet/devices/virtio/node.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_input.c2
-rw-r--r--src/vnet/devices/virtio/vhost_user_output.c2
-rw-r--r--src/vnet/interface_format.c4
-rw-r--r--src/vnet/interface_output.h8
-rw-r--r--src/vnet/ip/ip6_forward.c4
-rw-r--r--src/vnet/ipsec/ipsec_output.c2
-rw-r--r--src/vnet/pg/input.c2
14 files changed, 39 insertions, 36 deletions
diff --git a/src/plugins/avf/output.c b/src/plugins/avf/output.c
index 7b940eb57f3..b50a1e23c7a 100644
--- a/src/plugins/avf/output.c
+++ b/src/plugins/avf/output.c
@@ -60,7 +60,7 @@ avf_tx_prepare_cksum (vlib_buffer_t * b, u8 is_tso)
if (!is_tso && !(b->flags & VNET_BUFFER_F_OFFLOAD))
return 0;
- u32 oflags = vnet_buffer (b)->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags;
u32 is_tcp = is_tso || oflags & VNET_BUFFER_OFFLOAD_F_TCP_CKSUM;
u32 is_udp = !is_tso && oflags & VNET_BUFFER_OFFLOAD_F_UDP_CKSUM;
u32 is_ip4 = b->flags & VNET_BUFFER_F_IS_IP4;
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index 7e0f2d43994..1fdee48c1e8 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -221,8 +221,9 @@ dpdk_buffer_tx_offload (dpdk_device_t * xd, vlib_buffer_t * b,
{
int is_ip4 = b->flags & VNET_BUFFER_F_IS_IP4;
u32 tso = b->flags & VNET_BUFFER_F_GSO, max_pkt_len;
- u32 oflags, ip_cksum, tcp_cksum, udp_cksum;
+ u32 ip_cksum, tcp_cksum, udp_cksum;
u64 ol_flags;
+ vnet_buffer_oflags_t oflags = 0;
/* Is there any work for us? */
if (PREDICT_TRUE (((b->flags & VNET_BUFFER_F_OFFLOAD) | tso) == 0))
diff --git a/src/plugins/vmxnet3/input.c b/src/plugins/vmxnet3/input.c
index be528b26494..3015fb116ca 100644
--- a/src/plugins/vmxnet3/input.c
+++ b/src/plugins/vmxnet3/input.c
@@ -79,7 +79,7 @@ vmxnet3_handle_offload (vmxnet3_rx_comp * rx_comp, vlib_buffer_t * hb,
u16 gso_size)
{
u8 l4_hdr_sz = 0;
- u32 oflags = 0;
+ vnet_buffer_oflags_t oflags = 0;
if (rx_comp->flags & VMXNET3_RXCF_IP4)
{
diff --git a/src/vnet/buffer.h b/src/vnet/buffer.h
index 0816232aed7..0798de4cf63 100644
--- a/src/vnet/buffer.h
+++ b/src/vnet/buffer.h
@@ -107,6 +107,21 @@ enum
STATIC_ASSERT (((VNET_BUFFER_FLAGS_ALL_AVAIL & VLIB_BUFFER_FLAGS_ALL) == 0),
"VLIB / VNET buffer flags overlap");
+#define foreach_vnet_buffer_offload_flag \
+ _ (0, IP_CKSUM, "offload-ip-cksum", 1) \
+ _ (1, TCP_CKSUM, "offload-tcp-cksum", 1) \
+ _ (2, UDP_CKSUM, "offload-udp-cksum", 1) \
+ _ (3, OUTER_IP_CKSUM, "offload-outer-ip-cksum", 1) \
+ _ (4, OUTER_TCP_CKSUM, "offload-outer-tcp-cksum", 1) \
+ _ (5, OUTER_UDP_CKSUM, "offload-outer-udp-cksum", 1)
+
+typedef enum
+{
+#define _(bit, name, s, v) VNET_BUFFER_OFFLOAD_F_##name = (1 << bit),
+ foreach_vnet_buffer_offload_flag
+#undef _
+} vnet_buffer_oflags_t;
+
#define foreach_buffer_opaque_union_subtype \
_(ip) \
_(l2) \
@@ -139,7 +154,7 @@ typedef struct
i16 l4_hdr_offset;
u8 feature_arc_index;
/* offload flags */
- u8 oflags;
+ vnet_buffer_oflags_t oflags : 8;
union
{
@@ -421,21 +436,6 @@ STATIC_ASSERT (sizeof (vnet_buffer_opaque_t) <=
#define vnet_buffer(b) ((vnet_buffer_opaque_t *) (b)->opaque)
-#define foreach_vnet_buffer_offload_flag \
- _ (0, IP_CKSUM, "offload-ip-cksum", 1) \
- _ (1, TCP_CKSUM, "offload-tcp-cksum", 1) \
- _ (2, UDP_CKSUM, "offload-udp-cksum", 1) \
- _ (3, OUTER_IP_CKSUM, "offload-outer-ip-cksum", 1) \
- _ (4, OUTER_TCP_CKSUM, "offload-outer-tcp-cksum", 1) \
- _ (5, OUTER_UDP_CKSUM, "offload-outer-udp-cksum", 1)
-
-enum
-{
-#define _(bit, name, s, v) VNET_BUFFER_OFFLOAD_F_##name = (1 << bit),
- foreach_vnet_buffer_offload_flag
-#undef _
-};
-
/* Full cache line (64 bytes) of additional space */
typedef struct
{
@@ -519,7 +519,7 @@ format_function_t format_vnet_buffer_opaque;
format_function_t format_vnet_buffer_opaque2;
static_always_inline void
-vnet_buffer_offload_flags_set (vlib_buffer_t *b, u32 oflags)
+vnet_buffer_offload_flags_set (vlib_buffer_t *b, vnet_buffer_oflags_t oflags)
{
if (b->flags & VNET_BUFFER_F_OFFLOAD)
{
@@ -535,7 +535,7 @@ vnet_buffer_offload_flags_set (vlib_buffer_t *b, u32 oflags)
}
static_always_inline void
-vnet_buffer_offload_flags_clear (vlib_buffer_t *b, u32 oflags)
+vnet_buffer_offload_flags_clear (vlib_buffer_t *b, vnet_buffer_oflags_t oflags)
{
vnet_buffer (b)->oflags &= ~oflags;
if (0 == vnet_buffer (b)->oflags)
diff --git a/src/vnet/devices/af_packet/node.c b/src/vnet/devices/af_packet/node.c
index 16cd69a52ce..9fd115f9509 100644
--- a/src/vnet/devices/af_packet/node.c
+++ b/src/vnet/devices/af_packet/node.c
@@ -120,7 +120,7 @@ static_always_inline void
mark_tcp_udp_cksum_calc (vlib_buffer_t *b, u8 *l4_hdr_sz)
{
ethernet_header_t *eth = vlib_buffer_get_current (b);
- u32 oflags = 0;
+ vnet_buffer_oflags_t oflags = 0;
if (clib_net_to_host_u16 (eth->type) == ETHERNET_TYPE_IP4)
{
ip4_header_t *ip4 =
diff --git a/src/vnet/devices/virtio/device.c b/src/vnet/devices/virtio/device.c
index 20264787292..666cd1631cf 100644
--- a/src/vnet/devices/virtio/device.c
+++ b/src/vnet/devices/virtio/device.c
@@ -285,7 +285,7 @@ static void
set_checksum_offsets (vlib_buffer_t *b, virtio_net_hdr_v1_t *hdr,
const int is_l2)
{
- u32 oflags = vnet_buffer (b)->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags;
if (b->flags & VNET_BUFFER_F_IS_IP4)
{
@@ -334,7 +334,7 @@ set_checksum_offsets (vlib_buffer_t *b, virtio_net_hdr_v1_t *hdr,
static void
set_gso_offsets (vlib_buffer_t *b, virtio_net_hdr_v1_t *hdr, const int is_l2)
{
- u32 oflags = vnet_buffer (b)->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags;
if (b->flags & VNET_BUFFER_F_IS_IP4)
{
diff --git a/src/vnet/devices/virtio/node.c b/src/vnet/devices/virtio/node.c
index f91dc877fb4..c36c0807de0 100644
--- a/src/vnet/devices/virtio/node.c
+++ b/src/vnet/devices/virtio/node.c
@@ -75,7 +75,7 @@ virtio_needs_csum (vlib_buffer_t * b0, virtio_net_hdr_v1_t * hdr,
if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM)
{
u16 ethertype = 0, l2hdr_sz = 0;
- u32 oflags = 0;
+ vnet_buffer_oflags_t oflags = 0;
if (type == VIRTIO_IF_TYPE_TUN)
{
diff --git a/src/vnet/devices/virtio/vhost_user_input.c b/src/vnet/devices/virtio/vhost_user_input.c
index 1636bd8c4a9..69fba411f1c 100644
--- a/src/vnet/devices/virtio/vhost_user_input.c
+++ b/src/vnet/devices/virtio/vhost_user_input.c
@@ -253,7 +253,7 @@ vhost_user_handle_rx_offload (vlib_buffer_t * b0, u8 * b0_data,
ethernet_header_t *eh = (ethernet_header_t *) b0_data;
u16 ethertype = clib_net_to_host_u16 (eh->type);
u16 l2hdr_sz = sizeof (ethernet_header_t);
- u32 oflags = 0;
+ vnet_buffer_oflags_t oflags = 0;
if (ethernet_frame_is_tagged (ethertype))
{
diff --git a/src/vnet/devices/virtio/vhost_user_output.c b/src/vnet/devices/virtio/vhost_user_output.c
index 6406fe3f587..59ea8104d5b 100644
--- a/src/vnet/devices/virtio/vhost_user_output.c
+++ b/src/vnet/devices/virtio/vhost_user_output.c
@@ -225,7 +225,7 @@ vhost_user_handle_tx_offload (vhost_user_intf_t * vui, vlib_buffer_t * b,
generic_header_offset_t gho = { 0 };
int is_ip4 = b->flags & VNET_BUFFER_F_IS_IP4;
int is_ip6 = b->flags & VNET_BUFFER_F_IS_IP6;
- u32 oflags = vnet_buffer (b)->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b)->oflags;
ASSERT (!(is_ip4 && is_ip6));
vnet_generic_header_offset_parser (b, &gho, 1 /* l2 */ , is_ip4, is_ip6);
diff --git a/src/vnet/interface_format.c b/src/vnet/interface_format.c
index 036ca53174c..86a3d594ac7 100644
--- a/src/vnet/interface_format.c
+++ b/src/vnet/interface_format.c
@@ -745,7 +745,7 @@ unformat_vnet_buffer_offload_flags (unformat_input_t *input, va_list *args)
{
u32 *flagp = va_arg (*args, u32 *);
int rv = 0;
- u32 oflags = 0;
+ vnet_buffer_oflags_t oflags = 0;
while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
{
@@ -762,7 +762,7 @@ unformat_vnet_buffer_offload_flags (unformat_input_t *input, va_list *args)
else break;
}
if (rv)
- *flagp = oflags;
+ *flagp = (u32) oflags;
return rv;
}
diff --git a/src/vnet/interface_output.h b/src/vnet/interface_output.h
index bb27cdb616e..15b0a1d3ccc 100644
--- a/src/vnet/interface_output.h
+++ b/src/vnet/interface_output.h
@@ -44,7 +44,8 @@
static_always_inline void
vnet_calc_ip4_checksums (vlib_main_t *vm, vlib_buffer_t *b, ip4_header_t *ip4,
- tcp_header_t *th, udp_header_t *uh, u32 oflags)
+ tcp_header_t *th, udp_header_t *uh,
+ vnet_buffer_oflags_t oflags)
{
if (oflags & VNET_BUFFER_OFFLOAD_F_IP_CKSUM)
ip4->checksum = ip4_header_checksum (ip4);
@@ -62,7 +63,8 @@ vnet_calc_ip4_checksums (vlib_main_t *vm, vlib_buffer_t *b, ip4_header_t *ip4,
static_always_inline void
vnet_calc_ip6_checksums (vlib_main_t *vm, vlib_buffer_t *b, ip6_header_t *ip6,
- tcp_header_t *th, udp_header_t *uh, u32 oflags)
+ tcp_header_t *th, udp_header_t *uh,
+ vnet_buffer_oflags_t oflags)
{
int bogus;
if (oflags & VNET_BUFFER_OFFLOAD_F_TCP_CKSUM)
@@ -85,7 +87,7 @@ vnet_calc_checksums_inline (vlib_main_t * vm, vlib_buffer_t * b,
ip6_header_t *ip6;
tcp_header_t *th;
udp_header_t *uh;
- u32 oflags;
+ vnet_buffer_oflags_t oflags;
if (!(b->flags & VNET_BUFFER_F_OFFLOAD))
return;
diff --git a/src/vnet/ip/ip6_forward.c b/src/vnet/ip/ip6_forward.c
index 4f1b148c365..5d7014070bd 100644
--- a/src/vnet/ip/ip6_forward.c
+++ b/src/vnet/ip/ip6_forward.c
@@ -1333,7 +1333,7 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
flags[0] = b[0]->flags;
flags[1] = b[1]->flags;
- u32 oflags[2];
+ vnet_buffer_oflags_t oflags[2];
oflags[0] = vnet_buffer (b[0])->oflags;
oflags[1] = vnet_buffer (b[1])->oflags;
@@ -1524,7 +1524,7 @@ ip6_local_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u32 flags = b[0]->flags;
- u32 oflags = vnet_buffer (b[0])->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b[0])->oflags;
u32 l4_offload = (flags & VNET_BUFFER_F_OFFLOAD) &&
(oflags & (VNET_BUFFER_OFFLOAD_F_TCP_CKSUM |
diff --git a/src/vnet/ipsec/ipsec_output.c b/src/vnet/ipsec/ipsec_output.c
index 598195f2737..8fb9566fa38 100644
--- a/src/vnet/ipsec/ipsec_output.c
+++ b/src/vnet/ipsec/ipsec_output.c
@@ -309,7 +309,7 @@ ipsec_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
if (PREDICT_FALSE (b0->flags & VNET_BUFFER_F_OFFLOAD))
{
- u32 oflags = vnet_buffer (b0)->oflags;
+ vnet_buffer_oflags_t oflags = vnet_buffer (b0)->oflags;
/*
* Clearing offload flags before checksum is computed
diff --git a/src/vnet/pg/input.c b/src/vnet/pg/input.c
index d3501b3e3b6..98db46abd6a 100644
--- a/src/vnet/pg/input.c
+++ b/src/vnet/pg/input.c
@@ -1544,7 +1544,7 @@ fill_buffer_offload_flags (vlib_main_t *vm, u32 *buffers, u32 n_buffers,
{
vlib_buffer_t *b0 = vlib_get_buffer (vm, buffers[i]);
u8 l4_proto = 0;
- u32 oflags = 0;
+ vnet_buffer_oflags_t oflags = 0;
ethernet_header_t *eh =
(ethernet_header_t *) vlib_buffer_get_current (b0);