summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/dpdk/device/common.c1
-rw-r--r--src/plugins/dpdk/device/device.c1
-rw-r--r--src/plugins/dpdk/device/flow.c1
-rw-r--r--src/plugins/dpdk/device/format.c1
-rw-r--r--src/vlib/CMakeLists.txt4
-rw-r--r--src/vlib/i2c.c231
-rw-r--r--src/vlib/i2c.h67
-rw-r--r--src/vlib/main.c3
-rw-r--r--src/vlib/threads.c4
-rw-r--r--src/vlib/unix/cj.c284
-rw-r--r--src/vlib/unix/cj.h79
11 files changed, 0 insertions, 676 deletions
diff --git a/src/plugins/dpdk/device/common.c b/src/plugins/dpdk/device/common.c
index f91e3bf836f..41b32a6e182 100644
--- a/src/plugins/dpdk/device/common.c
+++ b/src/plugins/dpdk/device/common.c
@@ -16,7 +16,6 @@
#include <vnet/vnet.h>
#include <vppinfra/vec.h>
#include <vppinfra/format.h>
-#include <vlib/unix/cj.h>
#include <assert.h>
#include <vnet/ip/ip.h>
diff --git a/src/plugins/dpdk/device/device.c b/src/plugins/dpdk/device/device.c
index c355edf6a4b..d6a001b5ded 100644
--- a/src/plugins/dpdk/device/device.c
+++ b/src/plugins/dpdk/device/device.c
@@ -15,7 +15,6 @@
#include <vnet/vnet.h>
#include <vppinfra/vec.h>
#include <vppinfra/format.h>
-#include <vlib/unix/cj.h>
#include <assert.h>
#include <vnet/ethernet/ethernet.h>
diff --git a/src/plugins/dpdk/device/flow.c b/src/plugins/dpdk/device/flow.c
index dd62ba5c73b..279468f10f8 100644
--- a/src/plugins/dpdk/device/flow.c
+++ b/src/plugins/dpdk/device/flow.c
@@ -16,7 +16,6 @@
#include <vnet/vnet.h>
#include <vppinfra/vec.h>
#include <vppinfra/format.h>
-#include <vlib/unix/cj.h>
#include <assert.h>
#include <vnet/ip/ip.h>
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 0eb2726110a..3d6e80ff2fb 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -15,7 +15,6 @@
#include <vnet/vnet.h>
#include <vppinfra/vec.h>
#include <vppinfra/format.h>
-#include <vlib/unix/cj.h>
#include <assert.h>
#define __USE_GNU
diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt
index 67d1f6d05c7..0085f64cc77 100644
--- a/src/vlib/CMakeLists.txt
+++ b/src/vlib/CMakeLists.txt
@@ -61,7 +61,6 @@ add_vpp_library(vlib
error.c
format.c
handoff_trace.c
- i2c.c
init.c
linux/pci.c
linux/vfio.c
@@ -78,7 +77,6 @@ add_vpp_library(vlib
threads.c
threads_cli.c
trace.c
- unix/cj.c
unix/cli.c
unix/input.c
unix/main.c
@@ -103,7 +101,6 @@ add_vpp_library(vlib
error.h
format_funcs.h
global_funcs.h
- i2c.h
init.h
linux/vfio.h
log.h
@@ -119,7 +116,6 @@ add_vpp_library(vlib
threads.h
trace_funcs.h
trace.h
- unix/cj.h
unix/mc_socket.h
unix/plugin.h
unix/unix.h
diff --git a/src/vlib/i2c.c b/src/vlib/i2c.c
deleted file mode 100644
index 97f5bb21cc7..00000000000
--- a/src/vlib/i2c.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <vlib/vlib.h>
-#include <vlib/i2c.h>
-
-static inline void
-i2c_delay (i2c_bus_t * b, f64 timeout)
-{
- vlib_main_t *vm = vlib_get_main ();
- vlib_time_wait (vm, timeout);
-}
-
-static void
-i2c_wait_for_scl (i2c_bus_t * b)
-{
- f64 t = 0;
-
- while (t < b->hold_time)
- {
- int sda, scl;
- i2c_delay (b, b->rise_fall_time);
- b->get_bits (b, &scl, &sda);
-
- if (scl)
- return;
-
- t += b->rise_fall_time;
- }
- b->timeout = 1;
-}
-
-static void
-i2c_start (i2c_bus_t * b)
-{
- b->timeout = 0;
-
- b->put_bits (b, 1, 1);
- i2c_wait_for_scl (b);
-
- if (vlib_i2c_bus_timed_out (b))
- return;
-
- b->put_bits (b, 1, 0);
- i2c_delay (b, b->hold_time);
- b->put_bits (b, 0, 0);
- i2c_delay (b, b->hold_time);
-}
-
-static void
-i2c_stop (i2c_bus_t * b)
-{
- b->put_bits (b, 0, 0);
- i2c_delay (b, b->rise_fall_time);
-
- b->put_bits (b, 1, 0);
- i2c_delay (b, b->hold_time);
-
- b->put_bits (b, 1, 1);
- i2c_delay (b, b->hold_time);
-}
-
-static void
-i2c_write_bit (i2c_bus_t * b, int sda)
-{
- b->put_bits (b, 0, sda);
- i2c_delay (b, b->rise_fall_time);
-
- b->put_bits (b, 1, sda);
- i2c_wait_for_scl (b);
- i2c_delay (b, b->hold_time);
-
- b->put_bits (b, 0, sda);
- i2c_delay (b, b->rise_fall_time);
-}
-
-static void
-i2c_read_bit (i2c_bus_t * b, int *sda)
-{
- int scl;
-
- b->put_bits (b, 1, 1);
- i2c_wait_for_scl (b);
- i2c_delay (b, b->hold_time);
-
- b->get_bits (b, &scl, sda);
-
- b->put_bits (b, 0, 1);
- i2c_delay (b, b->rise_fall_time);
-}
-
-static void
-i2c_write_byte (i2c_bus_t * b, u8 data)
-{
- int i, sda;
-
- for (i = 7; i >= 0; i--)
- {
- i2c_write_bit (b, (data >> i) & 1);
- if (b->timeout)
- return;
- }
-
- b->put_bits (b, 0, 1);
- i2c_delay (b, b->rise_fall_time);
-
- i2c_read_bit (b, &sda);
-
- if (sda)
- b->timeout = 1;
-}
-
-
-static void
-i2c_read_byte (i2c_bus_t * b, u8 * data, int ack)
-{
- int i, sda;
-
- *data = 0;
-
- b->put_bits (b, 0, 1);
- i2c_delay (b, b->rise_fall_time);
-
- for (i = 7; i >= 0; i--)
- {
- i2c_read_bit (b, &sda);
- if (b->timeout)
- return;
-
- *data |= (sda != 0) << i;
- }
-
- i2c_write_bit (b, ack == 0);
-}
-
-
-void
-vlib_i2c_init (i2c_bus_t * b)
-{
- f64 tick;
- if (!b->clock)
- b->clock = 400000;
-
- tick = 1.0 / b->clock;
-
- /* Spend 40% of time in low and high states */
- if (!b->hold_time)
- b->hold_time = 0.4 * tick;
-
- /* Spend 10% of time waiting for rise and fall */
- if (!b->rise_fall_time)
- b->rise_fall_time = 0.1 * tick;
-}
-
-void
-vlib_i2c_xfer (i2c_bus_t * bus, i2c_msg_t * msgs)
-{
- i2c_msg_t *msg;
- int i;
-
- vec_foreach (msg, msgs)
- {
- i2c_start (bus);
- i2c_write_byte (bus,
- (msg->addr << 1) + (msg->flags == I2C_MSG_FLAG_READ));
-
- if (msg->flags & I2C_MSG_FLAG_READ)
- for (i = 0; i < msg->len; i++)
- {
- i2c_read_byte (bus, &msg->buffer[i], /* ack */ i + 1 != msg->len);
- if (bus->timeout)
- goto done;
- }
-
- else
- for (i = 0; i < msg->len; i++)
- {
- i2c_write_byte (bus, msg->buffer[i]);
- if (bus->timeout)
- goto done;
- }
- }
-
-done:
- i2c_stop (bus);
-}
-
-void
-vlib_i2c_read_eeprom (i2c_bus_t * bus, u8 i2c_addr, u16 start_addr,
- u16 length, u8 * data)
-{
- i2c_msg_t *msg = 0;
- u8 start_address[1];
-
- vec_validate (msg, 1);
-
- start_address[0] = start_addr;
- msg[0].addr = i2c_addr;
- msg[0].flags = I2C_MSG_FLAG_WRITE;
- msg[0].buffer = (u8 *) & start_address;
- msg[0].len = 1;
-
- msg[1].addr = i2c_addr;
- msg[1].flags = I2C_MSG_FLAG_READ;
- msg[1].buffer = data;
- msg[1].len = length;
-
- vlib_i2c_xfer (bus, msg);
-
- vec_free (msg);
-}
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vlib/i2c.h b/src/vlib/i2c.h
deleted file mode 100644
index b79bdc75b81..00000000000
--- a/src/vlib/i2c.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef included_vlib_i2c_h
-#define included_vlib_i2c_h
-
-#include <vppinfra/types.h>
-
-
-#define I2C_MSG_FLAG_WRITE 0
-#define I2C_MSG_FLAG_READ 1
-
-typedef struct
-{
- u8 addr;
- u8 flags;
- u16 len;
- u8 *buffer;
-} i2c_msg_t;
-
-typedef struct i2c_bus_t
-{
- void (*put_bits) (struct i2c_bus_t * b, int scl, int sda);
- void (*get_bits) (struct i2c_bus_t * b, int *scl, int *sda);
-
- int timeout;
- u32 clock;
- f64 hold_time;
- f64 rise_fall_time;
-
- /* Private data */
- uword private_data;
-
-} i2c_bus_t;
-
-void vlib_i2c_init (i2c_bus_t * bus);
-void vlib_i2c_xfer (i2c_bus_t * bus, i2c_msg_t * msgs);
-void vlib_i2c_read_eeprom (i2c_bus_t * bus, u8 i2c_addr, u16 start_addr,
- u16 length, u8 * data);
-
-static inline int
-vlib_i2c_bus_timed_out (i2c_bus_t * bus)
-{
- return bus->timeout;
-}
-
-#endif /* included_vlib_i2c_h */
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vlib/main.c b/src/vlib/main.c
index fb3eb108736..c3ca8b153f0 100644
--- a/src/vlib/main.c
+++ b/src/vlib/main.c
@@ -44,9 +44,6 @@
#include <vppinfra/tw_timer_1t_3w_1024sl_ov.h>
#include <vlib/unix/unix.h>
-#include <vlib/unix/cj.h>
-
-CJ_GLOBAL_LOG_PROTOTYPE;
/* Actually allocate a few extra slots of vector data to support
speculative vector enqueues which overflow vector data in next frame. */
diff --git a/src/vlib/threads.c b/src/vlib/threads.c
index 82263797d93..2f141f10d05 100644
--- a/src/vlib/threads.c
+++ b/src/vlib/threads.c
@@ -22,13 +22,9 @@
#include <vlib/vlib.h>
#include <vlib/threads.h>
-#include <vlib/unix/cj.h>
#include <vlib/stat_weak_inlines.h>
-DECLARE_CJ_GLOBAL_LOG;
-
-
u32
vl (void *p)
{
diff --git a/src/vlib/unix/cj.c b/src/vlib/unix/cj.c
deleted file mode 100644
index e163e1ae017..00000000000
--- a/src/vlib/unix/cj.c
+++ /dev/null
@@ -1,284 +0,0 @@
-/*
- *------------------------------------------------------------------
- * cj.c
- *
- * Copyright (c) 2013 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *------------------------------------------------------------------
- */
-
-/**
- * @file
- * Circular journal diagnostic mechanism.
- *
- * The @c cj thread-safe circular log buffer scheme is occasionally useful
- * when chasing bugs. Calls to it should not be checked in.
- */
-/*? %%clicmd:group_label Circular Journal %% ?*/
-/*? %%syscfg:group_label Circular Journal %% ?*/
-
-#include <stdio.h>
-#include <vlib/vlib.h>
-
-#include <vlib/unix/cj.h>
-
-cj_main_t cj_main;
-
-void
-cj_log (u32 type, void *data0, void *data1)
-{
- u64 new_tail;
- cj_main_t *cjm = &cj_main;
- cj_record_t *r;
-
- if (cjm->enable == 0)
- return;
-
- new_tail = clib_atomic_add_fetch (&cjm->tail, 1);
-
- r = (cj_record_t *) & (cjm->records[new_tail & (cjm->num_records - 1)]);
- r->time = vlib_time_now (cjm->vlib_main);
- r->thread_index = vlib_get_thread_index ();
- r->type = type;
- r->data[0] = pointer_to_uword (data0);
- r->data[1] = pointer_to_uword (data1);
-}
-
-void
-cj_stop (void)
-{
- cj_main_t *cjm = &cj_main;
-
- cjm->enable = 0;
-}
-
-
-clib_error_t *
-cj_init (vlib_main_t * vm)
-{
- cj_main_t *cjm = &cj_main;
-
- cjm->vlib_main = vm;
- return 0;
-}
-
-VLIB_INIT_FUNCTION (cj_init);
-
-static clib_error_t *
-cj_config (vlib_main_t * vm, unformat_input_t * input)
-{
- cj_main_t *cjm = &cj_main;
- int matched = 0;
- int enable = 0;
-
- while (unformat_check_input (input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (input, "records %d", &cjm->num_records))
- matched = 1;
- else if (unformat (input, "on"))
- enable = 1;
- else
- return clib_error_return (0, "cj_config: unknown input '%U'",
- format_unformat_error, input);
- }
-
- if (matched == 0)
- return 0;
-
- cjm->num_records = max_pow2 (cjm->num_records);
- vec_validate (cjm->records, cjm->num_records - 1);
- clib_memset (cjm->records, 0xff, cjm->num_records * sizeof (cj_record_t));
- cjm->tail = ~0;
- cjm->enable = enable;
-
- return 0;
-}
-
-/*?
- * Configure the circular journal diagnostic mechanism. This is only useful
- * if you, the developer, have written code to make use of the circular
- * journal.
- *
- * @cfgcmd{records, &lt;number&gt;}
- * Configure the number of records to allocate for the circular journal.
- *
- * @cfgcmd{on}
- * Enable the collection of records in the circular journal at the
- * earliest opportunity.
-?*/
-VLIB_CONFIG_FUNCTION (cj_config, "cj");
-
-void
-cj_enable_disable (int is_enable)
-{
- cj_main_t *cjm = &cj_main;
-
- if (cjm->num_records)
- cjm->enable = is_enable;
- else
- vlib_cli_output (cjm->vlib_main, "CJ not configured...");
-}
-
-static inline void
-cj_dump_one_record (cj_record_t * r)
-{
- fprintf (stderr, "[%d]: %10.6f T%02d %llx %llx\n",
- r->thread_index, r->time, r->type,
- (long long unsigned int) r->data[0],
- (long long unsigned int) r->data[1]);
-}
-
-static void
-cj_dump_internal (u8 filter0_enable, u64 filter0,
- u8 filter1_enable, u64 filter1)
-{
- cj_main_t *cjm = &cj_main;
- cj_record_t *r;
- u32 i, index;
-
- if (cjm->num_records == 0)
- {
- fprintf (stderr, "CJ not configured...\n");
- return;
- }
-
- if (cjm->tail == (u64) ~ 0)
- {
- fprintf (stderr, "No data collected...\n");
- return;
- }
-
- /* Has the trace wrapped? */
- index = (cjm->tail + 1) & (cjm->num_records - 1);
- r = &(cjm->records[index]);
-
- if (r->thread_index != (u32) ~ 0)
- {
- /* Yes, dump from tail + 1 to the end */
- for (i = index; i < cjm->num_records; i++)
- {
- if (filter0_enable && (r->data[0] != filter0))
- goto skip;
- if (filter1_enable && (r->data[1] != filter1))
- goto skip;
- cj_dump_one_record (r);
- skip:
- r++;
- }
- }
- /* dump from the beginning through the final tail */
- r = cjm->records;
- for (i = 0; i < index; i++)
- {
- if (filter0_enable && (r->data[0] != filter0))
- goto skip2;
- if (filter1_enable && (r->data[1] != filter1))
- goto skip2;
- cj_dump_one_record (r);
- skip2:
- r++;
- }
-}
-
-void
-cj_dump (void)
-{
- cj_dump_internal (0, 0, 0, 0);
-}
-
-void
-cj_dump_filter_data0 (u64 filter0)
-{
- cj_dump_internal (1 /* enable f0 */ , filter0, 0, 0);
-}
-
-void
-cj_dump_filter_data1 (u64 filter1)
-{
- cj_dump_internal (0, 0, 1 /* enable f1 */ , filter1);
-}
-
-void
-cj_dump_filter_data12 (u64 filter0, u64 filter1)
-{
- cj_dump_internal (1, filter0, 1, filter1);
-}
-
-static clib_error_t *
-cj_command_fn (vlib_main_t * vm,
- unformat_input_t * input, vlib_cli_command_t * cmd)
-{
- int is_enable = -1;
- int is_dump = -1;
- unformat_input_t _line_input, *line_input = &_line_input;
- clib_error_t *error = NULL;
-
- /* Get a line of input. */
- if (!unformat_user (input, unformat_line_input, line_input))
- return clib_error_return (0, "expected enable | disable | dump");
-
- while (unformat_check_input (line_input) != UNFORMAT_END_OF_INPUT)
- {
- if (unformat (line_input, "enable") || unformat (line_input, "on"))
- is_enable = 1;
- else if (unformat (line_input, "disable")
- || unformat (line_input, "off"))
- is_enable = 0;
- else if (unformat (line_input, "dump"))
- is_dump = 1;
- else
- {
- error = clib_error_return (0, "unknown input `%U'",
- format_unformat_error, line_input);
- goto done;
- }
- }
-
- if (is_enable >= 0)
- cj_enable_disable (is_enable);
-
- if (is_dump > 0)
- cj_dump ();
-
-done:
- unformat_free (line_input);
- return error;
-}
-
-/*?
- * Enable, disable the collection of diagnostic data into a
- * circular journal or dump the circular journal diagnostic data.
- * This is only useful if you, the developer, have written code to make
- * use of the circular journal.
- *
- * When dumping the data it is formatted and sent to @c stderr of the
- * VPP process; when running VPP in <code>unix interactive</code> mode
- * this is typically the same place as the Debug CLI.
-?*/
-
-/* *INDENT-OFF* */
-VLIB_CLI_COMMAND (cj_command,static) = {
- .path = "cj",
- .short_help = "cj <enable | disable | dump>",
- .function = cj_command_fn,
-};
-/* *INDENT-ON* */
-
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */
diff --git a/src/vlib/unix/cj.h b/src/vlib/unix/cj.h
deleted file mode 100644
index d0a1d46ee99..00000000000
--- a/src/vlib/unix/cj.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- *------------------------------------------------------------------
- * cj.h
- *
- * Copyright (c) 2013 Cisco and/or its affiliates.
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *------------------------------------------------------------------
- */
-
-#ifndef __included_cj_h__
-#define __included_cj_h__
-
-typedef struct
-{
- f64 time;
- u32 thread_index;
- u32 type;
- u64 data[2];
-} cj_record_t;
-
-typedef struct
-{
- volatile u64 tail;
- cj_record_t *records;
- u32 num_records;
- volatile u32 enable;
-
- vlib_main_t *vlib_main;
-} cj_main_t;
-
-void cj_log (u32 type, void *data0, void *data1);
-
-/*
- * Supply in application main, so we can log from any library...
- * Declare a weak reference in the library, off you go.
- */
-
-#define DECLARE_CJ_GLOBAL_LOG \
-void cj_global_log (unsigned type, void * data0, void * data1) \
- __attribute__ ((weak)); \
- \
-unsigned __cj_type; \
-void * __cj_data0; \
-void * __cj_data1; \
- \
-void \
-cj_global_log (unsigned type, void * data0, void * data1) \
-{ \
- __cj_type = type; \
- __cj_data0 = data0; \
- __cj_data1 = data1; \
-}
-
-#define CJ_GLOBAL_LOG_PROTOTYPE
-void
-cj_global_log (unsigned type, void *data0, void *data1)
-__attribute__ ((weak));
-
-void cj_stop (void);
-
-#endif /* __included_cj_h__ */
-
-/*
- * fd.io coding-style-patch-verification: ON
- *
- * Local Variables:
- * eval: (c-set-style "gnu")
- * End:
- */