aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorSwarup Nayak <swarupnpvt@gmail.com>2017-11-22 16:41:57 +0530
committerChris Luke <chris_luke@comcast.com>2017-11-22 21:45:34 +0000
commitcc42db82f8d7e8e3e6719b1ae98bf3d48fff4b02 (patch)
tree13cca4b97f71c7e7ce188d4da6f4d60ea14cccda /src/vnet
parenteb2945cf6ffa35c3b22c2fa0c85bc67c9c39045a (diff)
VPP-254 Coding standard cleanup - vnet/vnet/hdlc
Change-Id: I125b1ca20a5b30d199d4a79ad0034533818a5e9c Signed-off-by: Swarup Nayak <swarupnpvt@gmail.com>
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/hdlc/hdlc.c109
-rw-r--r--src/vnet/hdlc/hdlc.h37
-rw-r--r--src/vnet/hdlc/node.c130
-rw-r--r--src/vnet/hdlc/packet.h14
-rw-r--r--src/vnet/hdlc/pg.c33
5 files changed, 197 insertions, 126 deletions
diff --git a/src/vnet/hdlc/hdlc.c b/src/vnet/hdlc/hdlc.c
index abb0dc3d221..e072bd46c95 100644
--- a/src/vnet/hdlc/hdlc.c
+++ b/src/vnet/hdlc/hdlc.c
@@ -43,11 +43,12 @@
/* Global main structure. */
hdlc_main_t hdlc_main;
-u8 * format_hdlc_protocol (u8 * s, va_list * args)
+u8 *
+format_hdlc_protocol (u8 * s, va_list * args)
{
hdlc_protocol_t p = va_arg (*args, u32);
- hdlc_main_t * pm = &hdlc_main;
- hdlc_protocol_info_t * pi = hdlc_get_protocol_info (pm, p);
+ hdlc_main_t *pm = &hdlc_main;
+ hdlc_protocol_info_t *pi = hdlc_get_protocol_info (pm, p);
if (pi)
s = format (s, "%s", pi->name);
@@ -57,10 +58,11 @@ u8 * format_hdlc_protocol (u8 * s, va_list * args)
return s;
}
-u8 * format_hdlc_header_with_length (u8 * s, va_list * args)
+u8 *
+format_hdlc_header_with_length (u8 * s, va_list * args)
{
- hdlc_main_t * pm = &hdlc_main;
- hdlc_header_t * h = va_arg (*args, hdlc_header_t *);
+ hdlc_main_t *pm = &hdlc_main;
+ hdlc_header_t *h = va_arg (*args, hdlc_header_t *);
u32 max_header_bytes = va_arg (*args, u32);
hdlc_protocol_t p = clib_net_to_host_u16 (h->protocol);
u32 indent, header_bytes;
@@ -80,8 +82,8 @@ u8 * format_hdlc_header_with_length (u8 * s, va_list * args)
if (max_header_bytes != 0 && header_bytes > max_header_bytes)
{
- hdlc_protocol_info_t * pi = hdlc_get_protocol_info (pm, p);
- vlib_node_t * node = vlib_get_node (pm->vlib_main, pi->node_index);
+ hdlc_protocol_info_t *pi = hdlc_get_protocol_info (pm, p);
+ vlib_node_t *node = vlib_get_node (pm->vlib_main, pi->node_index);
if (node->format_buffer)
s = format (s, "\n%U%U",
format_white_space, indent,
@@ -92,24 +94,24 @@ u8 * format_hdlc_header_with_length (u8 * s, va_list * args)
return s;
}
-u8 * format_hdlc_header (u8 * s, va_list * args)
+u8 *
+format_hdlc_header (u8 * s, va_list * args)
{
- hdlc_header_t * h = va_arg (*args, hdlc_header_t *);
+ hdlc_header_t *h = va_arg (*args, hdlc_header_t *);
return format (s, "%U", format_hdlc_header_with_length, h, 0);
}
/* Returns hdlc protocol as an int in host byte order. */
uword
unformat_hdlc_protocol_host_byte_order (unformat_input_t * input,
- va_list * args)
+ va_list * args)
{
- u16 * result = va_arg (*args, u16 *);
- hdlc_main_t * pm = &hdlc_main;
+ u16 *result = va_arg (*args, u16 *);
+ hdlc_main_t *pm = &hdlc_main;
int p, i;
/* Numeric type. */
- if (unformat (input, "0x%x", &p)
- || unformat (input, "%d", &p))
+ if (unformat (input, "0x%x", &p) || unformat (input, "%d", &p))
{
if (p >= (1 << 16))
return 0;
@@ -121,7 +123,7 @@ unformat_hdlc_protocol_host_byte_order (unformat_input_t * input,
if (unformat_user (input, unformat_vlib_number_by_name,
pm->protocol_info_by_name, &i))
{
- hdlc_protocol_info_t * pi = vec_elt_at_index (pm->protocol_infos, i);
+ hdlc_protocol_info_t *pi = vec_elt_at_index (pm->protocol_infos, i);
*result = pi->protocol;
return 1;
}
@@ -131,24 +133,23 @@ unformat_hdlc_protocol_host_byte_order (unformat_input_t * input,
uword
unformat_hdlc_protocol_net_byte_order (unformat_input_t * input,
- va_list * args)
+ va_list * args)
{
- u16 * result = va_arg (*args, u16 *);
- if (! unformat_user (input, unformat_hdlc_protocol_host_byte_order, result))
+ u16 *result = va_arg (*args, u16 *);
+ if (!unformat_user (input, unformat_hdlc_protocol_host_byte_order, result))
return 0;
- *result = clib_host_to_net_u16 ((u16) *result);
+ *result = clib_host_to_net_u16 ((u16) * result);
return 1;
}
uword
unformat_hdlc_header (unformat_input_t * input, va_list * args)
{
- u8 ** result = va_arg (*args, u8 **);
- hdlc_header_t _h, * h = &_h;
+ u8 **result = va_arg (*args, u8 **);
+ hdlc_header_t _h, *h = &_h;
u16 p;
- if (! unformat (input, "%U",
- unformat_hdlc_protocol_host_byte_order, &p))
+ if (!unformat (input, "%U", unformat_hdlc_protocol_host_byte_order, &p))
return 0;
h->address = 0xff;
@@ -157,45 +158,46 @@ unformat_hdlc_header (unformat_input_t * input, va_list * args)
/* Add header to result. */
{
- void * p;
+ void *p;
u32 n_bytes = sizeof (h[0]);
vec_add2 (*result, p, n_bytes);
clib_memcpy (p, h, n_bytes);
}
-
+
return 1;
}
-static u8*
+static u8 *
hdlc_build_rewrite (vnet_main_t * vnm,
u32 sw_if_index,
- vnet_link_t link_type,
- const void *dst_address)
+ vnet_link_t link_type, const void *dst_address)
{
- hdlc_header_t * h;
- u8* rewrite = NULL;
+ hdlc_header_t *h;
+ u8 *rewrite = NULL;
hdlc_protocol_t protocol;
- switch (link_type) {
+ switch (link_type)
+ {
#define _(a,b) case VNET_LINK_##a: protocol = HDLC_PROTOCOL_##b; break
- _ (IP4, ip4);
- _ (IP6, ip6);
- _ (MPLS, mpls_unicast);
+ _(IP4, ip4);
+ _(IP6, ip6);
+ _(MPLS, mpls_unicast);
#undef _
- default:
+ default:
return (NULL);
- }
+ }
- vec_validate(rewrite, sizeof(*h)-1);
- h = (hdlc_header_t *)rewrite;
+ vec_validate (rewrite, sizeof (*h) - 1);
+ h = (hdlc_header_t *) rewrite;
h->address = 0x0f;
h->control = 0x00;
h->protocol = clib_host_to_net_u16 (protocol);
-
+
return (rewrite);
}
+/* *INDENT-OFF* */
VNET_HW_INTERFACE_CLASS (hdlc_hw_interface_class) = {
.name = "HDLC",
.format_header = format_hdlc_header_with_length,
@@ -203,12 +205,12 @@ VNET_HW_INTERFACE_CLASS (hdlc_hw_interface_class) = {
.build_rewrite = hdlc_build_rewrite,
.flags = VNET_HW_INTERFACE_CLASS_FLAG_P2P,
};
+/* *INDENT-ON* */
-static void add_protocol (hdlc_main_t * pm,
- hdlc_protocol_t protocol,
- char * protocol_name)
+static void
+add_protocol (hdlc_main_t * pm, hdlc_protocol_t protocol, char *protocol_name)
{
- hdlc_protocol_info_t * pi;
+ hdlc_protocol_info_t *pi;
u32 i;
vec_add2 (pm->protocol_infos, pi, 1);
@@ -222,9 +224,10 @@ static void add_protocol (hdlc_main_t * pm,
hash_set_mem (pm->protocol_info_by_name, pi->name, i);
}
-static clib_error_t * hdlc_init (vlib_main_t * vm)
+static clib_error_t *
+hdlc_init (vlib_main_t * vm)
{
- hdlc_main_t * pm = &hdlc_main;
+ hdlc_main_t *pm = &hdlc_main;
memset (pm, 0, sizeof (pm[0]));
pm->vlib_main = vm;
@@ -235,15 +238,23 @@ static clib_error_t * hdlc_init (vlib_main_t * vm)
#define _(n,s) add_protocol (pm, HDLC_PROTOCOL_##s, #s);
foreach_hdlc_protocol
#undef _
-
- return vlib_call_init_function (vm, hdlc_input_init);
+ return vlib_call_init_function (vm, hdlc_input_init);
}
VLIB_INIT_FUNCTION (hdlc_init);
-hdlc_main_t * hdlc_get_main (vlib_main_t * vm)
+hdlc_main_t *
+hdlc_get_main (vlib_main_t * vm)
{
vlib_call_init_function (vm, hdlc_init);
return &hdlc_main;
}
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/hdlc/hdlc.h b/src/vnet/hdlc/hdlc.h
index 8407d39dda7..a2bd6e928b2 100644
--- a/src/vnet/hdlc/hdlc.h
+++ b/src/vnet/hdlc/hdlc.h
@@ -46,16 +46,18 @@
extern vnet_hw_interface_class_t hdlc_hw_interface_class;
-typedef enum {
+typedef enum
+{
#define hdlc_error(n,s) HDLC_ERROR_##n,
#include <vnet/hdlc/error.def>
#undef hdlc_error
HDLC_N_ERROR,
} hdlc_error_t;
-typedef struct {
+typedef struct
+{
/* Name (a c string). */
- char * name;
+ char *name;
/* HDLC protocol type in host byte order. */
hdlc_protocol_t protocol;
@@ -67,19 +69,20 @@ typedef struct {
u32 next_index;
} hdlc_protocol_info_t;
-typedef struct {
- vlib_main_t * vlib_main;
+typedef struct
+{
+ vlib_main_t *vlib_main;
- hdlc_protocol_info_t * protocol_infos;
+ hdlc_protocol_info_t *protocol_infos;
/* Hash tables mapping name/protocol to protocol info index. */
- uword * protocol_info_by_name, * protocol_info_by_protocol;
+ uword *protocol_info_by_name, *protocol_info_by_protocol;
} hdlc_main_t;
always_inline hdlc_protocol_info_t *
hdlc_get_protocol_info (hdlc_main_t * em, hdlc_protocol_t protocol)
{
- uword * p = hash_get (em->protocol_info_by_protocol, protocol);
+ uword *p = hash_get (em->protocol_info_by_protocol, protocol);
return p ? vec_elt_at_index (em->protocol_infos, p[0]) : 0;
}
@@ -88,8 +91,7 @@ extern hdlc_main_t hdlc_main;
/* Register given node index to take input for given hdlc type. */
void
hdlc_register_input_type (vlib_main_t * vm,
- hdlc_protocol_t protocol,
- u32 node_index);
+ hdlc_protocol_t protocol, u32 node_index);
format_function_t format_hdlc_protocol;
format_function_t format_hdlc_header;
@@ -107,8 +109,8 @@ unformat_function_t unformat_pg_hdlc_header;
always_inline void
hdlc_setup_node (vlib_main_t * vm, u32 node_index)
{
- vlib_node_t * n = vlib_get_node (vm, node_index);
- pg_node_t * pn = pg_get_node (node_index);
+ vlib_node_t *n = vlib_get_node (vm, node_index);
+ pg_node_t *pn = pg_get_node (node_index);
n->format_buffer = format_hdlc_header_with_length;
n->unformat_buffer = unformat_hdlc_header;
@@ -117,7 +119,14 @@ hdlc_setup_node (vlib_main_t * vm, u32 node_index)
void
hdlc_register_input_protocol (vlib_main_t * vm,
- hdlc_protocol_t protocol,
- u32 node_index);
+ hdlc_protocol_t protocol, u32 node_index);
#endif /* included_hdlc_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/hdlc/node.c b/src/vnet/hdlc/node.c
index 57e04c85bae..6b8c7c625d2 100644
--- a/src/vnet/hdlc/node.c
+++ b/src/vnet/hdlc/node.c
@@ -46,43 +46,46 @@
_ (PUNT, "error-punt") \
_ (DROP, "error-drop")
-typedef enum {
+typedef enum
+{
#define _(s,n) HDLC_INPUT_NEXT_##s,
foreach_hdlc_input_next
#undef _
- HDLC_INPUT_N_NEXT,
+ HDLC_INPUT_N_NEXT,
} hdlc_input_next_t;
-typedef struct {
+typedef struct
+{
u8 packet_data[32];
} hdlc_input_trace_t;
-static u8 * format_hdlc_input_trace (u8 * s, va_list * va)
+static u8 *
+format_hdlc_input_trace (u8 * s, va_list * va)
{
CLIB_UNUSED (vlib_main_t * vm) = va_arg (*va, vlib_main_t *);
CLIB_UNUSED (vlib_node_t * node) = va_arg (*va, vlib_node_t *);
- hdlc_input_trace_t * t = va_arg (*va, hdlc_input_trace_t *);
+ hdlc_input_trace_t *t = va_arg (*va, hdlc_input_trace_t *);
s = format (s, "%U", format_hdlc_header, t->packet_data);
return s;
}
-typedef struct {
+typedef struct
+{
/* Sparse vector mapping hdlc protocol in network byte order
to next index. */
- u16 * next_by_protocol;
+ u16 *next_by_protocol;
- u32 * sparse_index_by_next_index;
+ u32 *sparse_index_by_next_index;
} hdlc_input_runtime_t;
static uword
hdlc_input (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * from_frame)
+ vlib_node_runtime_t * node, vlib_frame_t * from_frame)
{
- hdlc_input_runtime_t * rt = (void *) node->runtime_data;
- u32 n_left_from, next_index, i_next, * from, * to_next;
+ hdlc_input_runtime_t *rt = (void *) node->runtime_data;
+ u32 n_left_from, next_index, i_next, *from, *to_next;
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
@@ -101,19 +104,18 @@ hdlc_input (vlib_main_t * vm,
{
u32 n_left_to_next;
- vlib_get_next_frame (vm, node, next_index,
- to_next, n_left_to_next);
+ vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
while (n_left_from >= 4 && n_left_to_next >= 2)
{
u32 bi0, bi1;
- vlib_buffer_t * b0, * b1;
- hdlc_header_t * h0, * h1;
+ vlib_buffer_t *b0, *b1;
+ hdlc_header_t *h0, *h1;
u32 i0, i1, len0, len1, protocol0, protocol1, enqueue_code;
/* Prefetch next iteration. */
{
- vlib_buffer_t * b2, * b3;
+ vlib_buffer_t *b2, *b3;
b2 = vlib_get_buffer (vm, from[2]);
b3 = vlib_get_buffer (vm, from[3]);
@@ -146,7 +148,7 @@ hdlc_input (vlib_main_t * vm,
/* Add padding bytes for OSI protocols. */
len0 = sizeof (h0[0]);
len1 = sizeof (h1[0]);
-
+
len0 += protocol0 == clib_host_to_net_u16 (HDLC_PROTOCOL_osi);
len1 += protocol1 == clib_host_to_net_u16 (HDLC_PROTOCOL_osi);
@@ -157,12 +159,19 @@ hdlc_input (vlib_main_t * vm,
b1->current_length -= len1;
/* Index sparse array with network byte order. */
- sparse_vec_index2 (rt->next_by_protocol, protocol0, protocol1, &i0, &i1);
+ sparse_vec_index2 (rt->next_by_protocol, protocol0, protocol1, &i0,
+ &i1);
- b0->error = node->errors[i0 == SPARSE_VEC_INVALID_INDEX ? HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
- b1->error = node->errors[i1 == SPARSE_VEC_INVALID_INDEX ? HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
+ b0->error =
+ node->errors[i0 ==
+ SPARSE_VEC_INVALID_INDEX ?
+ HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
+ b1->error =
+ node->errors[i1 ==
+ SPARSE_VEC_INVALID_INDEX ?
+ HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
- enqueue_code = (i0 != i_next) + 2*(i1 != i_next);
+ enqueue_code = (i0 != i_next) + 2 * (i1 != i_next);
if (PREDICT_FALSE (enqueue_code != 0))
{
@@ -173,39 +182,48 @@ hdlc_input (vlib_main_t * vm,
to_next[-2] = bi1;
to_next -= 1;
n_left_to_next += 1;
- vlib_set_next_frame_buffer (vm, node, vec_elt (rt->next_by_protocol, i0), bi0);
+ vlib_set_next_frame_buffer (vm, node,
+ vec_elt (rt->next_by_protocol,
+ i0), bi0);
break;
case 2:
/* A A B */
to_next -= 1;
n_left_to_next += 1;
- vlib_set_next_frame_buffer (vm, node, vec_elt (rt->next_by_protocol, i1), bi1);
+ vlib_set_next_frame_buffer (vm, node,
+ vec_elt (rt->next_by_protocol,
+ i1), bi1);
break;
case 3:
/* A B B or A B C */
to_next -= 2;
n_left_to_next += 2;
- vlib_set_next_frame_buffer (vm, node, vec_elt (rt->next_by_protocol, i0), bi0);
- vlib_set_next_frame_buffer (vm, node, vec_elt (rt->next_by_protocol, i1), bi1);
+ vlib_set_next_frame_buffer (vm, node,
+ vec_elt (rt->next_by_protocol,
+ i0), bi0);
+ vlib_set_next_frame_buffer (vm, node,
+ vec_elt (rt->next_by_protocol,
+ i1), bi1);
if (i0 == i1)
{
vlib_put_next_frame (vm, node, next_index,
n_left_to_next);
i_next = i1;
next_index = vec_elt (rt->next_by_protocol, i_next);
- vlib_get_next_frame (vm, node, next_index, to_next, n_left_to_next);
+ vlib_get_next_frame (vm, node, next_index, to_next,
+ n_left_to_next);
}
}
}
}
-
+
while (n_left_from > 0 && n_left_to_next > 0)
{
u32 bi0;
- vlib_buffer_t * b0;
- hdlc_header_t * h0;
+ vlib_buffer_t *b0;
+ hdlc_header_t *h0;
u32 i0, len0, protocol0;
bi0 = from[0];
@@ -230,8 +248,11 @@ hdlc_input (vlib_main_t * vm,
i0 = sparse_vec_index (rt->next_by_protocol, protocol0);
- b0->error = node->errors[i0 == SPARSE_VEC_INVALID_INDEX ? HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
-
+ b0->error =
+ node->errors[i0 ==
+ SPARSE_VEC_INVALID_INDEX ?
+ HDLC_ERROR_UNKNOWN_PROTOCOL : HDLC_ERROR_NONE];
+
/* Sent packet to wrong next? */
if (PREDICT_FALSE (i0 != i_next))
{
@@ -256,12 +277,13 @@ hdlc_input (vlib_main_t * vm,
return from_frame->n_vectors;
}
-static char * hdlc_error_strings[] = {
+static char *hdlc_error_strings[] = {
#define hdlc_error(n,s) s,
#include "error.def"
#undef hdlc_error
};
+/* *INDENT-OFF* */
VLIB_REGISTER_NODE (hdlc_input_node) = {
.function = hdlc_input,
.name = "hdlc-input",
@@ -284,14 +306,16 @@ VLIB_REGISTER_NODE (hdlc_input_node) = {
.format_trace = format_hdlc_input_trace,
.unformat_buffer = unformat_hdlc_header,
};
+/* *INDENT-ON* */
-static clib_error_t * hdlc_input_runtime_init (vlib_main_t * vm)
+static clib_error_t *
+hdlc_input_runtime_init (vlib_main_t * vm)
{
- hdlc_input_runtime_t * rt;
+ hdlc_input_runtime_t *rt;
rt = vlib_node_get_runtime_data (vm, hdlc_input_node.index);
rt->next_by_protocol = sparse_vec_new
- (/* elt bytes */ sizeof (rt->next_by_protocol[0]),
+ ( /* elt bytes */ sizeof (rt->next_by_protocol[0]),
/* bits in index */ BITS (((hdlc_header_t *) 0)->protocol));
vec_validate (rt->sparse_index_by_next_index, HDLC_INPUT_NEXT_DROP);
@@ -304,11 +328,12 @@ static clib_error_t * hdlc_input_runtime_init (vlib_main_t * vm)
return 0;
}
-static clib_error_t * hdlc_input_init (vlib_main_t * vm)
+static clib_error_t *
+hdlc_input_init (vlib_main_t * vm)
{
{
- clib_error_t * error = vlib_call_init_function (vm, hdlc_init);
+ clib_error_t *error = vlib_call_init_function (vm, hdlc_init);
if (error)
clib_error_report (error);
}
@@ -324,30 +349,29 @@ VLIB_WORKER_INIT_FUNCTION (hdlc_input_runtime_init);
void
hdlc_register_input_protocol (vlib_main_t * vm,
- hdlc_protocol_t protocol,
- u32 node_index)
+ hdlc_protocol_t protocol, u32 node_index)
{
- hdlc_main_t * em = &hdlc_main;
- hdlc_protocol_info_t * pi;
- hdlc_input_runtime_t * rt;
- u16 * n;
+ hdlc_main_t *em = &hdlc_main;
+ hdlc_protocol_info_t *pi;
+ hdlc_input_runtime_t *rt;
+ u16 *n;
u32 i;
{
- clib_error_t * error = vlib_call_init_function (vm, hdlc_input_init);
+ clib_error_t *error = vlib_call_init_function (vm, hdlc_input_init);
if (error)
clib_error_report (error);
}
pi = hdlc_get_protocol_info (em, protocol);
pi->node_index = node_index;
- pi->next_index = vlib_node_add_next (vm,
- hdlc_input_node.index,
- node_index);
+ pi->next_index = vlib_node_add_next (vm, hdlc_input_node.index, node_index);
/* Setup hdlc protocol -> next index sparse vector mapping. */
rt = vlib_node_get_runtime_data (vm, hdlc_input_node.index);
- n = sparse_vec_validate (rt->next_by_protocol, clib_host_to_net_u16 (protocol));
+ n =
+ sparse_vec_validate (rt->next_by_protocol,
+ clib_host_to_net_u16 (protocol));
n[0] = pi->next_index;
/* Rebuild next index -> sparse index inverse mapping when sparse vector
@@ -356,3 +380,11 @@ hdlc_register_input_protocol (vlib_main_t * vm,
for (i = 1; i < vec_len (rt->next_by_protocol); i++)
rt->sparse_index_by_next_index[rt->next_by_protocol[i]] = i;
}
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/hdlc/packet.h b/src/vnet/hdlc/packet.h
index 45e5496fbc8..a641cd2edaf 100644
--- a/src/vnet/hdlc/packet.h
+++ b/src/vnet/hdlc/packet.h
@@ -49,13 +49,15 @@
_ (0x86dd, ip6) \
_ (0xfefe, osi)
-typedef enum {
+typedef enum
+{
#define _(n,f) HDLC_PROTOCOL_##f = n,
foreach_hdlc_protocol
#undef _
} hdlc_protocol_t;
-typedef struct {
+typedef struct
+{
/* Set to 0x0f for unicast; 0x8f for broadcast. */
u8 address;
@@ -70,3 +72,11 @@ typedef struct {
} hdlc_header_t;
#endif /* included_vnet_hdlc_packet_h */
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */
diff --git a/src/vnet/hdlc/pg.c b/src/vnet/hdlc/pg.c
index b8e67022b08..408e1876a6a 100644
--- a/src/vnet/hdlc/pg.c
+++ b/src/vnet/hdlc/pg.c
@@ -41,7 +41,8 @@
#include <vnet/pg/pg.h>
#include <vnet/hdlc/hdlc.h>
-typedef struct {
+typedef struct
+{
pg_edit_t address;
pg_edit_t control;
pg_edit_t protocol;
@@ -58,10 +59,10 @@ pg_hdlc_header_init (pg_hdlc_header_t * e)
uword
unformat_pg_hdlc_header (unformat_input_t * input, va_list * args)
{
- pg_stream_t * s = va_arg (*args, pg_stream_t *);
- pg_hdlc_header_t * h;
+ pg_stream_t *s = va_arg (*args, pg_stream_t *);
+ pg_hdlc_header_t *h;
u32 group_index, error;
-
+
h = pg_create_edit_group (s, sizeof (h[0]), sizeof (hdlc_header_t),
&group_index);
pg_hdlc_header_init (h);
@@ -70,15 +71,15 @@ unformat_pg_hdlc_header (unformat_input_t * input, va_list * args)
pg_edit_set_fixed (&h->control, 0x00);
error = 1;
- if (! unformat (input, "%U",
- unformat_pg_edit,
- unformat_hdlc_protocol_net_byte_order, &h->protocol))
+ if (!unformat (input, "%U",
+ unformat_pg_edit,
+ unformat_hdlc_protocol_net_byte_order, &h->protocol))
goto done;
{
- hdlc_main_t * pm = &hdlc_main;
- hdlc_protocol_info_t * pi = 0;
- pg_node_t * pg_node = 0;
+ hdlc_main_t *pm = &hdlc_main;
+ hdlc_protocol_info_t *pi = 0;
+ pg_node_t *pg_node = 0;
if (h->protocol.type == PG_EDIT_FIXED)
{
@@ -92,14 +93,22 @@ unformat_pg_hdlc_header (unformat_input_t * input, va_list * args)
&& unformat_user (input, pg_node->unformat_edit, s))
;
- else if (! unformat_user (input, unformat_pg_payload, s))
+ else if (!unformat_user (input, unformat_pg_payload, s))
goto done;
}
error = 0;
- done:
+done:
if (error)
pg_free_edit_group (s);
return error == 0;
}
+
+/*
+ * fd.io coding-style-patch-verification: ON
+ *
+ * Local Variables:
+ * eval: (c-set-style "gnu")
+ * End:
+ */