Commit b0e47d8a authored by Grzegorz Daniluk's avatar Grzegorz Daniluk Committed by Adam Wujek

wrsw_rtud: cleanup in log messages - levels and content

parent ee3fd196
......@@ -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
......
......@@ -54,11 +54,11 @@ int rtudexp_clear_entries(const struct minipc_pd *pd,
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);
pr_debug("Removing dynamic entries on interface %d, force=%d\n", iface_num, force);
//Do nothing
if (force)
pr_info("wr%d > force %d is not implemented\n",
pr_debug("wr%d > force %d is not implemented\n",
iface_num, force);
rtu_fd_clear_entries_for_port(iface_num);
......@@ -118,7 +118,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