Commit f6a899e3 authored by Tristan Gingold's avatar Tristan Gingold

netif: remove name (was almost unused)

parent 6d679d8b
......@@ -765,8 +765,8 @@ int wrc_board_early_init()
net_rst();
ep_init( &wrc_endpoint_dev, (void *) BASE_WR_ENDPOINT_MAIN );
ep_init( &board.ep_btrain, (void *) BASE_WR_ENDPOINT_BTRAIN );
netif_register_device( "wru0", &wrc_endpoint_dev );
netif_register_device( "wru1", &board.ep_btrain );
netif_register_device(&wrc_endpoint_dev);
netif_register_device(&board.ep_btrain );
#if defined (CONFIG_TARGET_AFCZ_V1)
afczv1_read_persistent_mac();
......
......@@ -2506,7 +2506,7 @@ int wrc_board_early_init()
/* reset the networking part of the WRCore and start the WR Endpoint */
ep_init( &wrc_endpoint_dev, (void *) BASE_EP );
ep_set_mac_addr( &wrc_endpoint_dev, ertm14_mac );
netif_register_device( "wru0", &wrc_endpoint_dev );
netif_register_device(&wrc_endpoint_dev );
/* Sleep for 1s to make sure WRS v4.2 always realizes that
* the link is down */
......
......@@ -95,7 +95,7 @@ int wrc_board_early_init()
ep_init( &wrc_endpoint_dev, (void *) BASE_EP );
ep_set_mac_addr( &wrc_endpoint_dev, board_mac_addr );
netif_register_device( "wru0", &wrc_endpoint_dev );
netif_register_device(&wrc_endpoint_dev );
/* Sleep for 1s to make sure WRS v4.2 always realizes that
* the link is down */
......
......@@ -118,7 +118,7 @@ int wrc_board_early_init(void)
ep_init(&wrc_endpoint_dev, (void *) BASE_EP);
ep_set_mac_addr( &wrc_endpoint_dev, board_mac_addr );
netif_register_device( "wru0", &wrc_endpoint_dev );
netif_register_device(&wrc_endpoint_dev );
/* Sleep for 1s to make sure WRS v4.2 always realizes that
* the link is down */
......
......@@ -22,19 +22,19 @@
static unsigned char netif_n_count = 0;
static struct wrc_netif_device netif_devs[WRC_NETIF_MAX_DEVICES];
int netif_register_device(const char *name, struct wr_endpoint_device* ep)
int netif_register_device(struct wr_endpoint_device* ep)
{
if( netif_n_count >= WRC_NETIF_MAX_DEVICES )
return -1;
struct wrc_netif_device *ndev = &netif_devs[ netif_n_count ];
netif_n_count++;
struct wrc_netif_device *ndev = &netif_devs[netif_n_count];
ndev->name = name;
ndev->ep = ep;
ndev->link_state = NETIF_LINK_DOWN;
dev_dbg("Registered network interface %s @ %p\n", ndev->name, ndev->ep->base );
dev_dbg("Registered network interface %u @ %p\n", netif_n_count, ndev->ep->base );
netif_n_count++;
return 0;
}
......
......@@ -17,12 +17,11 @@
struct wrc_netif_device
{
const char* name;
struct wr_endpoint_device* ep;
unsigned char link_state;
};
int netif_register_device( const char *name, struct wr_endpoint_device* ep );
int netif_register_device(struct wr_endpoint_device* ep);
int netif_get_device_count(void);
struct wrc_netif_device* netif_get_device(int idx);
int netif_init(void);
......
......@@ -229,13 +229,13 @@ static void print_main_description(void)
ndevs = netif_get_device_count();
/*show_ports */
cprintf(C_CYAN, "-----+-------------------+-------------------------+---------+---------+-----\n");
pp_printf( " Itf | MAC | IP (source) | RX | TX | VLAN\n");
pp_printf( "-----+-------------------+-------------------------+---------+---------+-----\n");
cprintf(C_CYAN, "---+-------------------+-------------------------+---------+---------+-----\n");
pp_printf( " # | MAC | IP (source) | RX | TX | VLAN\n");
pp_printf( "---+-------------------+-------------------------+---------+---------+-----\n");
for (i = 0 ; i < ndevs; i++) {
/* reuse the string above, strings between "|" will be overwritten anyway */
pp_printf(" Itf | MAC | IP (source) | RX | TX | VLAN\n");
pp_printf(" # | MAC | IP (source) | RX | TX | VLAN\n");
}
pp_printf("\n--- HAL ---|------------- PPSI ------------------------------------------------\n");
......@@ -281,13 +281,13 @@ static void print_port(unsigned i)
char buf[20];
if (port_up) {
pcprintf(7, 1, C_GREEN, " %s", ndev->name);
pcprintf(7, 1, C_GREEN, " %u", i);
} else {
pcprintf(7, 1, C_RED, "*%s", ndev->name);
pcprintf(7, 1, C_RED, "*%u", i);
}
format_mac(buf, ndev->ep->mac_addr);
pcprintf(7, 8, C_MAGENTA, "%s", buf);
pcprintf(7, 6, C_MAGENTA, "%s", buf);
if (i != 0) /* FIXME: should be independent for each interface */
return;
......@@ -299,22 +299,22 @@ static void print_port(unsigned i)
format_ip(buf, ip);
switch (ip_status) {
case IP_TRAINING:
pcprintf(7, 28, C_RED, "BOOTP running ");
pcprintf(7, 26, C_RED, "BOOTP running ");
break;
case IP_OK_BOOTP:
pcprintf(7, 28, C_GREEN, "%16s(BOOTP)", buf);
pcprintf(7, 26, C_GREEN, "%16s(BOOTP)", buf);
break;
case IP_OK_STATIC:
pcprintf(7, 28, C_GREEN, "%15s(static)", buf);
pcprintf(7, 26, C_GREEN, "%15s(static)", buf);
break;
}
} else
pcprintf(7, 28, C_GREEN, " ");
pcprintf(7, 26, C_GREEN, " ");
minic_get_stats(&tx, &rx, &rx_err);
pcprintf(7, 54, C_MAGENTA, "%7d", rx);
pprintf(7, 64, "%7d", tx);
pprintf(7, 74, "%4d", wrc_vlan_number);
pcprintf(7, 52, C_MAGENTA, "%7d", rx);
pprintf(7, 62, "%7d", tx);
pprintf(7, 72, "%4d", wrc_vlan_number);
}
static void print_state(unsigned i)
......@@ -324,19 +324,7 @@ static void print_state(unsigned i)
int locked = spll_check_lock(0);
int color;
if (port_up) {
pcprintf(12, 1, C_GREEN, " %s", ndev->name);
} else {
pcprintf(12, 1, C_RED, "*%s", ndev->name);
}
pcprintf(12, 8, C_GREEN, locked ? "Lck" : " ");
/* ----------------------------------------------------------------------------------------------------------------------- */
/*
* Actually, what is interesting is the PTP state.
* For this lookup, the port in ppsi shmem
*/
/* Assume one instance per port */
/* FIXME: add support of more ports */
// for (j = 0; j < ppg->nlinks; j++) {
......@@ -351,6 +339,14 @@ static void print_state(unsigned i)
char proto;
char mac_buf[20];
if (port_up) {
pcprintf(12, 1, C_GREEN, " %s", ppi_pt->iface_name);
} else {
pcprintf(12, 1, C_RED, "*%s", ppi_pt->iface_name);
}
pcprintf(12, 8, C_GREEN, locked ? "Lck" : " ");
// Evaluate the instance configuration
if (is_slaveOnly(ppg->defaultDS)) {
str_config = "slaveOnly";
......
......@@ -115,7 +115,7 @@ static void wrc_initialize(void)
#ifndef BOARD_HAS_CUSTOM_NETWORK_INIT
net_rst();
ep_init( &wrc_endpoint_dev, (void *) BASE_EP );
netif_register_device( "wr0", &wrc_endpoint_dev );
netif_register_device(&wrc_endpoint_dev );
/* Sleep for 1s to make sure WRS v4.2 always realizes that
* the link is down */
timer_delay_ms(200);
......
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