Commit e8b88ab5 authored by Alessandro Rubini's avatar Alessandro Rubini

general: remove 2 cfg fields, duplicated from ppi

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 884bcf0a
...@@ -140,12 +140,11 @@ int main(int argc, char **argv) ...@@ -140,12 +140,11 @@ int main(int argc, char **argv)
sim_set_global_DS(ppi); sim_set_global_DS(ppi);
ppi->iface_name = ppi->cfg.iface_name; ppi->iface_name = ppi->cfg.iface_name;
ppi->port_name = ppi->cfg.port_name; ppi->port_name = ppi->cfg.port_name;
if (ppi->cfg.proto == PPSI_PROTO_RAW) if (ppi->proto == PPSI_PROTO_RAW)
pp_printf("Warning: simulator doesn't support raw " pp_printf("Warning: simulator doesn't support raw "
"ethernet. Using UDP\n"); "ethernet. Using UDP\n");
NP(ppi)->ch[PP_NP_GEN].fd = -1; NP(ppi)->ch[PP_NP_GEN].fd = -1;
NP(ppi)->ch[PP_NP_EVT].fd = -1; NP(ppi)->ch[PP_NP_EVT].fd = -1;
ppi->role = ppi->cfg.role;
ppi->t_ops = &DEFAULT_TIME_OPS; ppi->t_ops = &DEFAULT_TIME_OPS;
ppi->n_ops = &DEFAULT_NET_OPS; ppi->n_ops = &DEFAULT_NET_OPS;
if (pp_sim_is_master(ppi)) if (pp_sim_is_master(ppi))
......
...@@ -86,11 +86,6 @@ int main(int argc, char **argv) ...@@ -86,11 +86,6 @@ int main(int argc, char **argv)
ppi->glbs = ppg; ppi->glbs = ppg;
ppi->iface_name = ppi->cfg.iface_name; ppi->iface_name = ppi->cfg.iface_name;
ppi->port_name = ppi->cfg.port_name; ppi->port_name = ppi->cfg.port_name;
/* this old-fashioned "ethernet_mode" is a single bit */
ppi->proto = ppi->cfg.proto;
ppi->role = ppi->cfg.role;
/* FIXME set ppi ext enable as defined in its pp_link */
ppi->portDS = calloc(1, sizeof(*ppi->portDS)); ppi->portDS = calloc(1, sizeof(*ppi->portDS));
......
...@@ -155,8 +155,6 @@ int main(int argc, char **argv) ...@@ -155,8 +155,6 @@ int main(int argc, char **argv)
ppi->glbs = ppg; ppi->glbs = ppg;
ppi->iface_name = ppi->cfg.iface_name; ppi->iface_name = ppi->cfg.iface_name;
ppi->port_name = ppi->cfg.port_name; ppi->port_name = ppi->cfg.port_name;
ppi->proto = ppi->cfg.proto;
ppi->role = ppi->cfg.role;
ppi->portDS = calloc(1, sizeof(*ppi->portDS)); ppi->portDS = calloc(1, sizeof(*ppi->portDS));
if (!ppi->portDS) if (!ppi->portDS)
exit(__LINE__); exit(__LINE__);
......
...@@ -122,13 +122,11 @@ struct pp_net_path { ...@@ -122,13 +122,11 @@ struct pp_net_path {
/* /*
* Struct containg the result of ppsi.conf parsing: one for each link * Struct containg the result of ppsi.conf parsing: one for each link
* (see lib/conf.c) * (see lib/conf.c). Actually, protocol and role are in the main ppi.
*/ */
struct pp_instance_cfg { struct pp_instance_cfg {
char port_name[16]; char port_name[16];
char iface_name[16]; char iface_name[16];
int proto; /* 0: raw, 1: udp */
int role; /* 0: auto, 1: master, 2: slave */
int ext; /* 0: none, 1: whiterabbit */ /* FIXME extension enumeration */ int ext; /* 0: none, 1: whiterabbit */ /* FIXME extension enumeration */
}; };
......
...@@ -73,14 +73,14 @@ static int f_if(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg) ...@@ -73,14 +73,14 @@ static int f_if(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg)
static int f_proto(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg) static int f_proto(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg)
{ {
CHECK_PPI(1); CHECK_PPI(1);
CUR_PPI(ppg)->cfg.proto = arg->i; CUR_PPI(ppg)->proto = arg->i;
return 0; return 0;
} }
static int f_role(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg) static int f_role(int lineno, struct pp_globals *ppg, union pp_cfg_arg *arg)
{ {
CHECK_PPI(1); CHECK_PPI(1);
CUR_PPI(ppg)->cfg.role = arg->i; CUR_PPI(ppg)->role = arg->i;
return 0; return 0;
} }
......
...@@ -43,7 +43,7 @@ static int wr_open(struct pp_globals *ppg, struct pp_runtime_opts *rt_opts) ...@@ -43,7 +43,7 @@ static int wr_open(struct pp_globals *ppg, struct pp_runtime_opts *rt_opts)
INST(ppg, i)->ext_data = &wr_data; INST(ppg, i)->ext_data = &wr_data;
if (ppi->cfg.ext == PPSI_EXT_WR) { if (ppi->cfg.ext == PPSI_EXT_WR) {
switch (ppi->cfg.role) { switch (ppi->role) {
case PPSI_ROLE_MASTER: case PPSI_ROLE_MASTER:
WR_DSPOR(ppi)->wrConfig = WR_M_ONLY; WR_DSPOR(ppi)->wrConfig = WR_M_ONLY;
break; break;
......
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