Commit 65dbf340 authored by Adam Wujek's avatar Adam Wujek 💬

Merge branch 'greg-time-fixes'

parents 8c50d5a3 3d734bd4
......@@ -200,8 +200,7 @@ static float tmp100_read_temp(int dev_addr)
static int shw_init_i2c_sensors(void)
{
if (i2c_init_bus(&fpga_sensors_i2c) < 0) {
pr_error(
"can't initialize temperature sensors I2C bus.\n");
pr_error("Can't initialize temperature sensors I2C bus.\n");
return -1;
}
return 0;
......@@ -266,7 +265,7 @@ int shw_init_fans(void)
config_item = libwr_cfg_get("FAN_HYSTERESIS");
if ((config_item) && !strcmp(config_item, "y")) {
fan_hysteresis = 1;
pr_info("enable fan hysteresis\n");
pr_info("Enabling fan hysteresis\n");
config_item = libwr_cfg_get("FAN_HYSTERESIS_T_ENABLE");
if (config_item) {
fan_hysteresis_t_enable = atoi(config_item);
......@@ -290,11 +289,11 @@ int shw_init_fans(void)
fan_hysteresis_pwm_val = 4;
}
pr_info("set temp enable to %d for fan hysteresis\n",
fan_hysteresis_t_enable);
pr_info("set temp disable to %d for fan hysteresis\n",
fan_hysteresis_t_disable);
pr_info("set pwm value to %d for fan hysteresis\n",
pr_info("Setting upper temperature threshold to %d for fan "
"hysteresis\n", fan_hysteresis_t_enable);
pr_info("Setting lower temperature threshold to %d for fan "
"hysteresis\n", fan_hysteresis_t_disable);
pr_info("Setting pwm value to %d for fan hysteresis\n",
fan_hysteresis_pwm_val);
}
......
......@@ -25,7 +25,7 @@ int shw_fpga_mmap_init()
{
int fd;
pr_info("Initializing FPGA memory mapping.\n");
pr_debug("Initializing FPGA memory mapping.\n");
fd = open("/dev/mem", O_RDWR | O_SYNC);
if (fd < 0) {
......@@ -42,7 +42,7 @@ int shw_fpga_mmap_init()
return -1;
}
pr_info("FPGA virtual base = %p\n", _fpga_base_virt);
pr_debug("FPGA virtual base = %p\n", _fpga_base_virt);
return 0;
......
......@@ -70,6 +70,6 @@ int32_t i2c_scan(struct i2c_bus * bus, uint8_t * data)
found++;
}
}
pr_info("%s (%p): ndev=%d\n", bus->name, bus, found);
pr_debug("%s (%p): ndev=%d\n", bus->name, bus, found);
return found;
}
......@@ -24,7 +24,7 @@ int i2c_bitbang_init_bus(struct i2c_bus *bus)
priv = (struct i2c_bitbang *)bus->type_specific;
pr_info("init: %s (%p)\n", bus->name, bus);
pr_debug("init: %s (%p)\n", bus->name, bus);
shw_pio_configure(priv->scl);
shw_pio_configure(priv->sda);
shw_pio_setdir(priv->scl, 0);
......
......@@ -68,13 +68,12 @@ struct i2c_bus i2c_io_bus = {
int shw_i2c_io_init(void)
{
pr_info("Initializing IO I2C bus...%s\n", __TIME__);
if (i2c_init_bus(&i2c_io_bus) < 0) {
pr_error("init failed: %s\n", i2c_io_bus.name);
pr_error("I2C I/O init failed for bus %s\n", i2c_io_bus.name);
return -1;
}
pr_info("init: success: %s\n", i2c_io_bus.name);
pr_info("I2C I/O init success for bus %s\n", i2c_io_bus.name);
return 0;
}
......@@ -112,9 +111,8 @@ int shw_get_hw_ver(void)
case 2:
return 341;
default:
pr_error(
"Unknown HW version (0x%x), check the DIP switch under the SCB\n",
(ret >> 1) & 0x7);
pr_error("Unknown HW version (0x%x), check the DIP "
"switch under the SCB\n", (ret >> 1) & 0x7);
return -1;
}
......
......@@ -194,7 +194,8 @@ int shw_sfp_buses_init(void)
pr_info("Initializing SFP I2C busses...\n");
for (i = 0; i < ARRAY_SIZE(i2c_buses); i++) {
if (i2c_init_bus(&i2c_buses[i]) < 0) {
pr_error("init failed: %s\n", i2c_buses[i].name);
pr_error("I2C SFP init failed for bus %s\n",
i2c_buses[i].name);
return -1;
}
// printf("init: success: %s\n", i2c_buses[i].name);
......
......@@ -33,10 +33,10 @@ extern void wrs_msg_init(int argc, char **argv);
#ifdef DEBUG /* We had it, so let's keep this build-time thing */
# define WRS_MSG_DEFAULT_LEVEL LOG_DEBUG
#else
# define WRS_MSG_DEFAULT_LEVEL LOG_WARNING
# define WRS_MSG_DEFAULT_LEVEL LOG_INFO
#endif
#define WRS_MSG_DETAILS_AT LOG_INFO /* >= info (so, debug) use __LINE__ */
#define WRS_MSG_DETAILS_AT LOG_DEBUG /* >= for debug use __LINE__ */
/* This is the external function for it all */
extern void __wrs_msg(int level, const char *func, int line,
......
......@@ -10,7 +10,7 @@
int shw_init()
{
pr_info("%s\n======================================================\n",
pr_debug("%s\n======================================================\n",
__TIME__);
/* Init input/output (GPIO & CPU I2C) */
......@@ -37,6 +37,6 @@ int shw_init()
int shw_exit_fatal(void)
{
pr_error("exiting due to fatal error.\n");
pr_error("Exiting due to fatal error.\n");
exit(-1);
}
......@@ -48,12 +48,12 @@ int shw_pio_mmap_init()
AT91C_BASE_SYS_RAW);
if (_sys_base == NULL) {
pr_error("Can't mmap CPU GPIO regs\n");
pr_error("Can't mmap CPU GPIO registers\n");
close(fd);
exit(-1);
}
pr_info("AT91_SYS virtual base = %p\n", _sys_base);
pr_debug("AT91_SYS virtual base = %p\n", _sys_base);
pmc_enable_clock(2); /* enable PIO clocks */
pmc_enable_clock(3);
......
......@@ -112,7 +112,7 @@ int shw_io_init()
I2C_shw_io_led_state_o);
}
pr_info("version=%d (CPUPWN=%d)\n", ver, ver < 330);
pr_info("Hardware version is %d (CPUPWN=%d)\n", ver, ver < 330);
return 0;
}
......@@ -140,7 +140,7 @@ int shw_io_configure_all()
//Do nothing for undefined type
break;
default:
pr_info(
pr_debug(
"Config not implemented for type %d for io #%d\n",
io->type, i);
break;
......@@ -192,7 +192,7 @@ uint32_t shw_io_read(shw_io_id_t id)
shift);
}
case SHW_UNDEF:
pr_error( "IO #%d is undef\n", id);
pr_error( "IO #%d is undefined\n", id);
break;
default:
pr_error( "Unknow type %d for io #%d\n",
......@@ -232,7 +232,7 @@ int shw_io_write(shw_io_id_t id, uint32_t value)
i32data);
}
case SHW_UNDEF:
pr_error( "Pin #%d is undef\n", id);
pr_error( "Pin #%d is undefined\n", id);
break;
default:
pr_error( "Unknow type %d for io #%d\n",
......
......@@ -118,7 +118,7 @@ void show_help(char *prgname)
fprintf(stderr,""
" help: Show this message\n"
" list: List the routing table (same as empty command)\n"
" remove <ifnum> [<force>]: Remove all dynamic entries for one interface\n"
" remove <ifnum>: Remove all dynamic entries for one interface\n"
" add <mac (XX:XX:XX:XX:XX)> <ifnum> [<mode>]: Add entry for a specific \n"
" MAC address (mode={1=dynamic,0=static}\n"
" vlan <vid> <fid> <hex mask> [<drop>, <prio>, <has_prio>, <prio_override>]: \n"
......
......@@ -238,7 +238,7 @@ void endless_watchdog(void)
/* handle reset if needed */
if (rst) {
pr_warning("SWCore stuck... resetting\n");
pr_warning("Switching core stuck... resetting\n");
force_rst();
clear_stuck(stuck_cnt);
}
......@@ -297,7 +297,7 @@ int main(int argc, char *argv[])
pr_info("Read %d ports from cmdline\n", port_num);
break;
case 'p':
pr_info("use pidfile %s", optarg);
pr_debug("use pidfile %s", optarg);
write_pidfile(optarg, getpid());
break;
case 'q': break; /* done in wrs_msg_init() */
......@@ -320,7 +320,7 @@ int main(int argc, char *argv[])
}
if (daemon_mode) {
wrs_msg(LOG_ALERT, "wrs_watchdog. Commit %s, built on "
pr_info("wrs_watchdog. Commit %s, built on "
__DATE__ "\n", __GIT_VER__);
pr_info("Demonize\n");
......
......@@ -229,7 +229,7 @@ int hal_check_running()
struct wrs_shm_head *hal_head;
hal_head = wrs_shm_get(wrs_shm_hal, "", WRS_SHM_READ);
if (!hal_head) {
pr_info("Unable to open shm for HAL! Unable to check if there "
pr_error("Unable to open shm for HAL! Unable to check if there "
"is another HAL instance running. Error: %s\n",
strerror(errno));
exit(-1);
......
......@@ -50,7 +50,7 @@ static void call_cleanup_cbs(void)
{
int i;
pr_info("Cleaning up...\n");
pr_debug("Cleaning up...\n");
for (i = 0; i < MAX_CLEANUP_CALLBACKS; i++)
if (cleanup_cb[i])
cleanup_cb[i] ();
......@@ -82,7 +82,7 @@ static int hal_init(void)
//trace_log_stderr();
int line;
pr_info("initializing...\n");
pr_debug("initializing...\n");
memset(cleanup_cb, 0, sizeof(cleanup_cb));
......@@ -220,8 +220,7 @@ int main(int argc, char *argv[])
wrs_msg_init(argc, argv);
/* Print HAL's version */
wrs_msg(LOG_ALERT, "wrsw_hal. Commit %s, built on " __DATE__ "\n",
__GIT_VER__);
pr_info("wrsw_hal. Commit %s, built on " __DATE__ "\n", __GIT_VER__);
/* Prevent from running HAL twice - it will likely freeze the system */
if (hal_check_running()) {
......
......@@ -161,7 +161,7 @@ static int hal_port_init(int index)
pr_error("port index %i (%s): invalid role "
"\"%s\" specified\n", index, name, s);
pr_info("Port %s: mode %i\n", p->name, val);
pr_debug("Port %s: mode %i\n", p->name, val);
}
/* Get fiber type */
......@@ -553,7 +553,7 @@ static void hal_port_poll_sfp(void)
if (ports[i].in_use
&& (mask ^ old_mask) & (1 << hw_index)) {
int insert = mask & (1 << hw_index);
pr_info("Detected SFP %s "
pr_info("SFP Info: Detected SFP %s "
"on port %s.\n",
insert ? "insertion" : "removal",
ports[i].name);
......
......@@ -90,8 +90,12 @@ int hal_init_timing(char *filename)
continue;
}
if (pstate.flags & RTS_DMTD_LOCKED)
if (pstate.flags & RTS_DMTD_LOCKED) {
if (timing_mode == HAL_TIMING_MODE_GRAND_MASTER)
pr_info("GrandMaster locked to external "
"reference\n");
break;
}
usleep(100000);
}
......
......@@ -114,8 +114,7 @@ void init_shm(void)
/* check hal's shm version */
if (hal_head->version != HAL_SHMEM_VERSION) {
pr_error("unknown hal's shm version %i "
"(known is %i)\n",
pr_error("Unknown hal's shm version %i (known is %i)\n",
hal_head->version, HAL_SHMEM_VERSION);
exit(-1);
}
......@@ -124,8 +123,7 @@ void init_shm(void)
* addresses. No need to re-dereference pointer at each read. */
hal_ports = wrs_shm_follow(hal_head, h->ports);
if (hal_nports_local > HAL_MAX_PORTS) {
pr_error("Too many ports reported by HAL. "
"%d vs %d supported\n",
pr_error("Too many ports reported by HAL. %d vs %d supported\n",
hal_nports_local, HAL_MAX_PORTS);
exit(-1);
}
......@@ -143,8 +141,7 @@ int rtu_init(void)
// Used to 'get' RTU IRQs from kernel
fd = open(RTU_DEVNAME, O_RDWR);
if (fd < 0) {
pr_error(
"Can't open %s: is the RTU kernel driver loaded?\n",
pr_error("Can't open %s: is the RTU kernel driver loaded?\n",
RTU_DEVNAME);
return errno;
}
......@@ -153,7 +150,7 @@ int rtu_init(void)
if (err)
return err;
pr_info("module initialized\n");
pr_debug("module initialized\n");
return 0;
}
......@@ -163,7 +160,7 @@ void rtu_exit(void)
if (fd >= 0)
close(fd);
pr_info("module cleanup\n");
pr_debug("module cleanup\n");
}
#define rtu_rd(reg) \
......@@ -398,9 +395,9 @@ void rtu_write_vlan_entry(int vid, struct rtu_vlan_table_entry *ent)
rtu_wr(VTR1, vtr1);
if (ent->drop > 0 && ent->port_mask == 0x0) {
pr_info("RemoveVlan: vid %d (fid %d)\n", vid, ent->fid);
pr_info("Removing VLAN: vid %d (fid %d)\n", vid, ent->fid);
} else {
pr_info("AddVlan: vid %d (fid %d) port_mask 0x%x\n",
pr_info("Adding VLAN: vid %d (fid %d) port_mask 0x%x\n",
vid, ent->fid, ent->port_mask);
}
......
......@@ -127,7 +127,7 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
uint32_t bitmap[RTU_ENTRIES / 32];
int err;
struct rtu_shmem_header *rtu_hdr;
pr_info("Open rtu shmem.\n");
pr_debug("Open rtu shmem.\n");
rtu_port_shmem = wrs_shm_get(wrs_shm_rtu, "wrsw_rtud",
WRS_SHM_WRITE | WRS_SHM_LOCKED);
if (!rtu_port_shmem) {
......@@ -138,7 +138,7 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
if (rtu_port_shmem->pidsequence == 1) {
/* for first RTUd run */
pr_info("Alloc rtu_hdr\n");
pr_debug("Alloc rtu_hdr\n");
rtu_hdr = wrs_shm_alloc(rtu_port_shmem, sizeof(*rtu_hdr));
} else {
/* rtu_hdr was created at header->offset */
......@@ -156,13 +156,13 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
if (!rtu_hdr->filters) {
/* for first RTUd run */
pr_info("Alloc rtu_htab\n");
pr_info("Allocating a new, clean hash table\n");
rtu_htab = wrs_shm_alloc(rtu_port_shmem,
sizeof(*rtu_htab) * HTAB_ENTRIES);
rtu_hdr->filters = (struct rtu_filtering_entry *) rtu_htab;
rtu_hdr->filters_offset =
(void *)rtu_htab - (void *)rtu_port_shmem;
pr_info("Clean filtering database.\n");
pr_debug("Clean filtering database.\n");
clean_fd(); /* clean filtering database */
} else {
pr_info("Use existing filtering table.\n");
......@@ -179,16 +179,16 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
if (!rtu_hdr->vlans) {
/* for first RTUd run */
pr_info("Alloc vlan_tab\n");
pr_info("Allocating a new, clean vlan table\n");
vlan_tab = wrs_shm_alloc(rtu_port_shmem,
sizeof(*vlan_tab) * NUM_VLANS);
rtu_hdr->vlans = vlan_tab;
rtu_hdr->vlans_offset =
(void *)vlan_tab - (void *)rtu_port_shmem;
pr_info("Clean vlan database.\n");
pr_debug("Clean vlan database.\n");
clean_vd(); /* clean VLAN database */
} else {
pr_info("Use existing vlan table.\n");
pr_info("Using existing vlan table.\n");
/* next RTUd runs */
rtu_hdr->vlans =
(void *)rtu_port_shmem + rtu_hdr->vlans_offset;
......@@ -207,16 +207,16 @@ int rtu_fd_init(uint16_t poly, unsigned long aging)
/* add version info */
rtu_port_shmem->version = RTU_SHMEM_VERSION;
pr_info("clean aging map.\n");
pr_debug("clean aging map.\n");
rtu_read_aging_bitmap(bitmap); // clean aging registers
pr_info("set aging time [%ld].\n", aging);
pr_debug("set aging time [%ld].\n", aging);
aging_time = aging;
err = pthread_mutex_init(&fd_mutex, NULL);
if (err)
return err;
pr_info("set hash poly.\n");
pr_debug("set hash poly.\n");
rtu_fd_set_hash_poly(poly);
/* release process waiting on rtud's shm
......@@ -312,8 +312,7 @@ int rtu_fd_create_entry(uint8_t mac[ETH_ALEN], uint16_t vid, uint32_t port_mask,
n_buckets = htab_count_buckets(eaddr);
if (n_buckets == RTU_BUCKETS) {
pr_error(
"Hash %03x has no buckets left.\n",
pr_error("Hash %03x has no buckets left.\n",
eaddr.hash);
wrs_shm_write(rtu_port_shmem,
WRS_SHM_WRITE_END);
......@@ -533,7 +532,7 @@ static void rtu_fd_age_update(void)
continue;
if (0)
pr_info(
pr_debug(
"Updated htab entry age: mac = %s, hash = %03x:%d, delta_t = %ld\n",
mac_to_string(rtu_htab[hash]
[bucket].mac), hash,
......@@ -605,8 +604,8 @@ static void rtu_fd_age_out(void)
if (ent->valid && ent->dynamic
&& (time_after(t, ent->last_access_t)
|| ent->force_remove)) {
pr_info(
"Deleting htab entry: mac = %s, hash = 0x%x, bucket = %d, forced=%d\n",
pr_debug("Deleting htab entry: mac = %s, hash ="
" 0x%x, bucket = %d, forced=%d\n",
mac_to_string(ent->mac), i, j,
ent->force_remove);
hw_request(HW_REMOVE_REQ, ent->addr, ent);
......
......@@ -103,7 +103,7 @@ static int rtu_create_static_entries(void)
hal_nports_local);
// VLAN-aware Bridge reserved addresses (802.1Q-2005 Table 8.1)
pr_info("adding static routes for slow protocols...\n");
pr_info("Adding static routes for slow protocols...\n");
for (i = 0; i < NUM_RESERVED_ADDR; i++) {
slow_proto_mac[5] = i;
err =
......@@ -121,7 +121,7 @@ static int rtu_create_static_entries(void)
}
/* PTP over UDP */
pr_info("adding entry for PTP over UDP\n");
pr_info("Adding entry for PTP over UDP\n");
err =
rtu_fd_create_entry(udp_ptp_mac, 0, (1 << hal_nports_local),
STATIC, OVERRIDE_EXISTING);
......@@ -129,7 +129,7 @@ static int rtu_create_static_entries(void)
return err;
// Broadcast MAC
pr_info("adding static route for broadcast MAC...\n");
pr_info("Adding static route for broadcast MAC...\n");
err =
rtu_fd_create_entry(bcast_mac, 0,
enabled_port_mask | (1 << hal_nports_local),
......@@ -144,7 +144,7 @@ static int rtu_create_static_entries(void)
if (err)
return err;
pr_info("done creating static entries.\n");
pr_info("Done creating static entries.\n");
return 0;
}
......@@ -221,7 +221,7 @@ static int rtu_daemon_learning_process(void)
// Serve pending unrecognised request
err = rtu_read_learning_queue(&req);
if (!err) {
pr_info(
pr_debug(
"ureq: port %d src %s VID %d priority %d\n",
req.port_id,
mac_to_string(req.src),
......@@ -233,7 +233,7 @@ static int rtu_daemon_learning_process(void)
if (p->in_use && p->hw_index == req.port_id
&& !state_up(p->state)) {
port_down = 1;
pr_info("port down %d\n", i);
pr_debug("port down %d\n", i);
break;
}
}
......@@ -251,14 +251,14 @@ static int rtu_daemon_learning_process(void)
err = 0;
if (err == -ENOMEM) {
// TODO remove oldest entries (802.1D says you MAY do it)
pr_info("filtering database full\n");
pr_info("Filtering database full\n");
} else if (err) {
pr_info("create entry: err %d\n",
pr_error("Create entry: error %d\n",
err);
break;
}
} else {
pr_info("read learning queue: err %d\n", err);
pr_error("Read learning queue: error %d\n", err);
}
}
return err;
......@@ -276,7 +276,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
int i, err;
// init RTU HW
pr_info("init rtu hardware.\n");
pr_debug("Initializing RTU gateware.\n");
err = rtu_init();
if (err)
return err;
......@@ -285,11 +285,11 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
return err;
// disable RTU
pr_info("disable rtu.\n");
pr_debug("Disabling RTU.\n");
rtu_disable();
// init configuration for ports
pr_info("init port config.\n");
pr_info("Initial configuration for all ports.\n");
for (i = MIN_PORT; i <= MAX_PORT; i++) {
// MIN_PORT <= port <= MAX_PORT, thus no err returned
......@@ -301,7 +301,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
}
// init filtering database
pr_info("init fd.\n");
pr_info("Initializing filtering database.\n");
err = rtu_fd_init(poly, aging_time);
if (err)
return err;
......@@ -312,7 +312,7 @@ static int rtu_daemon_init(uint16_t poly, unsigned long aging_time)
return err;
// turn on RTU
pr_info("enable rtu.\n");
pr_debug("Enabling RTU.\n");
rtu_enable();
rtud_init_exports();
......@@ -355,8 +355,7 @@ int main(int argc, char **argv)
wrs_msg_init(argc, argv);
/* Print RTUd's version */
wrs_msg(LOG_ALERT, "wrsw_rtud. Commit %s, built on " __DATE__ "\n",
__GIT_VER__);
pr_info("wrsw_rtud. Commit %s, built on " __DATE__ "\n", __GIT_VER__);
if (argc > 1) {
// Strip out path from argv[0] if exists, and extract command name
......
......@@ -51,15 +51,9 @@ int rtudexp_clear_entries(const struct minipc_pd *pd,
uint32_t * args, void *ret)
{
int iface_num = (int)args[0];
int force = (int)args[1];
int *p_ret = (int *)ret; //force pointed to int type
pr_info("iface=%d, force=%d\n", iface_num, force);
//Do nothing
if (force)
pr_info("wr%d > force %d is not implemented\n",
iface_num, force);
pr_debug("Removing dynamic entries on interface %d\n", iface_num);
rtu_fd_clear_entries_for_port(iface_num);
*p_ret = 0;
......@@ -118,7 +112,7 @@ int rtud_init_exports()
if (!rtud_ch < 0)
return -1;
pr_info("wripc server created [fd %d]\n",
pr_debug("wripc server created [fd %d]\n",
minipc_fileno(rtud_ch));
if (getenv("RTUD_MINIPC_DEBUG"))
minipc_set_logfile(rtud_ch, stderr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment